Skip to content

Commit

Permalink
Merge pull request #458 from iam-veeramalla/fixKamUpgrade
Browse files Browse the repository at this point in the history
fix: handle kam security context during upgrades
  • Loading branch information
wtam2018 authored Mar 10, 2023
2 parents 02ce269 + 1bbc130 commit 8b7bcab
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 @@ -621,6 +621,10 @@ func (r *ReconcileGitopsService) reconcileBackend(gitopsserviceNamespacedName ty
found.Spec.Template.Spec.Tolerations = deploymentObj.Spec.Template.Spec.Tolerations
changed = true
}
if !reflect.DeepEqual(found.Spec.Template.Spec.SecurityContext, deploymentObj.Spec.Template.Spec.SecurityContext) {
found.Spec.Template.Spec.SecurityContext = deploymentObj.Spec.Template.Spec.SecurityContext
changed = true
}

if changed {
reqLogger.Info("Reconciling existing backend Deployment", "Namespace", deploymentObj.Namespace, "Name", deploymentObj.Name)
Expand Down
4 changes: 4 additions & 0 deletions controllers/kam.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ func (r *ReconcileGitopsService) reconcileCLIServer(cr *pipelinesv1alpha1.Gitops
existingDeployment.Spec.Template.Spec.Tolerations = deploymentObj.Spec.Template.Spec.Tolerations
changed = true
}
if !reflect.DeepEqual(existingDeployment.Spec.Template.Spec.SecurityContext, deploymentObj.Spec.Template.Spec.SecurityContext) {
existingDeployment.Spec.Template.Spec.SecurityContext = deploymentObj.Spec.Template.Spec.SecurityContext
changed = true
}

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

0 comments on commit 8b7bcab

Please sign in to comment.