Skip to content

Commit 452e80c

Browse files
Merge main into v1.10-branch with known resolved conflicts
2 parents 160974a + 0247e40 commit 452e80c

File tree

23 files changed

+317
-192
lines changed

23 files changed

+317
-192
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
blank_issues_enabled: false
1+
blank_issues_enabled: true
22
contact_links:
33
- name: Kubeflow Documentation
44
url: https://www.kubeflow.org/

ci/kustomize.sh

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
#!/bin/bash
2+
3+
# This script serves to validate our kustomize files/manifests with respect of the given kustomize version.
4+
# We use this to verify that there is no warning and not errors
5+
#
6+
# Local execution: [KUSTOMIZE_VERSION=5.3.1] ./ci/kustomize.sh
7+
# Note: please execute from the root directory so that whole dir tree is checked
8+
#
9+
# In case of the PR on GitHub, this check is tied to GitHub actions automatically,
10+
# see `.github/workflows` directory.
11+
12+
13+
# The default kustomize version that is determined based on what is currently used in the [rhods|opendatahub]-operator in runtime:
14+
# https://github.com/red-hat-data-services/rhods-operator/blob/7ccc405135f99c014982d7e297b8949e970dd750/go.mod#L28-L29
15+
# and then to match appropriate kustomize release https://github.com/kubernetes-sigs/kustomize/releases/tag/kustomize%2Fv5.0.3
16+
DEFAULT_KUSTOMIZE_VERSION=5.0.3
17+
# The latest kustomize version we want to check with to be sure we're prepared for the future
18+
THE_LATEST_KUSTOMIZE=5.6.0
19+
20+
KUSTOMIZE_VERSION="${KUSTOMIZE_VERSION:-$DEFAULT_KUSTOMIZE_VERSION}"
21+
22+
function download_kustomize() {
23+
local tmp_dir="${1}"
24+
local kustomize_version="${2}"
25+
26+
local kustomize_tar="${tmp_dir}/kustomize-${kustomize_version}.tar.gz"
27+
local kustomize_bin="${tmp_dir}/kustomize-${kustomize_version}"
28+
29+
echo "---------------------------------------------------------------------------------"
30+
echo "Download kustomize '${kustomize_version}'"
31+
echo "---------------------------------------------------------------------------------"
32+
33+
# Detect OS
34+
local uname_out
35+
uname_out="$(uname -s)"
36+
case "${uname_out}" in
37+
Linux*) os=linux;;
38+
Darwin*) os=darwin;;
39+
*) echo "Unsupported OS: ${uname_out}" && return 1;;
40+
esac
41+
42+
# Detect architecture
43+
local arch
44+
arch="$(uname -m)"
45+
case "${arch}" in
46+
x86_64) arch=amd64;;
47+
arm64) arch=arm64;;
48+
aarch64) arch=arm64;;
49+
*) echo "Unsupported architecture: ${arch}" && return 1;;
50+
esac
51+
52+
local download_url="https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${kustomize_version}/kustomize_v${kustomize_version}_${os}_${arch}.tar.gz"
53+
echo "Downloading from: ${download_url}"
54+
55+
wget --output-document="${kustomize_tar}" "${download_url}"
56+
tar -C "${tmp_dir}" -xvf "${kustomize_tar}"
57+
mv "${tmp_dir}/kustomize" "${kustomize_bin}"
58+
59+
"${kustomize_bin}" version
60+
}
61+
62+
function execute_kustomize() {
63+
local tmp_dir="${1}"
64+
local kustomize_version="${2}"
65+
66+
local kustomize_stdout="${tmp_dir}/kustomize-${kustomize_version}-stdout.yaml"
67+
local kustomize_stderr="${tmp_dir}/kustomize-${kustomize_version}-stderr.txt"
68+
local kustomize_bin="${tmp_dir}/kustomize-${kustomize_version}"
69+
70+
echo "---------------------------------------------------------------------------------------------------"
71+
echo "Starting to run kustomize '${kustomize_version}' for each kustomization.yaml file except components"
72+
echo "---------------------------------------------------------------------------------------------------"
73+
# We don't want to execute kustomization on the components part as it's not intended to be used that way.
74+
# This first run is for the actual execution to get the generated output and eventual errors/warnings.
75+
# find . -name "kustomization.yaml" | xargs dirname | grep -v "components" | xargs -I {} "${kustomize_bin}" build {} >"${kustomize_stdout}" 2>"${kustomize_stderr}"
76+
find . -name "kustomization.yaml" | xargs dirname | xargs -I {} "${kustomize_bin}" build {} >"${kustomize_stdout}" 2>"${kustomize_stderr}"
77+
# This second run is with verbose output to see eventual errors/warnings together with which command they are present for easier debugging.
78+
# find . -name "kustomization.yaml" | xargs dirname | grep -v "components" | xargs --verbose -I {} "${kustomize_bin}" build {} >/dev/null
79+
find . -name "kustomization.yaml" | xargs dirname | xargs --verbose -I {} "${kustomize_bin}" build {} >/dev/null
80+
81+
echo "Let's print the STDERR:"
82+
cat "${kustomize_stderr}"
83+
}
84+
85+
function check_the_results() {
86+
local tmp_dir="${1}"
87+
local kustomize_version_1="${2}"
88+
local kustomize_version_2="${3}"
89+
90+
local kustomize_stdout_1="${tmp_dir}/kustomize-${kustomize_version_1}-stdout.yaml"
91+
local kustomize_stderr_1="${tmp_dir}/kustomize-${kustomize_version_1}-stderr.txt"
92+
local kustomize_stdout_2="${tmp_dir}/kustomize-${kustomize_version_2}-stdout.yaml"
93+
local kustomize_stderr_2="${tmp_dir}/kustomize-${kustomize_version_2}-stderr.txt"
94+
95+
echo "---------------------------------------------------------------------------------"
96+
echo "Checking the generated outputs - should be identical:"
97+
echo " - ${kustomize_stdout_1}"
98+
echo " - ${kustomize_stdout_2}"
99+
echo "---------------------------------------------------------------------------------"
100+
diff -u "${kustomize_stdout_1}" "${kustomize_stdout_2}" || {
101+
echo "Generated files from kustomize differs between kustomize version ${kustomize_version_1} and ${kustomize_version_2}. Please check above!"
102+
return 1
103+
}
104+
105+
echo "---------------------------------------------------------------------------------"
106+
echo "No log in STDERR outputs should be printed:"
107+
echo " - ${kustomize_stderr_1}"
108+
echo " - ${kustomize_stderr_2}"
109+
echo "---------------------------------------------------------------------------------"
110+
if [ -s "${kustomize_stderr_1}" ] || [ -s "${kustomize_stderr_2}" ]; then
111+
echo "There were some logs generated to STDERR during the kustomize build. Please check the log above!"
112+
return 1
113+
fi
114+
}
115+
116+
function run_check() {
117+
local tmp_dir="${1}"
118+
local kustomize_version="${2}"
119+
120+
download_kustomize "${tmp_dir}" "${kustomize_version}" || return 1
121+
execute_kustomize "${tmp_dir}" "${kustomize_version}" || return 1
122+
}
123+
124+
function main() {
125+
local ret_code=0
126+
127+
local tmp_dir
128+
tmp_dir=$(mktemp --directory -t kustomize-XXXXXXXXXX)
129+
echo "Running in the following temporary directory: '${tmp_dir}'"
130+
131+
run_check "${tmp_dir}" "${KUSTOMIZE_VERSION}" || return 1
132+
run_check "${tmp_dir}" "${THE_LATEST_KUSTOMIZE}" || return 1
133+
134+
# --------------------------------------------------------------------------------------
135+
136+
check_the_results "${tmp_dir}" "${KUSTOMIZE_VERSION}" "${THE_LATEST_KUSTOMIZE}" || return 1
137+
138+
exit "${ret_code}"
139+
}
140+
141+
# allows sourcing the script into interactive session without executing it
142+
if [[ "${0}" == "${BASH_SOURCE[0]}" ]]; then
143+
main "$@"
144+
fi

components/base/kustomization.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
---
21
apiVersion: kustomize.config.k8s.io/v1beta1
32
kind: Kustomization
4-
bases:
5-
- ../notebook-controller/config/overlays/openshift
6-
- ../odh-notebook-controller/config/base
3+
resources:
4+
- ../notebook-controller/config/overlays/openshift
5+
- ../odh-notebook-controller/config/base

components/notebook-controller/config/crd/kustomization.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ resources:
55
- bases/kubeflow.org_notebooks.yaml
66
# +kubebuilder:scaffold:crdkustomizeresource
77

8-
patchesStrategicMerge:
9-
- patches/trivial_conversion_patch.yaml
108

119
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
1210
# patches here are for enabling the conversion webhook for each CRD
@@ -22,11 +20,13 @@ patchesStrategicMerge:
2220
configurations:
2321
- kustomizeconfig.yaml
2422

25-
patchesJson6902:
26-
- target:
27-
group: apiextensions.k8s.io
28-
version: v1
29-
kind: CustomResourceDefinition
30-
name: notebooks.kubeflow.org
31-
path: patches/validation_patches.yaml
32-
23+
apiVersion: kustomize.config.k8s.io/v1beta1
24+
kind: Kustomization
25+
patches:
26+
- path: patches/validation_patches.yaml
27+
target:
28+
group: apiextensions.k8s.io
29+
kind: CustomResourceDefinition
30+
name: notebooks.kubeflow.org
31+
version: v1
32+
- path: patches/trivial_conversion_patch.yaml

components/notebook-controller/config/default/kustomization.yaml

Lines changed: 11 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,8 @@ namespace: notebook-controller-system
99
namePrefix: notebook-controller-
1010

1111
# Labels to add to all resources and selectors.
12-
commonLabels:
13-
app: notebook-controller
14-
kustomize.component: notebook-controller
1512

1613

17-
bases:
18-
- ../rbac
19-
- ../manager
20-
- ../crd
2114
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in crd/kustomization.yaml
2215
#- ../webhook
2316
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
@@ -45,31 +38,14 @@ bases:
4538
#- webhookcainjection_patch.yaml
4639

4740
# the following config is for teaching kustomize how to do var substitution
48-
vars:
49-
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
50-
# - name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
51-
# objref:
52-
# kind: Certificate
53-
# group: certmanager.k8s.io
54-
# version: v1alpha1
55-
# name: serving-cert # this name should match the one in certificate.yaml
56-
# fieldref:
57-
# fieldpath: metadata.namespace
58-
# - name: CERTIFICATE_NAME
59-
# objref:
60-
# kind: Certificate
61-
# group: certmanager.k8s.io
62-
# version: v1alpha1
63-
# name: serving-cert # this name should match the one in certificate.yaml
64-
# - name: SERVICE_NAMESPACE # namespace of the service
65-
# objref:
66-
# kind: Service
67-
# version: v1
68-
# name: webhook-service
69-
# fieldref:
70-
# fieldpath: metadata.namespace
71-
# - name: SERVICE_NAME
72-
# objref:
73-
# kind: Service
74-
# version: v1
75-
# name: webhook-service
41+
apiVersion: kustomize.config.k8s.io/v1beta1
42+
kind: Kustomization
43+
resources:
44+
- ../rbac
45+
- ../manager
46+
- ../crd
47+
labels:
48+
- includeSelectors: true
49+
pairs:
50+
app: notebook-controller
51+
kustomize.component: notebook-controller

components/notebook-controller/config/manager/kustomization.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ resources:
33
- service-account.yaml
44
- service.yaml
55
configMapGenerator:
6-
- name: config
7-
envs:
6+
- envs:
87
- params.env
8+
name: config
99
generatorOptions:
10-
disableNameSuffixHash: true
10+
disableNameSuffixHash: true
11+
apiVersion: kustomize.config.k8s.io/v1beta1
12+
kind: Kustomization

components/notebook-controller/config/overlays/kubeflow/kustomization.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ kind: Kustomization
33
resources:
44
- ../../base
55
namespace: kubeflow
6-
patchesStrategicMerge:
7-
- patches/remove-namespace.yaml
86
configMapGenerator:
9-
- name: config
10-
behavior: merge
7+
- behavior: merge
118
literals:
129
- USE_ISTIO=true
1310
- ISTIO_GATEWAY=kubeflow/kubeflow-gateway
11+
name: config
12+
patches:
13+
- path: patches/remove-namespace.yaml
Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,42 @@
1-
---
21
apiVersion: kustomize.config.k8s.io/v1beta1
32
kind: Kustomization
43
resources:
5-
- ../../base
4+
- ../../base
65
namespace: opendatahub
7-
commonLabels:
8-
app.kubernetes.io/part-of: odh-notebook-controller
9-
component.opendatahub.io/name: kf-notebook-controller
10-
opendatahub.io/component: "true"
116
configurations:
12-
- params.yaml
7+
- params.yaml
138
configMapGenerator:
14-
- name: kf-notebook-controller-image-parameters
15-
env: params.env
16-
- name: config
17-
behavior: merge
18-
literals:
19-
- USE_ISTIO=false
20-
- ADD_FSGROUP=false
9+
- envs:
10+
- params.env
11+
name: kf-notebook-controller-image-parameters
12+
- behavior: merge
13+
literals:
14+
- USE_ISTIO=false
15+
- ADD_FSGROUP=false
16+
name: config
2117
generatorOptions:
2218
disableNameSuffixHash: true
23-
patchesStrategicMerge:
24-
- remove_namespace_patch.yaml
25-
- manager_openshift_patch.yaml
26-
- manager_service_openshift_patch.yaml
27-
vars:
28-
- name: odh-kf-notebook-controller-image
29-
objref:
19+
labels:
20+
- includeSelectors: true
21+
pairs:
22+
app.kubernetes.io/part-of: odh-notebook-controller
23+
component.opendatahub.io/name: kf-notebook-controller
24+
opendatahub.io/component: "true"
25+
patches:
26+
- path: remove_namespace_patch.yaml
27+
- path: manager_openshift_patch.yaml
28+
- path: manager_service_openshift_patch.yaml
29+
replacements:
30+
- source:
31+
fieldPath: data.odh-kf-notebook-controller-image
3032
kind: ConfigMap
3133
name: kf-notebook-controller-image-parameters
32-
apiVersion: v1
33-
fieldref:
34-
fieldpath: data.odh-kf-notebook-controller-image
34+
version: v1
35+
targets:
36+
- fieldPaths:
37+
- spec.template.spec.containers.0.image
38+
select:
39+
group: apps
40+
kind: Deployment
41+
name: deployment
42+
version: v1

components/notebook-controller/config/overlays/openshift/manager_openshift_patch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ spec:
3232
name: notebook-controller-culler-config
3333
key: IDLENESS_CHECK_PERIOD
3434
optional: true
35-
image: $(odh-kf-notebook-controller-image)
35+
image: odh-kf-notebook-controller-image_PLACEHOLDER
3636
resources:
3737
limits:
3838
cpu: 500m
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
3-
bases:
4-
- ../openshift
53

64
configMapGenerator:
7-
- name: config
8-
behavior: merge
5+
- behavior: merge
96
envs:
107
- ossm.env
8+
name: config
9+
resources:
10+
- ../openshift

0 commit comments

Comments
 (0)