Skip to content

Commit

Permalink
Fix Apply{Deployment,Deployment} to copy input before mutatating
Browse files Browse the repository at this point in the history
  • Loading branch information
marun committed Apr 20, 2020
1 parent d3cb092 commit a20f1d9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/operator/resource/resourceapply/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ import (
)

// ApplyDeployment merges objectmeta and requires matching generation. It returns the final Object, whether any change as made, and an error
func ApplyDeployment(client appsclientv1.DeploymentsGetter, recorder events.Recorder, required *appsv1.Deployment, expectedGeneration int64,
func ApplyDeployment(client appsclientv1.DeploymentsGetter, recorder events.Recorder, requiredOriginal *appsv1.Deployment, expectedGeneration int64,
forceRollout bool) (*appsv1.Deployment, bool, error) {

required := requiredOriginal.DeepCopy()
if required.Annotations == nil {
required.Annotations = map[string]string{}
}
Expand Down Expand Up @@ -67,7 +69,8 @@ func ApplyDeployment(client appsclientv1.DeploymentsGetter, recorder events.Reco
}

// ApplyDaemonSet merges objectmeta and requires matching generation. It returns the final Object, whether any change as made, and an error
func ApplyDaemonSet(client appsclientv1.DaemonSetsGetter, recorder events.Recorder, required *appsv1.DaemonSet, expectedGeneration int64, forceRollout bool) (*appsv1.DaemonSet, bool, error) {
func ApplyDaemonSet(client appsclientv1.DaemonSetsGetter, recorder events.Recorder, requiredOriginal *appsv1.DaemonSet, expectedGeneration int64, forceRollout bool) (*appsv1.DaemonSet, bool, error) {
required := requiredOriginal.DeepCopy()
if required.Annotations == nil {
required.Annotations = map[string]string{}
}
Expand Down

0 comments on commit a20f1d9

Please sign in to comment.