@@ -109,7 +109,10 @@ func main() {
109
109
QPS : ptr .To (float32 (50 )),
110
110
Burst : ptr .To (int32 (100 )),
111
111
},
112
- AppWrapper : awconfig .NewConfig (namespace ),
112
+ AppWrapper : & config.AppWrapperConfiguration {
113
+ Enabled : ptr .To (true ),
114
+ Config : awconfig .NewConfig (namespace ),
115
+ },
113
116
ControllerManager : config.ControllerManager {
114
117
Metrics : config.MetricsConfiguration {
115
118
BindAddress : ":8080" ,
@@ -126,10 +129,10 @@ func main() {
126
129
RayDashboardOAuthEnabled : ptr .To (true ),
127
130
},
128
131
}
129
- cfg .AppWrapper .CertManagement .WebhookSecretName = "codeflare-operator-webhook-server-cert"
130
- cfg .AppWrapper .CertManagement .WebhookServiceName = "codeflare-operator-webhook-service"
131
- cfg .AppWrapper .CertManagement .MutatingWebhookConfigName = "codeflare-operator-mutating-webhook-configuration"
132
- cfg .AppWrapper .CertManagement .ValidatingWebhookConfigName = "codeflare-operator-validating-webhook-configuration"
132
+ cfg .AppWrapper .Config . CertManagement .WebhookSecretName = "codeflare-operator-webhook-server-cert"
133
+ cfg .AppWrapper .Config . CertManagement .WebhookServiceName = "codeflare-operator-webhook-service"
134
+ cfg .AppWrapper .Config . CertManagement .MutatingWebhookConfigName = "codeflare-operator-mutating-webhook-configuration"
135
+ cfg .AppWrapper .Config . CertManagement .ValidatingWebhookConfigName = "codeflare-operator-validating-webhook-configuration"
133
136
134
137
kubeConfig , err := ctrl .GetConfig ()
135
138
exitOnError (err , "unable to get client config" )
@@ -140,7 +143,7 @@ func main() {
140
143
exitOnError (err , "unable to create Kubernetes client" )
141
144
142
145
exitOnError (loadIntoOrCreate (ctx , kubeClient , namespaceOrDie (), configMapName , cfg ), "unable to initialise configuration" )
143
- exitOnError (awconfig .ValidateConfig (cfg .AppWrapper ), "invalid AppWrapper configuration" )
146
+ exitOnError (awconfig .ValidateConfig (cfg .AppWrapper . Config ), "invalid AppWrapper configuration" )
144
147
145
148
kubeConfig .Burst = int (ptr .Deref (cfg .ClientConnection .Burst , int32 (rest .DefaultBurst )))
146
149
kubeConfig .QPS = ptr .Deref (cfg .ClientConnection .QPS , rest .DefaultQPS )
@@ -183,7 +186,7 @@ func main() {
183
186
if os .Getenv ("ENABLE_WEBHOOKS" ) == "false" {
184
187
close (certsReady )
185
188
} else {
186
- exitOnError (awctrl .SetupCertManagement (mgr , & cfg .AppWrapper .CertManagement , certsReady ), "unable to set up cert rotation" )
189
+ exitOnError (awctrl .SetupCertManagement (mgr , & cfg .AppWrapper .Config . CertManagement , certsReady ), "unable to set up cert rotation" )
187
190
}
188
191
189
192
v , err := HasAPIResourceForGVK (kubeClient .DiscoveryClient , rayv1 .GroupVersion .WithKind ("RayCluster" ))
@@ -196,12 +199,15 @@ func main() {
196
199
197
200
v1 , err1 := HasAPIResourceForGVK (kubeClient .DiscoveryClient , kueue .GroupVersion .WithKind ("Workload" ))
198
201
v2 , err2 := HasAPIResourceForGVK (kubeClient .DiscoveryClient , mcadv1beta2 .GroupVersion .WithKind ("AppWrapper" ))
199
- if v1 && v2 {
202
+ if v1 && v2 && * cfg . AppWrapper . Enabled {
200
203
// Ascynchronous because controllers need to wait for certificate to be ready for webhooks to work
201
- go awctrl .SetupControllers (ctx , mgr , cfg .AppWrapper , certsReady , setupLog )
202
- exitOnError (awctrl .SetupIndexers (ctx , mgr , cfg .AppWrapper ), "unable to setup indexers" )
204
+ go awctrl .SetupControllers (ctx , mgr , cfg .AppWrapper . Config , certsReady , setupLog )
205
+ exitOnError (awctrl .SetupIndexers (ctx , mgr , cfg .AppWrapper . Config ), "unable to setup indexers" )
203
206
} else if err1 != nil || err2 != nil {
204
207
exitOnError (err , "Could not determine if AppWrapper and Workload CRs present on cluster." )
208
+ } else {
209
+ setupLog .Info ("AppWrapper controller disabled" , "Workload present" , v1 ,
210
+ "AppWrapper present" , v2 , "Config Flag" , * cfg .AppWrapper .Enabled )
205
211
}
206
212
207
213
exitOnError (awctrl .SetupProbeEndpoints (mgr , certsReady ), "unable to setup probe endpoints" )
0 commit comments