From e9c23fe42ffc28a16c67d9f16c77d1d85d8db612 Mon Sep 17 00:00:00 2001 From: Lucas Severo Alves Date: Mon, 8 Aug 2022 21:11:20 +0200 Subject: [PATCH] add helm ct install. First step, see https://github.com/kubernetes-sigs/descheduler/pull/895#issuecomment-1203608848 --- .github/ci/ct.yaml | 1 + .github/workflows/helm.yaml | 24 ++++++++++++++++++++++-- Makefile | 3 +++ docs/contributor-guide.md | 2 +- test/run-e2e-tests.sh | 20 +++++++++++++------- 5 files changed, 40 insertions(+), 10 deletions(-) diff --git a/.github/ci/ct.yaml b/.github/ci/ct.yaml index e71665a89..567a60eee 100644 --- a/.github/ci/ct.yaml +++ b/.github/ci/ct.yaml @@ -2,4 +2,5 @@ chart-dirs: - charts helm-extra-args: "--timeout=5m" check-version-increment: false +helm-extra-set-args: "--set=kind=Deployment --set=podSecurityPolicy.create=false" target-branch: master diff --git a/.github/workflows/helm.yaml b/.github/workflows/helm.yaml index c81e822cd..dcdc18491 100644 --- a/.github/workflows/helm.yaml +++ b/.github/workflows/helm.yaml @@ -7,9 +7,11 @@ on: - release-* paths: - 'charts/**' + - '.github/workflows/helm.yaml' pull_request: paths: - 'charts/**' + - '.github/workflows/helm.yaml' jobs: lint-and-test: @@ -23,7 +25,7 @@ jobs: - name: Set up Helm uses: azure/setup-helm@v2.1 with: - version: v3.4.2 + version: v3.9.2 - uses: actions/setup-python@v3.1.2 with: @@ -31,6 +33,8 @@ jobs: - name: Set up chart-testing uses: helm/chart-testing-action@v2.2.1 + with: + version: v3.7.0 - name: Run chart-testing (list-changed) id: list-changed @@ -39,6 +43,22 @@ jobs: if [[ -n "$changed" ]]; then echo "::set-output name=changed::true" fi - + - name: Run chart-testing (lint) run: ct lint --config=.github/ci/ct.yaml --validate-maintainers=false + + # Need a multi node cluster so descheduler runs until evictions + - name: Create multi node Kind cluster + run: | + kind create cluster --name kind --config ./hack/kind_config.yaml --wait 2m + + # helm-extra-set-args only available after ct 3.6.0 + - name: Run chart-testing (install) + run: ct install --config=.github/ci/ct.yaml + + - name: E2E after chart install + env: + KUBERNETES_VERSION: "v1.24.0" + KIND_E2E: true + SKIP_INSTALL: true + run: make test-e2e diff --git a/Makefile b/Makefile index 13cec077c..5e8d202a2 100644 --- a/Makefile +++ b/Makefile @@ -150,3 +150,6 @@ build-helm: test-helm: ensure-helm-install ./test/run-helm-tests.sh + +kind-multi-node: + kind create cluster --name kind --config ./hack/kind_config.yaml --wait 2m diff --git a/docs/contributor-guide.md b/docs/contributor-guide.md index b716d4ced..ef3fe54f1 100644 --- a/docs/contributor-guide.md +++ b/docs/contributor-guide.md @@ -31,7 +31,7 @@ View all CLI options. ## Run Tests ``` GOOS=linux make dev-image -kind create cluster --config hack/kind_config.yaml +make kind-multi-node kind load docker-image kind get kubeconfig > /tmp/admin.conf export KUBECONFIG=/tmp/admin.conf diff --git a/test/run-e2e-tests.sh b/test/run-e2e-tests.sh index 3e24e96e8..9c6f2f0c4 100755 --- a/test/run-e2e-tests.sh +++ b/test/run-e2e-tests.sh @@ -18,15 +18,21 @@ set -x set -o errexit set -o nounset +# Set to empty if unbound/empty +SKIP_INSTALL=${SKIP_INSTALL:-} + # This just runs e2e tests. if [ -n "$KIND_E2E" ]; then - K8S_VERSION=${KUBERNETES_VERSION:-v1.24.0} - curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl && chmod +x kubectl && mv kubectl /usr/local/bin/ - wget https://github.com/kubernetes-sigs/kind/releases/download/v0.13.0/kind-linux-amd64 - chmod +x kind-linux-amd64 - mv kind-linux-amd64 kind - export PATH=$PATH:$PWD - kind create cluster --image kindest/node:${K8S_VERSION} --config=./hack/kind_config.yaml + # If we did not set SKIP_INSTALL + if [ -z "$SKIP_INSTALL" ]; then + K8S_VERSION=${KUBERNETES_VERSION:-v1.24.0} + curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl && chmod +x kubectl && mv kubectl /usr/local/bin/ + wget https://github.com/kubernetes-sigs/kind/releases/download/v0.13.0/kind-linux-amd64 + chmod +x kind-linux-amd64 + mv kind-linux-amd64 kind + export PATH=$PATH:$PWD + kind create cluster --image kindest/node:${K8S_VERSION} --config=./hack/kind_config.yaml + fi docker pull kubernetes/pause kind load docker-image kubernetes/pause kind get kubeconfig > /tmp/admin.conf