Skip to content

Commit

Permalink
Add changes to existing service and update
Browse files Browse the repository at this point in the history
Signed-off-by: nmirasch <neus.miras@gmail.com>
  • Loading branch information
nmirasch committed Sep 25, 2024
1 parent b852365 commit b48b8f3
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions controllers/argocd/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,24 +451,26 @@ func (r *ReconcileArgoCD) reconcileServerService(cr *argoproj.ArgoCD) error {

existingSVC := &corev1.Service{}
if argoutil.IsObjectFound(r.Client, cr.Namespace, svc.Name, existingSVC) {
changed := false
if !cr.Spec.Server.IsEnabled() {
return r.Client.Delete(context.TODO(), svc)
}
if ensureAutoTLSAnnotation(r.Client, svc, common.ArgoCDServerTLSSecretName, cr.Spec.Server.WantsAutoTLS()) {
return r.Client.Update(context.TODO(), svc)
}
if !cr.Spec.Repo.IsEnabled() {
return nil
if ensureAutoTLSAnnotation(r.Client, existingSVC, common.ArgoCDServerTLSSecretName, cr.Spec.Server.WantsAutoTLS()) {
changed = true
}
changed := false
if !reflect.DeepEqual(svc.Spec.Type, existingSVC.Spec.Type) {
existingSVC.Spec.Type = svc.Spec.Type
changed = true
}
if changed {
return r.Client.Update(context.TODO(), svc)
return r.Client.Update(context.TODO(), existingSVC)
}
return nil
}

if !cr.Spec.Server.IsEnabled() {
return nil
}
return r.Client.Create(context.TODO(), svc)
}

Expand Down

0 comments on commit b48b8f3

Please sign in to comment.