diff --git a/controllers/quay/quayregistry_controller.go b/controllers/quay/quayregistry_controller.go index 529be631e..126a3f50c 100644 --- a/controllers/quay/quayregistry_controller.go +++ b/controllers/quay/quayregistry_controller.go @@ -265,7 +265,7 @@ func (r *QuayRegistryReconciler) Reconcile(ctx context.Context, req ctrl.Request } } - if component.Managed && contains && component.Kind != v1.ComponentRoute { + if component.Managed && contains && component.Kind != v1.ComponentRoute && component.Kind != v1.ComponentMirror { msg := fmt.Sprintf("%s component marked as managed, but `configBundleSecret` contains required fields", component.Kind) return r.reconcileWithCondition(&quay, v1.ConditionTypeRolloutBlocked, metav1.ConditionTrue, v1.ConditionReasonConfigInvalid, msg) diff --git a/pkg/configure/configure.go b/pkg/configure/configure.go index 249cfc6a6..f944895c7 100644 --- a/pkg/configure/configure.go +++ b/pkg/configure/configure.go @@ -100,20 +100,29 @@ func ReconfigureHandler(k8sClient client.Client) func(w http.ResponseWriter, r * newComponents := []v1.Component{} for _, component := range quay.Spec.Components { + var contains bool // HPA and Monitoring don't have fields associated with them so we skip. Route should not change based on config either since fields are optional when managed. if component.Kind == v1.ComponentHPA || component.Kind == v1.ComponentMonitoring || component.Kind == v1.ComponentRoute { newComponents = append(newComponents, component) continue } + // For the reset, infer from the presence of fields contains, err := kustomize.ContainsComponentConfig(reconfigureRequest.Config, reconfigureRequest.Certs, component) - if err != nil { log.Error(err, "failed to check `config.yaml` for component fieldgroup", "component", component.Kind) http.Error(w, err.Error(), http.StatusInternalServerError) return } + // Mirror we infer based on the value of FEATURE_REPO_MIRROR + if component.Kind == v1.ComponentMirror { + enabled, ok := reconfigureRequest.Config["FEATURE_REPO_MIRROR"] + if ok && enabled.(bool) { + contains = false + } + } + if contains { log.Info("marking component as unmanaged", "component", component.Kind) newComponents = append(newComponents, v1.Component{Kind: component.Kind, Managed: false})