diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index ce4dfa7acf..fcc7bbab5f 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -40,6 +40,8 @@ jobs: - name: Install Chainsaw uses: kyverno/action-install-chainsaw@v0.1.7 + with: + release: v0.1.8-alpha.1 - name: Run Scheduling Gates Integration Tests if: inputs.scheduling-gates == 'gates_on' && inputs.allowed-namespaces == 'allowed_ns_off' diff --git a/test/chainsaw/integration/expose-keptn-metric/chainsaw-test.yaml b/test/chainsaw/integration/expose-keptn-metric/chainsaw-test.yaml index 98c8ac333c..51027982f0 100755 --- a/test/chainsaw/integration/expose-keptn-metric/chainsaw-test.yaml +++ b/test/chainsaw/integration/expose-keptn-metric/chainsaw-test.yaml @@ -4,16 +4,15 @@ kind: Test metadata: name: expose-keptn-metric spec: + bindings: + - name: service + value: (x_k8s_list($client, 'v1', 'Service', 'keptn-system') | items[?metadata.labels."control-plane" == 'metrics-operator'] | [0]) steps: - name: step-00 try: - - script: - timeout: 5m - content: | - export NAME=$( echo $NAMESPACE | tr -d -) - export SVCNAME=$( kubectl get svc -n keptn-system -l control-plane=metrics-operator -ojsonpath="{ .items[0].metadata.name }" ) - echo "installing first job pointing to ${SVCNAME}" - envsubst < job-no-metric.yaml | kubectl apply -f - + - apply: + template: true + file: job-no-metric.yaml - wait: timeout: 5m resource: job @@ -23,13 +22,9 @@ spec: name: complete - name: step-01 try: - - script: - timeout: 5m - content: | - export NAME=$( echo $NAMESPACE | tr -d -) - export SVCNAME=$( kubectl get svc -n keptn-system -l control-plane=metrics-operator -ojsonpath="{ .items[0].metadata.name }" ) - echo "installing second job pointing to ${SVCNAME}" - envsubst < job-existing-metric.yaml | kubectl apply -f - + - apply: + template: true + file: job-existing-metric.yaml - wait: timeout: 5m resource: job diff --git a/test/chainsaw/integration/expose-keptn-metric/job-existing-metric.yaml b/test/chainsaw/integration/expose-keptn-metric/job-existing-metric.yaml index 6f4672346b..1c4fdb43d7 100644 --- a/test/chainsaw/integration/expose-keptn-metric/job-existing-metric.yaml +++ b/test/chainsaw/integration/expose-keptn-metric/job-existing-metric.yaml @@ -1,8 +1,7 @@ apiVersion: metrics.keptn.sh/v1beta1 kind: KeptnMetric metadata: - name: $NAME - namespace: $NAMESPACE + name: (replace_all($namespace, '-', '')) spec: provider: name: "provider" @@ -12,8 +11,7 @@ spec: apiVersion: batch/v1 kind: Job metadata: - name: $NAME-job2 - namespace: $NAMESPACE + name: (join('-', [$namespace, 'job2'])) labels: kind: existing-metric spec: @@ -23,6 +21,11 @@ spec: containers: - name: test-prometheus image: curlimages/curl:8.6.0 + env: + - name: NAME + value: (replace_all($namespace, '-', '')) + - name: SVCNAME + value: ($service.metadata.name) args: - /bin/sh - -ec @@ -36,6 +39,13 @@ spec: exit 1 - name: test-api-endpoint image: curlimages/curl:8.6.0 + env: + - name: NAME + value: (replace_all($namespace, '-', '')) + - name: SVCNAME + value: ($service.metadata.name) + - name: NAMESPACE + value: ($namespace) # yamllint disable rule:line-length args: - /bin/sh diff --git a/test/chainsaw/integration/expose-keptn-metric/job-no-metric.yaml b/test/chainsaw/integration/expose-keptn-metric/job-no-metric.yaml index 102e1dc1a4..27d328fb19 100644 --- a/test/chainsaw/integration/expose-keptn-metric/job-no-metric.yaml +++ b/test/chainsaw/integration/expose-keptn-metric/job-no-metric.yaml @@ -1,8 +1,7 @@ apiVersion: batch/v1 kind: Job metadata: - name: $NAME-job1 - namespace: $NAMESPACE + name: (join('-', [$namespace, 'job1'])) labels: kind: no-metric spec: @@ -12,6 +11,11 @@ spec: containers: - name: test-prometheus image: curlimages/curl:8.6.0 + env: + - name: NAME + value: (replace_all($namespace, '-', '')) + - name: SVCNAME + value: ($service.metadata.name) args: - /bin/sh - -ec @@ -23,6 +27,13 @@ spec: fi - name: test-api-endpoint image: curlimages/curl:8.6.0 + env: + - name: NAME + value: (replace_all($namespace, '-', '')) + - name: SVCNAME + value: ($service.metadata.name) + - name: NAMESPACE + value: ($namespace) args: - /bin/sh - -ec