Skip to content

Disable MCAD by default #500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/olm_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 8 additions & 0 deletions config/e2e/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: codeflare-operator-config
data:
config.yaml: |
mcad:
enabled: true
1 change: 1 addition & 0 deletions config/e2e/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace: openshift-operators

bases:
- config.yaml
- ../default

patches:
Expand Down
16 changes: 10 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down
11 changes: 10 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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.
Expand Down