@@ -129,6 +129,14 @@ func main() {
129
129
130
130
exitOnError (loadIntoOrCreate (ctx , kubeClient , namespaceOrDie (), configMapName , cfg ), "unable to initialise configuration" )
131
131
132
+ ok , err := hasAPIResourceForGVK (kubeClient .DiscoveryClient , rayv1 .GroupVersion .WithKind ("RayCluster" ))
133
+ if err != nil {
134
+ exitOnError (err , "Could not determine if RayCluster CR is present on cluster." )
135
+ }
136
+ if ! ok {
137
+ exitOnError (err , "RayCluster CRD is not available on the cluster." )
138
+ }
139
+
132
140
kubeConfig .Burst = int (pointer .Int32Deref (cfg .ClientConnection .Burst , int32 (rest .DefaultBurst )))
133
141
kubeConfig .QPS = pointer .Float32Deref (cfg .ClientConnection .QPS , rest .DefaultQPS )
134
142
setupLog .V (2 ).Info ("REST client" , "qps" , kubeConfig .QPS , "burst" , kubeConfig .Burst )
@@ -154,18 +162,13 @@ func main() {
154
162
exitOnError (controllers .SetupRayClusterWebhookWithManager (mgr , cfg .KubeRay ), "error setting up RayCluster webhook" )
155
163
}
156
164
157
- ok , err := hasAPIResourceForGVK (kubeClient .DiscoveryClient , rayv1 .GroupVersion .WithKind ("RayCluster" ))
158
- if ok {
159
- rayClusterController := controllers.RayClusterReconciler {
160
- Client : mgr .GetClient (),
161
- Scheme : mgr .GetScheme (),
162
- Config : cfg .KubeRay ,
163
- IsOpenShift : OpenShift ,
164
- }
165
- exitOnError (rayClusterController .SetupWithManager (mgr ), "Error setting up RayCluster controller" )
166
- } else if err != nil {
167
- exitOnError (err , "Could not determine if RayCluster CR present on cluster." )
165
+ rayClusterController := controllers.RayClusterReconciler {
166
+ Client : mgr .GetClient (),
167
+ Scheme : mgr .GetScheme (),
168
+ Config : cfg .KubeRay ,
169
+ IsOpenShift : OpenShift ,
168
170
}
171
+ exitOnError (rayClusterController .SetupWithManager (mgr ), "Error setting up RayCluster controller" )
169
172
170
173
exitOnError (mgr .AddHealthzCheck (cfg .Health .LivenessEndpointName , healthz .Ping ), "unable to set up health check" )
171
174
exitOnError (mgr .AddReadyzCheck (cfg .Health .ReadinessEndpointName , healthz .Ping ), "unable to set up ready check" )
0 commit comments