Skip to content

Commit

Permalink
DRAFT code to remove ingress and node-services during reconcile
Browse files Browse the repository at this point in the history
  • Loading branch information
janhoy committed Jan 3, 2024
1 parent 8e986e6 commit 2b42f5b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions controllers/solrcloud_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,21 @@ func (r *SolrCloudReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
}
}
}
} else {
// Need no individual services per onde, delete if found
for _, nodeName := range solrNodeNames {
serviceName := nodeName
foundService := &corev1.Service{}
err = r.Get(ctx, types.NamespacedName{Name: serviceName, Namespace: instance.Namespace}, foundService)
if err == nil {
err = r.Delete(ctx, foundService)
if err != nil {
return requeueOrNot, err
}
} else if !errors.IsNotFound(err) {
return requeueOrNot, err
}
}
}

// Generate HeadlessService
Expand Down Expand Up @@ -347,6 +362,16 @@ func (r *SolrCloudReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
if err != nil {
return requeueOrNot, err
}
} else {
// If ingress exists, delete it
foundIngress := &netv1.Ingress{}
err = r.Get(ctx, types.NamespacedName{Name: instance.CommonIngressName(), Namespace: instance.GetNamespace()}, foundIngress)
if err == nil {
err = r.Delete(ctx, foundIngress)
if err != nil {
return requeueOrNot, err
}
}
}

var statefulSet *appsv1.StatefulSet
Expand Down

0 comments on commit 2b42f5b

Please sign in to comment.