Skip to content

Commit

Permalink
Merge pull request #460 from iam-veeramalla/fixKamUpgrade
Browse files Browse the repository at this point in the history
fix: securityContext for Kam container during upgrade
  • Loading branch information
iam-veeramalla authored Mar 13, 2023
2 parents 8b7bcab + 0cd58ba commit 633655a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions controllers/gitopsservice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,10 @@ func (r *ReconcileGitopsService) reconcileBackend(gitopsserviceNamespacedName ty
found.Spec.Template.Spec.Containers[0].Resources = deploymentObj.Spec.Template.Spec.Containers[0].Resources
changed = true
}
if !reflect.DeepEqual(found.Spec.Template.Spec.Containers[0].SecurityContext, deploymentObj.Spec.Template.Spec.Containers[0].SecurityContext) {
found.Spec.Template.Spec.Containers[0].SecurityContext = deploymentObj.Spec.Template.Spec.Containers[0].SecurityContext
changed = true
}
if !reflect.DeepEqual(found.Spec.Template.Spec.NodeSelector, deploymentObj.Spec.Template.Spec.NodeSelector) {
found.Spec.Template.Spec.NodeSelector = deploymentObj.Spec.Template.Spec.NodeSelector
changed = true
Expand Down
4 changes: 4 additions & 0 deletions controllers/kam.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ func (r *ReconcileGitopsService) reconcileCLIServer(cr *pipelinesv1alpha1.Gitops
existingDeployment.Spec.Template.Spec.SecurityContext = deploymentObj.Spec.Template.Spec.SecurityContext
changed = true
}
if !reflect.DeepEqual(existingDeployment.Spec.Template.Spec.Containers[0].SecurityContext, deploymentObj.Spec.Template.Spec.Containers[0].SecurityContext) {
existingDeployment.Spec.Template.Spec.Containers[0].SecurityContext = deploymentObj.Spec.Template.Spec.Containers[0].SecurityContext
changed = true
}

if changed {
err = r.Client.Update(context.TODO(), existingDeployment)
Expand Down

0 comments on commit 633655a

Please sign in to comment.