diff --git a/controllers/gitopsservice_controller.go b/controllers/gitopsservice_controller.go index 7061cdba2..cf9f8d7ef 100644 --- a/controllers/gitopsservice_controller.go +++ b/controllers/gitopsservice_controller.go @@ -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 diff --git a/controllers/kam.go b/controllers/kam.go index e42d8437e..669290747 100644 --- a/controllers/kam.go +++ b/controllers/kam.go @@ -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)