Merge 576958d1aa
into 9e6c40664f
This commit is contained in:
commit
0a495619c4
12 changed files with 405 additions and 409 deletions
106
.github/workflows/ci.yaml
vendored
106
.github/workflows/ci.yaml
vendored
|
@ -208,13 +208,12 @@ jobs:
|
||||||
path: docker.tar.gz
|
path: docker.tar.gz
|
||||||
retention-days: 5
|
retention-days: 5
|
||||||
|
|
||||||
helm-lint:
|
chart-lint:
|
||||||
name: Helm chart lint
|
name: Chart / Lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- changes
|
- changes
|
||||||
if: |
|
if: fromJSON(needs.changes.outputs.charts) || fromJSON(needs.changes.outputs.baseimage) || fromJSON(github.event.workflow_dispatch.run_e2e)
|
||||||
(needs.changes.outputs.charts == 'true') || (needs.changes.outputs.baseimage == 'true') || ${{ github.event.workflow_dispatch.run_e2e == 'true' }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -222,55 +221,56 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
|
||||||
|
with:
|
||||||
|
python-version: "3.x"
|
||||||
|
|
||||||
- name: Set up Helm
|
- name: Set up Helm
|
||||||
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
|
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
|
||||||
|
|
||||||
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
|
- name: Set up Helm Chart Testing
|
||||||
with:
|
|
||||||
python-version: '3.x'
|
|
||||||
|
|
||||||
- name: Set up chart-testing
|
|
||||||
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
|
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
|
||||||
|
|
||||||
- name: Install Helm Unit Test Plugin
|
- name: Set up Helm Docs
|
||||||
|
uses: gabe565/setup-helm-docs-action@79a4cfe8dc7ae51c1113e3f3a1ae45e601d0c963 # v1.0.3
|
||||||
|
|
||||||
|
- name: Generate docs
|
||||||
|
run: |
|
||||||
|
helm-docs --chart-search-root charts
|
||||||
|
|
||||||
|
if ! git diff --exit-code charts/ingress-nginx/README.md
|
||||||
|
then
|
||||||
|
echo "Please use helm-docs in your fork of the project and commit an updated README.md for the chart."
|
||||||
|
echo "https://github.com/kubernetes/ingress-nginx/blob/main/MANUAL_RELEASE.md#d-edit-the-valuesyaml-and-run-helm-docs"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Lint chart
|
||||||
|
run: |
|
||||||
|
ct lint --config ./.ct.yaml
|
||||||
|
|
||||||
|
curl --silent --show-error --fail --location https://github.com/artifacthub/hub/releases/download/v1.17.0/ah_1.17.0_linux_amd64.tar.gz --remote-name
|
||||||
|
echo "57c184b71a9a5c59192c2158fc08bdddca5c340fb1deeed0158383a665b38bf1 ah_1.17.0_linux_amd64.tar.gz" | shasum --check
|
||||||
|
tar xzf ah_1.17.0_linux_amd64.tar.gz ah
|
||||||
|
|
||||||
|
./ah lint --path charts/ingress-nginx
|
||||||
|
|
||||||
|
rm ah_1.17.0_linux_amd64.tar.gz ah
|
||||||
|
|
||||||
|
- name: Run unit tests
|
||||||
run: |
|
run: |
|
||||||
helm plugin install https://github.com/helm-unittest/helm-unittest
|
helm plugin install https://github.com/helm-unittest/helm-unittest
|
||||||
|
helm unittest charts/ingress-nginx
|
||||||
|
|
||||||
- name: Run Helm Unit Tests
|
chart-test:
|
||||||
run: |
|
name: Chart / Test
|
||||||
helm unittest charts/ingress-nginx -d
|
|
||||||
|
|
||||||
- name: Run chart-testing (lint)
|
|
||||||
run: ct lint --config ./.ct.yaml
|
|
||||||
|
|
||||||
- name: Run helm-docs
|
|
||||||
run: |
|
|
||||||
GOBIN=$PWD GO111MODULE=on go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.11.0
|
|
||||||
./helm-docs --chart-search-root=${GITHUB_WORKSPACE}/charts
|
|
||||||
DIFF=$(git diff ${GITHUB_WORKSPACE}/charts/ingress-nginx/README.md)
|
|
||||||
if [ ! -z "$DIFF" ]; then
|
|
||||||
echo "Please use helm-docs in your clone, of your fork, of the project, and commit a updated README.md for the chart. https://github.com/kubernetes/ingress-nginx/blob/main/RELEASE.md#d-edit-the-valuesyaml-and-run-helm-docs"
|
|
||||||
fi
|
|
||||||
git diff --exit-code
|
|
||||||
rm -f ./helm-docs
|
|
||||||
|
|
||||||
- name: Run Artifact Hub lint
|
|
||||||
run: |
|
|
||||||
wget https://github.com/artifacthub/hub/releases/download/v1.5.0/ah_1.5.0_linux_amd64.tar.gz
|
|
||||||
echo 'ad0e44c6ea058ab6b85dbf582e88bad9fdbc64ded0d1dd4edbac65133e5c87da *ah_1.5.0_linux_amd64.tar.gz' | shasum -c
|
|
||||||
tar -xzvf ah_1.5.0_linux_amd64.tar.gz ah
|
|
||||||
./ah lint -p charts/ingress-nginx || exit 1
|
|
||||||
rm -f ./ah ./ah_1.5.0_linux_amd64.tar.gz
|
|
||||||
|
|
||||||
helm-test:
|
|
||||||
name: Helm chart testing
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- changes
|
- changes
|
||||||
- build
|
- build
|
||||||
- helm-lint
|
- chart-lint
|
||||||
if: |
|
if: fromJSON(needs.changes.outputs.charts) || fromJSON(needs.changes.outputs.baseimage) || fromJSON(github.event.workflow_dispatch.run_e2e)
|
||||||
(needs.changes.outputs.charts == 'true') || (needs.changes.outputs.baseimage == 'true') || ${{ github.event.workflow_dispatch.run_e2e == 'true' }}
|
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -286,35 +286,27 @@ jobs:
|
||||||
go-version: ${{ needs.build.outputs.golangversion }}
|
go-version: ${{ needs.build.outputs.golangversion }}
|
||||||
check-latest: true
|
check-latest: true
|
||||||
|
|
||||||
- name: cache
|
- name: Download cache
|
||||||
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
|
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
|
||||||
with:
|
with:
|
||||||
name: docker.tar.gz
|
name: docker.tar.gz
|
||||||
|
|
||||||
- name: fix permissions
|
- name: Load cache
|
||||||
run: |
|
run: gzip --decompress --stdout docker.tar.gz | docker load
|
||||||
sudo mkdir -p $HOME/.kube
|
|
||||||
sudo chmod -R 777 $HOME/.kube
|
|
||||||
|
|
||||||
- name: Create Kubernetes ${{ matrix.k8s }} cluster
|
- name: Create cluster
|
||||||
id: kind
|
id: kind
|
||||||
run: |
|
run: |
|
||||||
kind create cluster --image=kindest/node:${{ matrix.k8s }}
|
sudo chmod 777 "${HOME}/.kube"
|
||||||
|
kind create cluster --image kindest/node:${{ matrix.k8s }} --kubeconfig "${HOME}/.kube/kind-config-kind"
|
||||||
|
|
||||||
- name: Load images from cache
|
- name: Run E2E tests
|
||||||
run: |
|
|
||||||
echo "loading docker images..."
|
|
||||||
gzip -dc docker.tar.gz | docker load
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
env:
|
env:
|
||||||
KIND_CLUSTER_NAME: kind
|
KIND_CLUSTER_NAME: kind
|
||||||
SKIP_CLUSTER_CREATION: true
|
SKIP_CLUSTER_CREATION: true
|
||||||
SKIP_IMAGE_CREATION: true
|
SKIP_IMAGE_CREATION: true
|
||||||
SKIP_INGRESS_IMAGE_CREATION: true
|
SKIP_INGRESS_IMAGE_CREATION: true
|
||||||
run: |
|
run: make kind-e2e-chart-tests
|
||||||
kind get kubeconfig > $HOME/.kube/kind-config-kind
|
|
||||||
make kind-e2e-chart-tests
|
|
||||||
|
|
||||||
kubernetes:
|
kubernetes:
|
||||||
name: Kubernetes
|
name: Kubernetes
|
||||||
|
|
21
.github/workflows/helm.yaml
vendored
21
.github/workflows/helm.yaml
vendored
|
@ -29,19 +29,20 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||||
|
|
||||||
- name: Run Artifact Hub lint
|
|
||||||
run: |
|
|
||||||
wget https://github.com/artifacthub/hub/releases/download/v1.5.0/ah_1.5.0_linux_amd64.tar.gz
|
|
||||||
echo 'ad0e44c6ea058ab6b85dbf582e88bad9fdbc64ded0d1dd4edbac65133e5c87da *ah_1.5.0_linux_amd64.tar.gz' | shasum -c
|
|
||||||
tar -xzvf ah_1.5.0_linux_amd64.tar.gz ah
|
|
||||||
./ah lint -p charts/ingress-nginx || exit 1
|
|
||||||
rm -f ./ah ./ah_1.5.0_linux_amd64.tar.gz
|
|
||||||
|
|
||||||
- name: Set up chart-testing
|
- name: Set up chart-testing
|
||||||
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
|
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
|
||||||
|
|
||||||
- name: Run chart-testing (lint)
|
- name: Lint chart
|
||||||
run: ct lint --target-branch ${{ github.ref_name }} --config ./.ct.yaml
|
run: |
|
||||||
|
ct lint --config ./.ct.yaml --target-branch ${{ github.ref_name }}
|
||||||
|
|
||||||
|
curl --silent --show-error --fail --location https://github.com/artifacthub/hub/releases/download/v1.17.0/ah_1.17.0_linux_amd64.tar.gz --remote-name
|
||||||
|
echo "57c184b71a9a5c59192c2158fc08bdddca5c340fb1deeed0158383a665b38bf1 ah_1.17.0_linux_amd64.tar.gz" | shasum --check
|
||||||
|
tar xzf ah_1.17.0_linux_amd64.tar.gz ah
|
||||||
|
|
||||||
|
./ah lint --path charts/ingress-nginx
|
||||||
|
|
||||||
|
rm ah_1.17.0_linux_amd64.tar.gz ah
|
||||||
|
|
||||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||||
id: filter
|
id: filter
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,3 @@
|
||||||
helm-docs
|
|
||||||
# OSX
|
# OSX
|
||||||
._*
|
._*
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
@ -231,14 +231,12 @@ Promoting the images basically means that images, that were pushed to staging co
|
||||||
- tag
|
- tag
|
||||||
- digest
|
- digest
|
||||||
|
|
||||||
- [helm-docs](https://github.com/norwoodj/helm-docs) is a tool that generates the README.md for a helm-chart automatically. In the CI pipeline workflow of github actions (/.github/workflows/ci.yaml), you can see how helm-docs is used. But the CI pipeline is not designed to make commits back into the project. So we need to run helm-docs manually, and check in the resulting autogenerated README.md at the path /charts/ingress-nginx/README.md
|
- [helm-docs](https://github.com/norwoodj/helm-docs) is a tool that generates the README.md for a Helm chart automatically. In the CI pipeline workflow of GitHub actions (.github/workflows/ci.yaml), you can see how helm-docs is used. The CI pipeline is not designed to make commits back into the project, so we need to run helm-docs manually and commit the resulting generated README.md. You can obtain a recent version of the helm-docs binary here: https://github.com/norwoodj/helm-docs/releases.
|
||||||
```
|
```
|
||||||
GOBIN=$PWD GO111MODULE=on go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.11.0
|
helm-docs --chart-search-root charts
|
||||||
./helm-docs --chart-search-root=${GITHUB_WORKSPACE}/charts
|
git diff charts/ingress-nginx/README.md
|
||||||
git diff --exit-code
|
|
||||||
rm -f ./helm-docs
|
|
||||||
```
|
```
|
||||||
Watchout for mistakes like leaving the helm-docs executable in your clone workspace or not checking the new README.md manually etc.
|
Take care of not leaving the helm-docs executable in your clone workspace or not committing the new README.md.
|
||||||
|
|
||||||
### e. Edit the static manifests
|
### e. Edit the static manifests
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ To install the example and collectors run:
|
||||||
helm repo add grafana https://grafana.github.io/helm-charts
|
helm repo add grafana https://grafana.github.io/helm-charts
|
||||||
helm repo update
|
helm repo update
|
||||||
# deploy cert-manager needed for OpenTelemetry collector operator
|
# deploy cert-manager needed for OpenTelemetry collector operator
|
||||||
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.9.1/cert-manager.yaml
|
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.3/cert-manager.yaml
|
||||||
# create observability namespace
|
# create observability namespace
|
||||||
kubectl apply -f https://raw.githubusercontent.com/esigo/nginx-example/main/observability/namespace.yaml
|
kubectl apply -f https://raw.githubusercontent.com/esigo/nginx-example/main/observability/namespace.yaml
|
||||||
# install OpenTelemetry collector operator
|
# install OpenTelemetry collector operator
|
||||||
|
|
|
@ -170,7 +170,7 @@ func runHelmDocs() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = sh.RunV("helm-docs", "--chart-search-root=${PWD}/charts")
|
err = sh.RunV("helm-docs", "--chart-search-root", "${PWD}/charts")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ func installHelmDocs() error {
|
||||||
utils.Info("HELM Install HelmDocs")
|
utils.Info("HELM Install HelmDocs")
|
||||||
g0 := sh.RunCmd("go")
|
g0 := sh.RunCmd("go")
|
||||||
|
|
||||||
err := g0("install", "github.com/norwoodj/helm-docs/cmd/helm-docs@v1.11.0")
|
err := g0("install", "github.com/norwoodj/helm-docs/cmd/helm-docs@v1.11.3")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,25 +91,31 @@ echo "[dev-env] copying docker images to cluster..."
|
||||||
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} ${REGISTRY}/controller:${TAG}
|
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} ${REGISTRY}/controller:${TAG}
|
||||||
|
|
||||||
if [ "${SKIP_CERT_MANAGER_CREATION:-false}" = "false" ]; then
|
if [ "${SKIP_CERT_MANAGER_CREATION:-false}" = "false" ]; then
|
||||||
curl -fsSL -o cmctl.tar.gz https://github.com/cert-manager/cert-manager/releases/download/v1.11.1/cmctl-linux-amd64.tar.gz
|
echo "[dev-env] deploying cert-manager..."
|
||||||
tar xzf cmctl.tar.gz
|
|
||||||
chmod +x cmctl
|
# Get OS and platform for downloading cmctl.
|
||||||
./cmctl help
|
os="$(uname -o | tr "[:upper:]" "[:lower:]")"
|
||||||
echo "[dev-env] apply cert-manager ..."
|
platform="$(uname -m | sed "s/aarch64/arm64/;s/x86_64/amd64/")"
|
||||||
kubectl apply --wait -f https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.yaml
|
|
||||||
kubectl wait --timeout=30s --for=condition=available deployment/cert-manager -n cert-manager
|
# Download cmctl. Cannot validate checksum since OS and platform may vary.
|
||||||
kubectl get validatingwebhookconfigurations cert-manager-webhook -ojson | jq '.webhooks[].clientConfig'
|
curl --silent --show-error --fail --location "https://github.com/cert-manager/cert-manager/releases/download/v1.13.3/cmctl-${os}-${platform}.tar.gz" | tar xz cmctl
|
||||||
kubectl get endpoints -n cert-manager cert-manager-webhook
|
|
||||||
./cmctl check api --wait=2m
|
# Deploy cert-manager.
|
||||||
|
kubectl create --filename https://github.com/cert-manager/cert-manager/releases/download/v1.13.3/cert-manager.yaml
|
||||||
|
kubectl rollout status deployment --namespace cert-manager cert-manager --timeout 30s
|
||||||
|
./cmctl check api --wait 2m
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[dev-env] running helm chart e2e tests..."
|
echo "[dev-env] running helm chart e2e tests..."
|
||||||
docker run --rm --interactive --network host \
|
docker run \
|
||||||
--name ct \
|
--name ct \
|
||||||
--volume $KUBECONFIG:/root/.kube/config \
|
--volume "${KUBECONFIG}:/root/.kube/config:ro" \
|
||||||
--volume "${DIR}/../../":/workdir \
|
--volume "${DIR}/../../:/workdir" \
|
||||||
--workdir /workdir \
|
--network host \
|
||||||
registry.k8s.io/ingress-nginx/e2e-test-runner:v20240829-2c421762@sha256:5b7809bfe9cbd9cd6bcb8033ca27576ca704f05ce729fe4dcb574810f7a25785 \
|
--workdir /workdir \
|
||||||
ct install \
|
--entrypoint ct \
|
||||||
--charts charts/ingress-nginx \
|
--rm \
|
||||||
--helm-extra-args "--timeout 60s"
|
registry.k8s.io/ingress-nginx/e2e-test-runner:v20240829-2c421762@sha256:5b7809bfe9cbd9cd6bcb8033ca27576ca704f05ce729fe4dcb574810f7a25785 \
|
||||||
|
install \
|
||||||
|
--charts charts/ingress-nginx \
|
||||||
|
--helm-extra-args "--timeout 60s"
|
||||||
|
|
Loading…
Reference in a new issue