Skip to content

Commit

Permalink
Remove keepOwnerReference and stripLabels logic in ReplicateTo functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jkroepke committed Nov 25, 2021
1 parent dbfc1ca commit 7e07b4a
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 43 deletions.
11 changes: 0 additions & 11 deletions replicate/configmap/configmaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,6 @@ func (r *Replicator) ReplicateDataFrom(sourceObj interface{}, targetObj interfac
}

targetCopy := target.DeepCopy()

keepOwnerReferences, ok := source.Annotations[common.KeepOwnerReferences]
if !ok || keepOwnerReferences != "true" {
targetCopy.OwnerReferences = nil
}

stripLabels, ok := source.Annotations[common.StripLabels]
if ok && stripLabels == "true" {
targetCopy.Labels = make(map[string]string)
}

if targetCopy.Data == nil {
targetCopy.Data = make(map[string]string)
}
Expand Down
11 changes: 0 additions & 11 deletions replicate/role/roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,6 @@ func (r *Replicator) ReplicateDataFrom(sourceObj interface{}, targetObj interfac
}

targetCopy := target.DeepCopy()

keepOwnerReferences, ok := source.Annotations[common.KeepOwnerReferences]
if !ok || keepOwnerReferences != "true" {
targetCopy.OwnerReferences = nil
}

stripLabels, ok := source.Annotations[common.StripLabels]
if ok && stripLabels == "true" {
targetCopy.Labels = make(map[string]string)
}

targetCopy.Rules = source.Rules

logger.Infof("updating target %s/%s", target.Namespace, target.Name)
Expand Down
10 changes: 0 additions & 10 deletions replicate/rolebinding/rolebindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,6 @@ func (r *Replicator) ReplicateDataFrom(sourceObj interface{}, targetObj interfac
}

targetCopy := target.DeepCopy()
keepOwnerReferences, ok := source.Annotations[common.KeepOwnerReferences]
if !ok || keepOwnerReferences != "true" {
targetCopy.OwnerReferences = nil
}

stripLabels, ok := source.Annotations[common.StripLabels]
if ok && stripLabels == "true" {
targetCopy.Labels = make(map[string]string)
}

targetCopy.Subjects = source.Subjects

log.Infof("updating target %s/%s", target.Namespace, target.Name)
Expand Down
11 changes: 0 additions & 11 deletions replicate/secret/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,6 @@ func (r *Replicator) ReplicateDataFrom(sourceObj interface{}, targetObj interfac
}

targetCopy := target.DeepCopy()

stripLabels, ok := source.Annotations[common.StripLabels]
if ok && stripLabels == "true" {
targetCopy.Labels = make(map[string]string)
}

keepOwnerReferences, ok := source.Annotations[common.KeepOwnerReferences]
if !ok || keepOwnerReferences != "true" {
targetCopy.OwnerReferences = nil
}

if targetCopy.Data == nil {
targetCopy.Data = make(map[string][]byte)
}
Expand Down

0 comments on commit 7e07b4a

Please sign in to comment.