diff --git a/apis/quay/v1/quayregistry_types.go b/apis/quay/v1/quayregistry_types.go index 629924067..b65daa164 100644 --- a/apis/quay/v1/quayregistry_types.go +++ b/apis/quay/v1/quayregistry_types.go @@ -395,18 +395,26 @@ func EnsureRegistryEndpoint(ctx *quaycontext.QuayRegistryContext, quay *QuayRegi return updatedQuay, quay.Status.RegistryEndpoint == updatedQuay.Status.RegistryEndpoint } -// EnsureConfigEditorEndpoint sets the `status.configEditorEndpoint` field and returns `ok` if it was unchanged. -func EnsureConfigEditorEndpoint(ctx *quaycontext.QuayRegistryContext, quay *QuayRegistry) (*QuayRegistry, bool) { - updatedQuay := quay.DeepCopy() +// EnsureConfigEditorEndpoint sets the `status.configEditorEndpoint` field. If routes are +// not supported or route component is unmanaged this sets configEditorEndpoint to empty +// string. +func EnsureConfigEditorEndpoint(ctx *quaycontext.QuayRegistryContext, quay *QuayRegistry) { + if !ctx.SupportsRoutes { + quay.Status.ConfigEditorEndpoint = "" + return + } - if ctx.SupportsRoutes { - updatedQuay.Status.ConfigEditorEndpoint = "https://" + strings.Join([]string{ - strings.Join([]string{quay.GetName(), "quay-config-editor", quay.GetNamespace()}, "-"), - ctx.ClusterHostname}, - ".") + if !ComponentIsManaged(quay.Spec.Components, ComponentRoute) { + quay.Status.ConfigEditorEndpoint = "" + return } - return updatedQuay, quay.Status.ConfigEditorEndpoint == updatedQuay.Status.ConfigEditorEndpoint + quay.Status.ConfigEditorEndpoint = fmt.Sprintf( + "https://%s-quay-config-editor-%s.%s", + quay.GetName(), + quay.GetNamespace(), + ctx.ClusterHostname, + ) } // Owns verifies if a QuayRegistry object owns provided Object. diff --git a/controllers/quay/quayregistry_controller.go b/controllers/quay/quayregistry_controller.go index 88585357d..7b541c391 100644 --- a/controllers/quay/quayregistry_controller.go +++ b/controllers/quay/quayregistry_controller.go @@ -415,7 +415,7 @@ func (r *QuayRegistryReconciler) Reconcile(ctx context.Context, req ctrl.Request } } - updatedQuay, _ = v1.EnsureConfigEditorEndpoint(quayContext, updatedQuay) + v1.EnsureConfigEditorEndpoint(quayContext, updatedQuay) updatedQuay.Status.ConfigEditorCredentialsSecret = configEditorCredentialsSecretFrom(deploymentObjects) if c := v1.GetCondition(updatedQuay.Status.Conditions, v1.ConditionTypeRolloutBlocked); c != nil && c.Status == metav1.ConditionTrue && c.Reason == v1.ConditionReasonConfigInvalid {