-
Notifications
You must be signed in to change notification settings - Fork 61
only use the default-dsci applicationsNamespace in openshift #676
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
Changes from 1 commit
b9a258c
4d1fd3a
1146637
c583416
8db15e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -269,18 +269,21 @@ func (r *RayClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) | |||||||||||||||||||||||||||||||||||||||
// Locate the KubeRay operator deployment: | ||||||||||||||||||||||||||||||||||||||||
// - First try to get the ODH / RHOAI application namespace from the DSCInitialization | ||||||||||||||||||||||||||||||||||||||||
// - Or fallback to the well-known defaults | ||||||||||||||||||||||||||||||||||||||||
// add check if running on openshift or vanilla kubernetes | ||||||||||||||||||||||||||||||||||||||||
var kubeRayNamespaces []string | ||||||||||||||||||||||||||||||||||||||||
dsci := &dsciv1.DSCInitialization{} | ||||||||||||||||||||||||||||||||||||||||
err := r.Client.Get(ctx, client.ObjectKey{Name: "default-dsci"}, dsci) | ||||||||||||||||||||||||||||||||||||||||
if errors.IsNotFound(err) { | ||||||||||||||||||||||||||||||||||||||||
kubeRayNamespaces = []string{"opendatahub", "redhat-ods-applications"} | ||||||||||||||||||||||||||||||||||||||||
} else if err != nil { | ||||||||||||||||||||||||||||||||||||||||
return ctrl.Result{}, err | ||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||
kubeRayNamespaces = []string{dsci.Spec.ApplicationsNamespace} | ||||||||||||||||||||||||||||||||||||||||
kubeRayNamespaces = []string{"opendatahub", "redhat-ods-applications"} | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
if r.IsOpenShift { | ||||||||||||||||||||||||||||||||||||||||
dsci := &dsciv1.DSCInitialization{} | ||||||||||||||||||||||||||||||||||||||||
err := r.Client.Get(ctx, client.ObjectKey{Name: "default-dsci"}, dsci) | ||||||||||||||||||||||||||||||||||||||||
if err != nil { | ||||||||||||||||||||||||||||||||||||||||
return ctrl.Result{}, err | ||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||
kubeRayNamespaces = []string{dsci.Spec.ApplicationsNamespace} | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @eoinfennessy actually there is a missing condition that needs to be handled. if the dsci is not found error we use the fall back namespaces if it's available we use it. |
||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
_, err = r.kubeClient.NetworkingV1().NetworkPolicies(cluster.Namespace).Apply(ctx, desiredHeadNetworkPolicy(cluster, r.Config, kubeRayNamespaces), metav1.ApplyOptions{FieldManager: controllerName, Force: true}) | ||||||||||||||||||||||||||||||||||||||||
_, err := r.kubeClient.NetworkingV1().NetworkPolicies(cluster.Namespace).Apply(ctx, desiredHeadNetworkPolicy(cluster, r.Config, kubeRayNamespaces), metav1.ApplyOptions{FieldManager: controllerName, Force: true}) | ||||||||||||||||||||||||||||||||||||||||
if err != nil { | ||||||||||||||||||||||||||||||||||||||||
logger.Error(err, "Failed to update NetworkPolicy") | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@szaher We're still passing these namespaces (which I assume are openshift specific) to the network policy creation below. I may be wrong but on a native k8s installation, kuberay won't be installed in either of those namespaces. The OpenShift specific kustomization.yaml points to opendatahub by default but the deployments namespace by default I think is just
ray-system
. So wouldn't this still set up those network policies to point to ODH/RHOAI namespaces?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kryanbeane, I think the kuberay operator namespace is added via https://github.com/project-codeflare/codeflare-operator/blob/main/pkg/controllers/raycluster_controller.go#L553