Skip to content

Commit 4d1fd3a

Browse files
committed
use fallback namespaces if dsci cluster isn't found
Signed-off-by: Saad Zaher <[email protected]>
1 parent b9a258c commit 4d1fd3a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Diff for: pkg/controllers/raycluster_controller.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -271,16 +271,19 @@ func (r *RayClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
271271
// - Or fallback to the well-known defaults
272272
// add check if running on openshift or vanilla kubernetes
273273
var kubeRayNamespaces []string
274-
kubeRayNamespaces = []string{"opendatahub", "redhat-ods-applications"}
274+
kubeRayNamespaces = []string{cluster.Namespace}
275275

276276
if r.IsOpenShift {
277277
dsci := &dsciv1.DSCInitialization{}
278+
278279
err := r.Client.Get(ctx, client.ObjectKey{Name: "default-dsci"}, dsci)
279-
if err != nil {
280+
if errors.IsNotFound(err) {
281+
kubeRayNamespaces = []string{"opendatahub", "redhat-ods-applications"}
282+
} else if err != nil {
280283
return ctrl.Result{}, err
281-
} else {
282-
kubeRayNamespaces = []string{dsci.Spec.ApplicationsNamespace}
283284
}
285+
kubeRayNamespaces = []string{dsci.Spec.ApplicationsNamespace}
286+
284287
}
285288

286289
_, err := r.kubeClient.NetworkingV1().NetworkPolicies(cluster.Namespace).Apply(ctx, desiredHeadNetworkPolicy(cluster, r.Config, kubeRayNamespaces), metav1.ApplyOptions{FieldManager: controllerName, Force: true})

0 commit comments

Comments
 (0)