Skip to content
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

fix: add matchlabel on NWP for customized appliation #1566

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,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 @@ -74,6 +75,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.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feel free to use suggestion for code review next time.
i can get that change committed if it is needed. now seems a bit too late :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I will do it next time.

- 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 @@ -233,6 +233,17 @@ func (r *DSCInitializationReconciler) reconcileDefaultNetworkPolicy(
},
},
},
{ // OR logic to minic customized application namespace
Copy link

@shalberd shalberd Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logical or, either traffic within 2generated" labeled namespace or namespace that has the application namespace label.
Nice, thank you.

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).
91 changes: 91 additions & 0 deletions docs/troubleshooting.md2
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# What

This document serves as the knowledge base for troubleshooting the Open Data Hub Operator.
More information can be found at https://github.com/opendatahub-io/opendatahub-operator/wiki

## Troubleshooting

### Upgrade from Operator v2.0/v2.1 to v2.2+

This also applies to any local build deployment from the "main" branch.

To upgrade, follow these steps:

- Disable the component(s) in your DSC instance.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to deactivate the components, or does deleting the DSC do the same thing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an old upgrade case since we have changes in 2.0/2.1 to 2.4 GA version.
most of the current user should not encounter this, unless they have been on 2.0/2.1 for 1.5yrs?
maybe we can revisit these documents and clean up some later

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, we can revisit and clean them up later.

- Delete both the DSC instance and DSCI instance.
- Click "uninstall" Open Data Hub operator.
- If exposed on v1alpha1, delete the DSC CRD and DSCI CRD.

All of the above steps can be performed either through the console UI or via the `oc`/`kubectl` CLI.
After completing these steps, please refer to the installation guide to proceed with a clean installation of the v2.2+ operator.


### Why component's managementState is set to {} not Removed?

Only if managementState is explicitliy set to "Managed" on component level, below configs in DSC CR to component "X" take the same effects:

```console
spec:
components:
X:
managementState: Removed

```

```console
spec:
components:
X: {}
```

### Setting up a Fedora-based development environment

This is a loose list of tools to install on your linux box in order to compile, test and deploy the operator.

```bash
ssh-keygen -t ed25519 -C "<email-registered-on-github-account>"
# upload public key to github

sudo dnf makecache --refresh
sudo dnf install -y git-all
sudo dnf install -y golang
sudo dnf install -y podman
sudo dnf install -y cri-o kubernetes-kubeadm kubernetes-node kubernetes-client cri-tools
sudo dnf install -y operator-sdk
sudo dnf install -y wget
wget https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/linux/oc.tar.gz
cd bin/; tar -xzvf ../oc.tar.gz ; cd .. ; rm oc.tar.gz
sudo dnf install -y zsh

# update PATH
echo 'export PATH=${PATH}:~/bin' >> ~/.zshrc
echo 'export GOPROXY=https://proxy.golang.org' >> ~/.zshrc
```

### Using a local.mk file to override Makefile variables for your development environment

To support the ability for a developer to customize the Makefile execution to support their development environment, you can create a `local.mk` file in the root of this repo to specify custom values that match your environment.

```
$ cat local.mk
VERSION=9.9.9
IMAGE_TAG_BASE=quay.io/my-dev-env/opendatahub-operator
IMG_TAG=my-dev-tag
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.applicationnamespace`, 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).
Loading