diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 66448fba33..621cfcd0e8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -173,3 +173,23 @@ jobs: run: | export PROJECT_PATH=$(pwd) make test-all + + helm-tests: + runs-on: ubuntu-latest + needs: pre-checks + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Unshallow + run: git fetch --prune --unshallow + + - uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.0.1 + + - name: Run chart-testing (lint) + run: ct lint --target-branch=main --check-version-increment=false diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 5746153955..c19978874c 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -30,6 +30,14 @@ jobs: with: go-version: 1.14 + - name: Set up Helm + uses: azure/setup-helm@v1 + with: + version: v3.5.0 + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.0.1 + - name: Cache Go modules uses: actions/cache@v1 with: @@ -76,4 +84,16 @@ jobs: sleep 20 echo ">>> Run Kyverno e2e test" make test-e2e + kubectl delete -f ${GITHUB_WORKSPACE}/definitions/install.yaml + - name: Update chart values + run: | + sed -i -e "s|nameOverride:.*|nameOverride: kyverno|g" charts/kyverno/values.yaml + sed -i -e "s|fullnameOverride:.*|fullnameOverride: kyverno|g" charts/kyverno/values.yaml + sed -i -e "s|namespace:.*|namespace: kyverno|g" charts/kyverno/values.yaml + sed -i -e "s|tag:.*|tag: $(git describe --always --tags)|g" charts/kyverno/values.yaml + + - name: Run chart-testing (install) + run: | + kubectl create namespace kyverno + ct install --target-branch=main --namespace=kyverno diff --git a/charts/kyverno/templates/tests/test.yaml b/charts/kyverno/templates/tests/test.yaml new file mode 100644 index 0000000000..8220d07e46 --- /dev/null +++ b/charts/kyverno/templates/tests/test.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ template "kyverno.fullname" . }}-test" + labels: + {{- include "kyverno.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['-O-','-S','--no-check-certificate','https://{{ template "kyverno.serviceName" . }}:{{ .Values.service.port }}/health/liveness'] + restartPolicy: Never diff --git a/charts/kyverno/values.yaml b/charts/kyverno/values.yaml index 5c3209cdf7..fbeef11bc5 100644 --- a/charts/kyverno/values.yaml +++ b/charts/kyverno/values.yaml @@ -152,4 +152,3 @@ service: # 3) Let Helm generate a self signed cert, by setting createSelfSignedCert true # If letting Kyverno create its own CA or providing your own, make createSelfSignedCert is false createSelfSignedCert: false -