Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fork/shalberd/odh_not…
Browse files Browse the repository at this point in the history
…ebook_ctrl_dynamic_single_namespace_for_imagestream_search
  • Loading branch information
jiridanek committed Nov 26, 2024
2 parents 8d715a4 + f1be2a4 commit 336085d
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
odh-kf-notebook-controller-image=quay.io/opendatahub/kubeflow-notebook-controller:main-363bcdb
odh-kf-notebook-controller-image=quay.io/opendatahub/kubeflow-notebook-controller:main
15 changes: 5 additions & 10 deletions components/odh-notebook-controller/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,13 @@ endif
setup-kf: kustomize ## Replace Kustomize manifests with your environment configuration.
sed -i'' -e 's,namespace: .*,namespace: '"${K8S_NAMESPACE}"',' \
../notebook-controller/config/overlays/openshift/kustomization.yaml
sed -i'' -e 's,newName: .*,newName: '"${KF_IMG}"',' \
../notebook-controller/config/overlays/openshift/kustomization.yaml
sed -i'' -e 's,newTag: .*,newTag: '"${KF_TAG}"',' \
../notebook-controller/config/overlays/openshift/kustomization.yaml
sed -i'' -e "s,odh-kf-notebook-controller-image=.*,odh-kf-notebook-controller-image=${KF_IMG}:${KF_TAG}," \
../notebook-controller/config/overlays/openshift/params.env

.PHONY: setup
setup: manifests kustomize ## Replace Kustomize manifests with your environment configuration.
sed -i'' -e 's,namespace: .*,namespace: '"${K8S_NAMESPACE}"',' ./config/default/kustomization.yaml
sed -i'' -e 's,newName: .*,newName: '"${IMG}"',' ./config/base/kustomization.yaml
sed -i'' -e 's,newTag: .*,newTag: '"${TAG}"',' ./config/base/kustomization.yaml
sed -i'' -e "s,odh-notebook-controller-image=.*,odh-notebook-controller-image=${IMG}:${TAG}," ./config/base/params.env

.PHONY: setup-service-mesh
setup-service-mesh: kustomize ## Replace Kustomize manifests with your environment configuration.
Expand All @@ -153,10 +150,8 @@ setup-service-mesh: kustomize ## Replace Kustomize manifests with your environme
../notebook-controller/config/overlays/standalone-service-mesh/kustomization.yaml
sed -i'' -e 's,ISTIO_GATEWAY=.*,ISTIO_GATEWAY='"${K8S_NAMESPACE}/odh-gateway"',' \
../notebook-controller/config/overlays/standalone-service-mesh/kustomization.yaml
sed -i'' -e 's,newName: .*,newName: '"${KF_IMG}"',' \
../notebook-controller/config/overlays/standalone-service-mesh/kustomization.yaml
sed -i'' -e 's,newTag: .*,newTag: '"${KF_TAG}"',' \
../notebook-controller/config/overlays/standalone-service-mesh/kustomization.yaml
sed -i'' -e "s,odh-kf-notebook-controller-image=.*,odh-kf-notebook-controller-image=${KF_IMG}:${KF_TAG}," \
../notebook-controller/config/overlays/openshift/params.env
sed -i'' -e 's,host: .*,host: opendatahub.'"$(shell kubectl get ingress.config.openshift.io cluster -o 'jsonpath={.spec.domain}')"',' \
../notebook-controller/config/overlays/standalone-service-mesh/gateway-route.yaml

Expand Down
2 changes: 1 addition & 1 deletion components/odh-notebook-controller/config/base/params.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
odh-notebook-controller-image=quay.io/opendatahub/odh-notebook-controller:main-363bcdb
odh-notebook-controller-image=quay.io/opendatahub/odh-notebook-controller:main
2 changes: 1 addition & 1 deletion components/odh-notebook-controller/makefile-vars.mk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
KF_TAG ?= main-363bcdb
KF_TAG ?= main
51 changes: 36 additions & 15 deletions components/odh-notebook-controller/run-e2e-test-service-mesh.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,44 @@
#!/usr/bin/env bash

# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
set -Eeuxo pipefail

echo "Running the ${0} setup"

TEST_NAMESPACE="odh-notebook-controller-system"

# setup and deploy the controller
oc new-project $TEST_NAMESPACE -n $TEST_NAMESPACE --skip-config-write
# Following variables are optional - if not set, the default values in relevant params.env
# will be used for both images. As such, if you want to run tests against your custom changes,
# be sure to perform a docker build and set these variables accordingly!
ODH_NOTEBOOK_CONTROLLER_IMAGE="${ODH_NOTEBOOK_CONTROLLER_IMAGE:-}"
KF_NOTEBOOK_CONTROLLER="${KF_NOTEBOOK_CONTROLLER:-}"

IFS=':' read -r -a CTRL_IMG <<< "${ODH_NOTEBOOK_CONTROLLER_IMAGE}"
export IMG="${CTRL_IMG[0]}"
export TAG="${CTRL_IMG[1]}"
IFS=':' read -r -a KF_NBC_IMG <<< "${KF_NOTEBOOK_CONTROLLER}"
export KF_IMG="${KF_NBC_IMG[0]}"
export KF_TAG="${KF_NBC_IMG[1]}"
export K8S_NAMESPACE=$TEST_NAMESPACE

make deploy-service-mesh deploy-with-mesh
if test -n "${ODH_NOTEBOOK_CONTROLLER_IMAGE}"; then
IFS=':' read -r -a CTRL_IMG <<< "${ODH_NOTEBOOK_CONTROLLER_IMAGE}"
export IMG="${CTRL_IMG[0]}"
export TAG="${CTRL_IMG[1]}"
fi

# run e2e tests
make e2e-test-service-mesh
if test -n "${KF_NOTEBOOK_CONTROLLER}"; then
IFS=':' read -r -a KF_NBC_IMG <<< "${KF_NOTEBOOK_CONTROLLER}"
export KF_IMG="${KF_NBC_IMG[0]}"
export KF_TAG="${KF_NBC_IMG[1]}"
fi

export K8S_NAMESPACE="${TEST_NAMESPACE}"

# cleanup deployment
make undeploy-with-mesh undeploy-service-mesh
oc delete project $TEST_NAMESPACE -n $TEST_NAMESPACE
# From now on we want to be sure that undeploy and testing project deletion are called

function cleanup() {
echo "Performing deployment cleanup of the ${0}"
make undeploy-with-mesh undeploy-service-mesh && oc delete project "${TEST_NAMESPACE}"
}
trap cleanup EXIT

# setup and deploy the controller
oc new-project "${TEST_NAMESPACE}" --skip-config-write

# deploy and run e2e tests
make deploy-service-mesh deploy-with-mesh
make e2e-test-service-mesh
51 changes: 36 additions & 15 deletions components/odh-notebook-controller/run-e2e-test.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,44 @@
#!/usr/bin/env bash

# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
set -Eeuxo pipefail

echo "Running the ${0} setup"

TEST_NAMESPACE="odh-notebook-controller-system"

# setup and deploy the controller
oc new-project $TEST_NAMESPACE -n $TEST_NAMESPACE --skip-config-write
# Following variables are optional - if not set, the default values in relevant params.env
# will be used for both images. As such, if you want to run tests against your custom changes,
# be sure to perform a docker build and set these variables accordingly!
ODH_NOTEBOOK_CONTROLLER_IMAGE="${ODH_NOTEBOOK_CONTROLLER_IMAGE:-}"
KF_NOTEBOOK_CONTROLLER="${KF_NOTEBOOK_CONTROLLER:-}"

IFS=':' read -r -a CTRL_IMG <<< "${ODH_NOTEBOOK_CONTROLLER_IMAGE}"
export IMG="${CTRL_IMG[0]}"
export TAG="${CTRL_IMG[1]}"
IFS=':' read -r -a KF_NBC_IMG <<< "${KF_NOTEBOOK_CONTROLLER}"
export KF_IMG="${KF_NBC_IMG[0]}"
export KF_TAG="${KF_NBC_IMG[1]}"
export K8S_NAMESPACE=$TEST_NAMESPACE

make deploy
if test -n "${ODH_NOTEBOOK_CONTROLLER_IMAGE}"; then
IFS=':' read -r -a CTRL_IMG <<< "${ODH_NOTEBOOK_CONTROLLER_IMAGE}"
export IMG="${CTRL_IMG[0]}"
export TAG="${CTRL_IMG[1]}"
fi

# run e2e tests
make e2e-test
if test -n "${KF_NOTEBOOK_CONTROLLER}"; then
IFS=':' read -r -a KF_NBC_IMG <<< "${KF_NOTEBOOK_CONTROLLER}"
export KF_IMG="${KF_NBC_IMG[0]}"
export KF_TAG="${KF_NBC_IMG[1]}"
fi

export K8S_NAMESPACE="${TEST_NAMESPACE}"

# cleanup deployment
make undeploy
oc delete project $TEST_NAMESPACE -n $TEST_NAMESPACE
# From now on we want to be sure that undeploy and testing project deletion are called

function cleanup() {
echo "Performing deployment cleanup of the ${0}"
make undeploy && oc delete project "${TEST_NAMESPACE}"
}
trap cleanup EXIT

# setup and deploy the controller
oc new-project "${TEST_NAMESPACE}"

# deploy and run e2e tests
make deploy
make e2e-test

0 comments on commit 336085d

Please sign in to comment.