Skip to content

Commit

Permalink
Merge branch 'main' into release/kong-3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
rainest committed Jun 17, 2024
2 parents 041b8d0 + 4d444b9 commit 5b969de
Show file tree
Hide file tree
Showing 97 changed files with 78,954 additions and 1,267 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
charts/kong/ci/__snapshots__/*.snap linguist-generated=true
charts/ingress/ci/__snapshots__/*.snap linguist-generated=true
1 change: 1 addition & 0 deletions .github/workflows/master-mirrors-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
push-master:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down
86 changes: 54 additions & 32 deletions .github/workflows/release-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ on:
branches:
- main
- release/*
- prepare-kgo-chart

env:
# Specify this here because these tests rely on ktf to run kind for cluster creation.
KIND_VERSION: v0.23.0

jobs:
lint:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -30,25 +36,22 @@ jobs:
run: make lint

lint-test:
timeout-minutes: 30
runs-on: ubuntu-latest
env:
# Specify this here because these tests rely on ktf to run kind for cluster creation.
KIND_VERSION: v0.20.0
strategy:
matrix:
chart-name:
- kong
- ingress
- gateway-operator
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.11.0
uses: azure/[email protected]

- name: Add Helm repos
run: |
Expand All @@ -63,47 +66,46 @@ jobs:
uses: helm/[email protected]

- name: Run chart-testing (lint)
run: ct lint --check-version-increment=false
run: ct lint --target-branch main --check-version-increment=false

- name: setup testing environment (kind-cluster)
env:
KUBERNETES_VERSION: ${{ matrix.kubernetes-version }}
CHART_NAME: ${{ matrix.chart-name }}
run: ./scripts/test-env.sh

- name: Run chart-testing (install)
run: ct install --charts charts/${{ matrix.chart-name}}
run: ct install --target-branch main --charts charts/${{ matrix.chart-name}}

integration-test:
timeout-minutes: 30
runs-on: ubuntu-latest
env:
# Specify this here because these tests rely on ktf to run kind for cluster creation.
KIND_VERSION: v0.20.0
GATEWAY_API_VERSION: v0.8.1
GATEWAY_API_VERSION: v1.0.0
strategy:
matrix:
kubernetes-version:
- "1.23.13"
- "1.24.7"
- "1.25.9"
- "1.26.4"
- "1.27.1"
- "1.25.16"
- "1.26.15"
- "1.27.13"
- "1.28.9"
- "1.29.4"
- "1.30.0"
chart-name:
- kong
- ingress
- gateway-operator
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: setup helm
uses: azure/setup-helm@v3
with:
version: v3.11.0
uses: azure/[email protected]

- name: setup testing environment (kind-cluster)
env:
KUBERNETES_VERSION: ${{ matrix.kubernetes-version }}
CHART_NAME: ${{ matrix.chart-name }}
run: ./scripts/test-env.sh

- name: run integration tests (integration)
Expand All @@ -119,34 +121,31 @@ jobs:
- name: cleanup integration tests (cleanup)
run: ./scripts/test-env.sh cleanup
oldversion-integration-test:
timeout-minutes: 30
runs-on: ubuntu-latest
env:
# Specify this here because these tests rely on ktf to run kind for cluster creation.
KIND_VERSION: v0.20.0
GATEWAY_API_VERSION: v0.8.1
strategy:
matrix:
kic-version:
- "2.10"
- "2.11"
- "2.10"
- "2.11"
kong-version:
- "3.3"
- "3.2"
- "3.3"
- "3.2"
chart-name:
- kong
- ingress
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: setup helm
uses: azure/setup-helm@v3
with:
version: v3.11.0
uses: azure/[email protected]

- name: setup testing environment (kind-cluster)
env:
CHART_NAME: ${{ matrix.chart-name }}
run: ./scripts/test-env.sh

- name: run integration tests (integration)
Expand All @@ -159,15 +158,38 @@ jobs:
- name: cleanup integration tests (cleanup)
run: ./scripts/test-env.sh cleanup

golden-tests:
timeout-minutes: 30
runs-on: ubuntu-latest
name: golden-tests
steps:
- name: checkout
uses: actions/checkout@v4

- name: setup helm
uses: azure/[email protected]

- name: build helm chart dependency
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add kong https://charts.konghq.com
helm dependency build charts/kong
helm dependency build charts/ingress
- name: run golden tests
run: make test.golden

# Workaround to allow checking the matrix tests as required tests without adding the individual cases
# Ref: https://github.com/orgs/community/discussions/26822#discussioncomment-3305794
passed:
timeout-minutes: 30
runs-on: ubuntu-latest
needs:
- lint
- lint-test
- integration-test
- oldversion-integration-test
- golden-tests
if: always()
steps:
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/release-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ on:

jobs:
lint-test:
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
matrix:
chart-name:
- kong
- ingress
- gateway-operator
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.11.0
uses: azure/[email protected]

- uses: actions/setup-python@v5
with:
Expand All @@ -38,14 +38,16 @@ jobs:
helm repo add kong https://charts.konghq.com
- name: Run chart-testing (lint)
run: ct lint --charts ${{ matrix.chart-name }}
run: ct lint --target-branch main --charts ${{ matrix.chart-name }}
working-directory: charts

- name: setup testing environment (kind-cluster)
env:
CHART_NAME: ${{ matrix.chart-name }}
run: ./scripts/test-env.sh

- name: run chart-testing (install)
run: ct install --charts ${{ matrix.chart-name }}
run: ct install --target-branch main --charts ${{ matrix.chart-name }}
working-directory: charts
if: matrix.chart-name == 'kong'

Expand All @@ -57,14 +59,14 @@ jobs:
- name: cleanup integration tests (cleanup)
run: ./scripts/test-env.sh cleanup
release:
timeout-minutes: 30
needs: lint-test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Fetch history
run: git fetch --prune --unshallow
with:
fetch-depth: 0

- name: Configure Git
run: |
Expand All @@ -73,9 +75,7 @@ jobs:
# See https://github.com/helm/chart-releaser-action/issues/6
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.11.0
uses: azure/[email protected]

- name: Add dependency chart repos
run: |
Expand Down
40 changes: 39 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
CHARTSNAP_VERSION ?= v0.3.1

.PHONY: _download_tool
_download_tool:
(cd third_party && go mod tidy && \
GOBIN=$(PROJECT_DIR)/bin go generate -tags=third_party ./$(TOOL).go )

.PHONY: tools
tools: kube-linter
tools: kube-linter chartsnap

KUBE_LINTER = $(PROJECT_DIR)/bin/kube-linter
.PHONY: kube-linter
kube-linter:
@$(MAKE) _download_tool TOOL=kube-linter

.PHONY: chartsnap
chartsnap:
./scripts/install-chartsnap.sh

.PHONY: lint
lint: tools lint.charts.kong lint.shellcheck

Expand All @@ -22,3 +27,36 @@ lint.charts.kong:

lint.shellcheck:
shellcheck ./scripts/*

.PHONY: test.golden
test.golden:
@ $(MAKE) _chartsnap.kong && $(MAKE) _chartsnap.ingress || \
(echo "$$GOLDEN_TEST_FAILURE_MSG" && exit 1)

.PHONY: test.golden.update
test.golden.update:
@ $(MAKE) _chartsnap.kong CHARTSNAP_ARGS="-u"
@ $(MAKE) _chartsnap.ingress CHARTSNAP_ARGS="-u"

# Defining multi-line strings to echo: https://stackoverflow.com/a/649462/7958339
define GOLDEN_TEST_FAILURE_MSG
>> Golden tests have failed.
>> Please run 'make test.golden.update' to update golden files and commit the changes if they're expected.
endef
export GOLDEN_TEST_FAILURE_MSG

.PHONY: _chartsnap.kong
_chartsnap.kong:
@ $(MAKE) _chartsnap GOLDEN_TEST_CHART=kong GOLDEN_TEST_CHART_VALUES_DIR=./charts/kong/ci/ \
CHARTSNAP_ARGS=$(CHARTSNAP_ARGS)

.PHONY: _chartsnap.ingress
_chartsnap.ingress:
@ $(MAKE) _chartsnap GOLDEN_TEST_CHART=ingress GOLDEN_TEST_CHART_VALUES_DIR=./charts/ingress/ci/ \
CHARTSNAP_ARGS=$(CHARTSNAP_ARGS)

.PHONY: _chartsnap
_chartsnap: chartsnap
@ helm repo update
@ helm dependencies update charts/ingress
@ helm chartsnap -c ./charts/$(GOLDEN_TEST_CHART) -f $(GOLDEN_TEST_CHART_VALUES_DIR) $(CHARTSNAP_ARGS)
23 changes: 23 additions & 0 deletions charts/gateway-operator/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
Loading

0 comments on commit 5b969de

Please sign in to comment.