Skip to content

Commit

Permalink
fix: add matchlabel on NWP for customized appliation (#1566) (#1569)
Browse files Browse the repository at this point in the history
- update README and troubleshooting


(cherry picked from commit a00aa61)

Signed-off-by: Wen Zhou <[email protected]>
  • Loading branch information
zdtsw authored Jan 27, 2025
1 parent 8e7f7f6 commit 8925154
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and configure these applications.
- [Usage](#usage)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Configuration](#configuration)
- [Developer Guide](#developer-guide)
- [Pre-requisites](#pre-requisites)
- [Download manifests](#download-manifests)
Expand Down Expand Up @@ -72,6 +73,26 @@ Additionally installing `Authorino operator` & `Service Mesh operator` enhances

3. Create [DataScienceCluster](#example-datasciencecluster) CR to enable components


### Configuration

- in ODH 2.23.1, we introduced a new feature which allows user to use their own application namespace than default one "opendatahub".

1. for new cluster, as this cluster has not been used for ODH or RHOAI.
Here we use namespace A for example as targeted application namespace, please follow below steps before install ODH operator:

- create namespace A
- add label `opendatahub.io/application-namespace: true` onto namespace A. Only one namespace in the cluster can have this label.
- install ODH operator either from UI or by GitOps/CLI
- once Operator is up and running, manually create DSCI CR by set `.spec.applicationsNamespace:A`
- wait till DSCI status update to "Ready"
- continue to create DSC CR

2. for upgrade case, as ODH is running in the cluster.

Be aware: to switch to a different application namespace can cause more issues and require manual cleanup, therefore we suggest this to be done for new cluster.


## Developer Guide

#### Pre-requisites
Expand Down
11 changes: 11 additions & 0 deletions controllers/dscinitialization/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,17 @@ func (r *DSCInitializationReconciler) reconcileDefaultNetworkPolicy(
},
},
},
{ // OR logic to minic customized application namespace
From: []networkingv1.NetworkPolicyPeer{
{
NamespaceSelector: &metav1.LabelSelector{ // AND logic
MatchLabels: map[string]string{
labels.CustomizedAppNamespace: labels.True,
},
},
},
},
},
{ // OR logic
From: []networkingv1.NetworkPolicyPeer{
{ // need this to access external-> dashboard
Expand Down
15 changes: 14 additions & 1 deletion docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,17 @@ OPERATOR_NAMESPACE=my-dev-odh-operator-system
IMAGE_BUILD_FLAGS=--build-arg USE_LOCAL=true
E2E_TEST_FLAGS="--skip-deletion=true" -timeout 15m
DEFAULT_MANIFESTS_PATH=./opt/manifests
```
```

### When I try to use my own application namespace, I get different errors:

1. Operator pod is keeping crash
Ensure in your cluster, only one application has label `opendatahub.io/application-namespace=true`. This is similar to case (3).

2. error "DSCI must used the same namespace which has opendatahub.io/application-namespace=true label"
In the cluster, one namespace has label `opendatahub.io/application-namespace=true`, but it is not being set in the DSCI's `.spec.applicationsNamespace`, solutions (any of below ones should work):
- delete existin DSCI, and re-create it with namespace which already has label `opendatahub.io/application-namespace=true`
- remove label `opendatahub.io/application-namespace=true` from the other namespace to the one specified in the DSCI, and wait for a couple of minutes to allow DSCI continue.

3. error "only support max. one namespace with label: opendatahub.io/application-namespace=true"
Refer to (1).

0 comments on commit 8925154

Please sign in to comment.