diff --git a/control-plane-operator/controllers/hostedcontrolplane/cvo/reconcile.go b/control-plane-operator/controllers/hostedcontrolplane/cvo/reconcile.go index af0f4f41ad..d801c2e918 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/cvo/reconcile.go +++ b/control-plane-operator/controllers/hostedcontrolplane/cvo/reconcile.go @@ -2,6 +2,7 @@ package cvo import ( "fmt" + "k8s.io/apimachinery/pkg/util/sets" "path" "strings" @@ -206,7 +207,7 @@ func buildCVOContainerBootstrap(image, clusterID string) func(*corev1.Container) c.Command = []string{"/bin/bash"} c.Args = []string{ "-c", - cvoBootrapScript(clusterID), + cvoBootstrapScript(clusterID), } c.Resources.Requests = corev1.ResourceList{ corev1.ResourceCPU: resource.MustParse("10m"), @@ -303,31 +304,54 @@ func preparePayloadScript(platformType hyperv1.PlatformType, oauthEnabled bool) return strings.Join(stmts, "\n") } -func cvoBootrapScript(clusterID string) string { +func cvoBootstrapScript(clusterID string) string { + enabledCaps := sets.New[configv1.ClusterVersionCapability]( + configv1.ClusterVersionCapabilitySets[configv1.ClusterVersionCapabilitySetCurrent]...) + enabledCaps = enabledCaps.Delete(configv1.ClusterVersionCapabilityImageRegistry) + + capabilities := strings.Builder{} + capList := enabledCaps.UnsortedList() + for i, capability := range capList { + capabilities.WriteString(string(capability)) + if i != len(capList)-1 { + capabilities.WriteString(",") + } + } + payloadDir := volumeMounts.Path(cvoContainerBootstrap().Name, cvoVolumePayload().Name) var scriptTemplate = `#!/bin/bash set -euo pipefail -cat > /tmp/clusterversion.yaml < /tmp/clusterversion.yaml <<-EOF apiVersion: config.openshift.io/v1 kind: ClusterVersion metadata: name: version spec: + capabilities: + baselineCapabilitySet: 'None' + additionalEnabledCapabilities: [%s] clusterID: %s + EOF + oc get ns openshift-config &> /dev/null || oc create ns openshift-config oc get ns openshift-config-managed &> /dev/null || oc create ns openshift-config-managed + +oc apply -f ${MANIFEST_DIR}/0000_00_cluster-version-operator_01_clusterversions-Default.crd.yaml +oc create -f /tmp/clusterversion.yaml +oc get config/version -oyaml + while true; do echo "Applying CVO bootstrap manifests" - if oc apply -f %s/manifests; then + if oc apply -f ${MANIFEST_DIR}; then echo "Bootstrap manifests applied successfully." break fi sleep 1 done -oc get clusterversion/version &> /dev/null || oc create -f /tmp/clusterversion.yaml ` - return fmt.Sprintf(scriptTemplate, clusterID, payloadDir) + return fmt.Sprintf(scriptTemplate, payloadDir, capabilities.String(), clusterID) } func buildCVOContainerMain(image, releaseImage, namespace string, updateService configv1.URL, enableCVOManagementClusterMetricsAccess bool) func(c *corev1.Container) { diff --git a/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go b/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go index df5f9c23d4..4aac886558 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go +++ b/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go @@ -1289,10 +1289,10 @@ func (r *HostedControlPlaneReconciler) reconcile(ctx context.Context, hostedCont } // Reconcile image registry operator - r.Log.Info("Reconciling Image Registry Operator") - if err := r.reconcileImageRegistryOperator(ctx, hostedControlPlane, releaseImageProvider, userReleaseImageProvider, createOrUpdate); err != nil { + /*r.Log.Info("Reconciling Image Registry Operator") + if err := r.reconcileImageRegistryOperator(ctx, hostedControlPlane, releaseImageProvider, userReleaseImageProvider, createOrUpdate); err != nil { return fmt.Errorf("failed to reconcile image registry operator: %w", err) - } + }*/ if IsStorageAndCSIManaged(hostedControlPlane) { // Reconcile cluster storage operator