From 698f80800248e06d189daf665bcf88521e5b5e0d Mon Sep 17 00:00:00 2001 From: Rui Vieira Date: Mon, 24 Feb 2025 13:32:45 +0000 Subject: [PATCH] fix: Remove Kustomize v5 deprecation warnings --- config/base/kustomization.yaml | 46 ++++++++------------ config/crd/kustomization.yaml | 2 +- config/manager/manager.yaml | 2 +- config/overlays/lmes/kustomization.yaml | 4 +- config/overlays/odh-kueue/kustomization.yaml | 4 +- config/overlays/testing/kustomization.yaml | 4 +- tests/smoke/test_smoke.sh | 14 ++++++ 7 files changed, 39 insertions(+), 37 deletions(-) diff --git a/config/base/kustomization.yaml b/config/base/kustomization.yaml index f50d41df..697d41d3 100644 --- a/config/base/kustomization.yaml +++ b/config/base/kustomization.yaml @@ -6,8 +6,11 @@ resources: - ../rbac - ../manager -commonLabels: - app.kubernetes.io/part-of: trustyai +labels: + - pairs: + app.kubernetes.io/part-of: trustyai + includeSelectors: true + includeTemplates: true configMapGenerator: - env: params.env @@ -19,32 +22,17 @@ configurations: generatorOptions: disableNameSuffixHash: true -vars: - - name: trustyaiServiceImage - objref: +replacements: + # Operator image replacement + - source: kind: ConfigMap name: config - apiVersion: v1 - fieldref: - fieldpath: data.trustyaiServiceImage - - name: trustyaiOperatorImage - objref: - kind: ConfigMap - name: config - apiVersion: v1 - fieldref: - fieldpath: data.trustyaiOperatorImage - - name: oauthProxyImage - objref: - kind: ConfigMap - name: config - apiVersion: v1 - fieldref: - fieldpath: data.oauthProxyImage - - name: kServeServerless - objref: - kind: ConfigMap - name: config - apiVersion: v1 - fieldref: - fieldpath: data.kServeServerless + version: v1 + fieldPath: data.trustyaiOperatorImage + targets: + - select: + group: apps + kind: Deployment + name: controller-manager + fieldPaths: + - spec.template.spec.containers.0.image diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 9857e539..b41ab181 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -4,7 +4,7 @@ resources: - bases/trustyai.opendatahub.io_guardrailsorchestrators.yaml #+kubebuilder:scaffold:crdkustomizeresource -patchesStrategicMerge: [] +patches: [] #+kubebuilder:scaffold:crdkustomizewebhookpatch #+kubebuilder:scaffold:crdkustomizecainjectionpatch diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 163fd452..21ba348f 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -34,7 +34,7 @@ spec: - --leader-elect - --enable-services - "TAS,LMES,GORCH" - image: $(trustyaiOperatorImage) + image: "quay.io/trustyai/trustyai-service-operator:latest" name: manager securityContext: runAsNonRoot: true diff --git a/config/overlays/lmes/kustomization.yaml b/config/overlays/lmes/kustomization.yaml index 216c929f..9fefbfbd 100644 --- a/config/overlays/lmes/kustomization.yaml +++ b/config/overlays/lmes/kustomization.yaml @@ -4,5 +4,5 @@ kind: Kustomization resources: - ../../base -patchesStrategicMerge: - - lmes-only-patch.yaml +patches: + - path: lmes-only-patch.yaml diff --git a/config/overlays/odh-kueue/kustomization.yaml b/config/overlays/odh-kueue/kustomization.yaml index 28837c2c..83265b14 100644 --- a/config/overlays/odh-kueue/kustomization.yaml +++ b/config/overlays/odh-kueue/kustomization.yaml @@ -4,8 +4,8 @@ kind: Kustomization resources: - ../../base -patchesStrategicMerge: - - patch.yaml +patches: + - path: patch.yaml configMapGenerator: - env: params.env diff --git a/config/overlays/testing/kustomization.yaml b/config/overlays/testing/kustomization.yaml index 7cacd7e2..daae19c4 100644 --- a/config/overlays/testing/kustomization.yaml +++ b/config/overlays/testing/kustomization.yaml @@ -1,5 +1,5 @@ resources: - ../../base -patchesStrategicMerge: - - image-pull-policy.yaml +patches: + - path: image-pull-policy.yaml diff --git a/tests/smoke/test_smoke.sh b/tests/smoke/test_smoke.sh index f31b7bd2..635b9a23 100755 --- a/tests/smoke/test_smoke.sh +++ b/tests/smoke/test_smoke.sh @@ -10,6 +10,10 @@ CRD_PATH="./tests/smoke/manifests/trustyai-cr.yaml" PVC_NAME="trustyai-service-pvc" SERVICE_NAME_1="trustyai-service" SERVICE_NAME_2="trustyai-service-tls" +DEPLOYMENT_NAME="trustyai-service-operator" + +EXPECTED_IMAGE="smoke/operator:pr-${{ github.event.pull_request.number || env.PR_NUMBER }}" + log_success() { local message=$1 @@ -56,6 +60,16 @@ check_resource service "$SERVICE_NAME_2" "$NAMESPACE" # Check for the PVC creation check_resource pvc "$PVC_NAME" "$NAMESPACE" +# Check for correct Operator image assignment +OPERATOR_IMAGE=$(kubectl get deployment "${DEPLOYMENT_NAME}" -n system \ + -o jsonpath='{.spec.template.spec.containers[0].image}') + +if [[ "${OPERATOR_IMAGE}" == "${EXPECTED_IMAGE}" ]]; then + log_success "Operator image is correct: ${OPERATOR_IMAGE}" +else + log_failure "Operator image mismatch! Expected ${EXPECTED_IMAGE}, got ${OPERATOR_IMAGE}" +fi + kubectl delete namespace "$NAMESPACE" sleep 10