diff --git a/.github/workflows/olm_tests.yaml b/.github/workflows/olm_tests.yaml index aa8a3b172..b6932d893 100644 --- a/.github/workflows/olm_tests.yaml +++ b/.github/workflows/olm_tests.yaml @@ -92,6 +92,10 @@ jobs: echo Waiting for Deployment to be ready timeout 60 bash -c 'until [[ $(kubectl get deployment/codeflare-operator-manager -n '${{ env.SUBSCRIPTION_NAMESPACE }}') ]]; do sleep 5 && echo "$(kubectl get deployment/codeflare-operator-manager -n '${{ env.SUBSCRIPTION_NAMESPACE }}')"; done' kubectl wait -n ${{ env.SUBSCRIPTION_NAMESPACE }} deployment/codeflare-operator-manager --for=condition=Available=true --timeout=60s + + echo Patch the CodeFlare operator ConfigMap + kubectl patch -n '${{ env.SUBSCRIPTION_NAMESPACE }}' cm codeflare-operator-config --type merge -p '{"data":{"config.yaml":"mcad:\n enabled: true"}}' + env: CATALOG_SOURCE_NAME: "codeflare-olm-test" CATALOG_SOURCE_NAMESPACE: "olm" diff --git a/config/e2e/config.yaml b/config/e2e/config.yaml new file mode 100644 index 000000000..4b01a4b0e --- /dev/null +++ b/config/e2e/config.yaml @@ -0,0 +1,8 @@ +kind: ConfigMap +apiVersion: v1 +metadata: + name: codeflare-operator-config +data: + config.yaml: | + mcad: + enabled: true diff --git a/config/e2e/kustomization.yaml b/config/e2e/kustomization.yaml index e06123b2a..772370da6 100644 --- a/config/e2e/kustomization.yaml +++ b/config/e2e/kustomization.yaml @@ -1,6 +1,7 @@ namespace: openshift-operators bases: +- config.yaml - ../default patches: diff --git a/main.go b/main.go index 04cd33ec2..05a53f074 100644 --- a/main.go +++ b/main.go @@ -127,7 +127,9 @@ func main() { }, LeaderElection: &configv1alpha1.LeaderElectionConfiguration{}, }, - MCAD: &mcadconfig.MCADConfiguration{}, + MCAD: &config.MCADConfiguration{ + Enabled: pointer.Bool(false), + }, InstaScale: &config.InstaScaleConfiguration{ Enabled: pointer.Bool(false), InstaScaleConfiguration: instascaleconfig.InstaScaleConfiguration{ @@ -167,12 +169,14 @@ func main() { }) exitOnError(err, "unable to start manager") - mcadQueueController := mcad.NewJobController(mgr.GetConfig(), cfg.MCAD, &mcadconfig.MCADConfigurationExtended{}) - if mcadQueueController == nil { - // FIXME: update NewJobController so it follows Go idiomatic error handling and return an error instead of a nil object - os.Exit(1) + if pointer.BoolDeref(cfg.MCAD.Enabled, false) { + mcadQueueController := mcad.NewJobController(mgr.GetConfig(), &cfg.MCAD.MCADConfiguration, &mcadconfig.MCADConfigurationExtended{}) + if mcadQueueController == nil { + // FIXME: update NewJobController so it follows Go idiomatic error handling and return an error instead of a nil object + os.Exit(1) + } + mcadQueueController.Run(ctx.Done()) } - mcadQueueController.Run(ctx.Done()) if pointer.BoolDeref(cfg.InstaScale.Enabled, false) { instaScaleController := &instascale.AppWrapperReconciler{ diff --git a/pkg/config/config.go b/pkg/config/config.go index 10b547676..85a03385c 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -32,7 +32,7 @@ type CodeFlareOperatorConfiguration struct { ControllerManager `json:",inline"` // The MCAD controller configuration - MCAD *mcad.MCADConfiguration `json:"mcad,omitempty"` + MCAD *MCADConfiguration `json:"mcad,omitempty"` // The InstaScale controller configuration InstaScale *InstaScaleConfiguration `json:"instascale,omitempty"` @@ -44,6 +44,15 @@ type KubeRayConfiguration struct { RayDashboardOAuthEnabled *bool `json:"rayDashboardOAuthEnabled,omitempty"` } +type MCADConfiguration struct { + // enabled controls whether the MCAD controller is started. + // It defaults to false. + Enabled *bool `json:"enabled,omitempty"` + + // The InstaScale controller configuration + mcad.MCADConfiguration `json:",inline,omitempty"` +} + type InstaScaleConfiguration struct { // enabled controls whether the InstaScale controller is started. // It may default to true on platforms that InstaScale supports.