Skip to content

Commit

Permalink
If we are using Routes, ensure that the ingress is removed
Browse files Browse the repository at this point in the history
Sometimes when we are initially created we go down the ingress path rather
than the routes.  Then certificates are created and we switch to routes
instead.  Unfortunately nothing was cleaning up the ingress (and potentially
associated route httpd-xxxxx if we are running in OpenShift.)  This ensures
that if we are using routes, we clean up any ingress that we may have created
in the past.

CP4AIOPS-6311
  • Loading branch information
bdunne committed Sep 18, 2024
1 parent e412deb commit ceb4566
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions manageiq-operator/internal/controller/manageiq_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,11 @@ func (r *ManageIQReconciler) generateHttpdResources(cr *miqv1alpha1.ManageIQ) er
} else if result != controllerutil.OperationResultNone {
logger.Info("Route has been reconciled", "component", "httpd", "result", result)
}

ingress := &networkingv1.Ingress{}
if err := r.Client.Get(context.TODO(), types.NamespacedName{Namespace: cr.Namespace, Name: "httpd"}, ingress); err == nil {
r.Client.Delete(context.TODO(), ingress)
}
} else {
httpdIngress, mutateFunc := miqtool.Ingress(cr, r.Scheme)
if result, err := controllerutil.CreateOrUpdate(context.TODO(), r.Client, httpdIngress, mutateFunc); err != nil {
Expand Down

0 comments on commit ceb4566

Please sign in to comment.