Skip to content

Commit

Permalink
fix(RHOAIENG-6720): Remove Kustomize v5 deprecation warnings (#425)
Browse files Browse the repository at this point in the history
* fix: Remove Kustomize v5 deprecation warnings

* fix: Add PR number

* fix: Operator deployment name
  • Loading branch information
ruivieira authored Feb 25, 2025
1 parent 5986605 commit ad5b87b
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 39 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/smoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
env:
PR_NUMBER: ${{ github.event.pull_request.number || 'default-pr-number' }}
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
46 changes: 17 additions & 29 deletions config/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resources:
- bases/trustyai.opendatahub.io_guardrailsorchestrators.yaml
#+kubebuilder:scaffold:crdkustomizeresource

patchesStrategicMerge: []
patches: []
#+kubebuilder:scaffold:crdkustomizewebhookpatch
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

Expand Down
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions config/overlays/lmes/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ kind: Kustomization
resources:
- ../../base

patchesStrategicMerge:
- lmes-only-patch.yaml
patches:
- path: lmes-only-patch.yaml
4 changes: 2 additions & 2 deletions config/overlays/odh-kueue/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ kind: Kustomization
resources:
- ../../base

patchesStrategicMerge:
- patch.yaml
patches:
- path: patch.yaml

configMapGenerator:
- env: params.env
Expand Down
4 changes: 2 additions & 2 deletions config/overlays/testing/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resources:
- ../../base

patchesStrategicMerge:
- image-pull-policy.yaml
patches:
- path: image-pull-policy.yaml
17 changes: 15 additions & 2 deletions tests/smoke/test_smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ 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-controller-manager"

EXPECTED_IMAGE="smoke/operator:pr-${PR_NUMBER:-default-pr-number}"

log_success() {
local message=$1
Expand Down Expand Up @@ -37,8 +40,8 @@ check_resource() {

gen_cert() {
openssl req -x509 -nodes -newkey rsa:2048 -keyout tls.key -days 365 -out tls.crt -subj '/CN=trustyai-service-tls'
oc create secret generic trustyai-service-internal --from-file=./tls.crt --from-file=./tls.key -n "$NAMESPACE"
oc create secret generic trustyai-service-tls --from-file=./tls.crt --from-file=./tls.key -n "$NAMESPACE"
kubectl create secret generic trustyai-service-internal --from-file=./tls.crt --from-file=./tls.key -n "$NAMESPACE"
kubectl create secret generic trustyai-service-tls --from-file=./tls.crt --from-file=./tls.key -n "$NAMESPACE"
rm tls.key tls.crt
}

Expand All @@ -56,6 +59,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
Expand Down

0 comments on commit ad5b87b

Please sign in to comment.