Skip to content

feat: add kubernetes ingress and gateway controllers #1758

feat: add kubernetes ingress and gateway controllers

feat: add kubernetes ingress and gateway controllers #1758

Workflow file for this run

on:
push:
branches:
- main
- v1.0.x
- v1.1.x
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+'
pull_request:
branches:
- main
- v1.0.x
- v1.1.x
name: CI Tests
concurrency:
group: ci-build-tests-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- run: |
make check-codegen
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.13.1
args: --timeout 5m
only-new-issues: true
docker:
runs-on: ubuntu-latest
steps:
- name: Get Build Date
id: builddate
run: |
echo "builddate=$(date -u +%Y-%m-%dT%H:%M:%SZ)" | tee $GITHUB_OUTPUT
- uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: build image
run: |
docker buildx build \
--label "org.opencontainers.image.revision=${{ github.sha }}" \
--label "org.opencontainers.image.source=https://github.com/${{ github.repository }}" \
--label "org.opencontainers.image.created=${{ steps.builddate.outputs.builddate }}" \
--platform linux/amd64 \
-f ./Dockerfile .
# the release targets select the binary and base image by platform;
# confirm each platform's image reports the architecture it advertises
- name: verify release image platforms
run: |
make docker-release IMAGE_TAG=ci
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go: [1.26]
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Install python dependencies
run: python -m pip install --upgrade pip setuptools wheel
- name: installing codespell
run: pip install codespell
- name: running codespell
run: codespell --skip="vendor,*.git,*.png,*.pdf,*.tiff,*.plist,*.pem,rangesim*.go,*.gz,go.mod,go.sum" --ignore-words="./testdata/ignore_words.txt"
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- uses: actions/checkout@v6
- name: Get dependencies
run: |
go mod download
- name: govulncheck
continue-on-error: true
run: go tool govulncheck ./...
- run: go mod vendor
- name: Run tests
run: make test
- name: Check coverage floor
run: |
COVERAGE=$(go tool cover -func=.coverprofile | tail -1 | awk '{print $3}' | tr -d '%')
echo "Total coverage: ${COVERAGE}%"
if (( $(echo "$COVERAGE < 50" | bc -l) )); then
echo "::error::Coverage ${COVERAGE}% is below 50% minimum"
exit 1
fi
- name: Run tests (with race detection enabled)
run: |
echo "::group::Race Detection Tests"
make data-race-test
echo "::endgroup::"
make data-race-test-inspect
- run: go build -o /dev/null ./cmd/trickster
- name: Send coverage
if: github.repository_owner == 'trickstercache' # Skip for forked repositories
uses: shogo82148/actions-goveralls@v1
# publishing to coveralls should not fail; and if it does, it should not block the CI process.
# Likely coveralls maintenance: https://status.coveralls.io/
# TODO: publish PR comment if coveralls publish fails
continue-on-error: true
with:
path-to-profile: .coverprofile
flag-name: unit-Go-${{ matrix.go }}
parallel: true
integration:
runs-on: ubuntu-latest
env:
TRICKSTER_MYSQL_CLI_TEST: "1"
TRICKSTER_DNS_TEST: "1"
# CI containers cannot raise the UDP receive buffer; the warning is noise
QUIC_GO_DISABLE_RECEIVE_BUFFER_WARNING: "1"
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Start developer environment (with integration containers)
run: make integration-start
- name: Show container status
if: always()
run: |
cd docs/developer/environment
docker compose ps
docker compose logs --tail=30 redis prometheus mysql grafana coredns
docker compose logs --tail=60 graphite graphite_seed graphite_generator
- name: Run integration tests (with coverage)
run: make integration-cover
- name: Run integration tests (with race detection enabled)
run: make -C integration data-race-test
- name: Send integration coverage
if: github.repository_owner == 'trickstercache'
uses: shogo82148/actions-goveralls@v1
continue-on-error: true
with:
path-to-profile: integration/.integration.coverprofile
flag-name: integration
parallel: true
integration-kind:
# Kubernetes scenarios in a kind cluster: autodiscovery over
# EndpointSlices, the Ingress and Gateway API controllers, and the
# Gateway API conformance suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Create kind cluster
uses: helm/kind-action@v1
with:
config: integration/kind/kind-config.yaml
cluster_name: trickster-it
- name: Build and load trickster image
run: |
docker build -t trickster:integration .
kind load docker-image trickster:integration --name trickster-it
- name: Deploy scenario manifests
run: |
kubectl --context kind-trickster-it apply -f integration/kind/manifests.yaml
kubectl --context kind-trickster-it -n trickster-it rollout status deployment/webecho deployment/trickster --timeout=180s
- name: Run kubernetes autodiscovery scenario
working-directory: integration
env:
TRICKSTER_KIND_TEST: "1"
run: go test -v -timeout 15m -run TestALBDiscoveryKind .
- name: Deploy kubernetes controller manifests
run: make kind-integration-ingress
- name: Run kubernetes controller endpoint-mode scenario
working-directory: integration
env:
TRICKSTER_KIND_TEST: "1"
run: go test -v -timeout 15m -run TestIngressEndpointModeKind .
- name: Run kubernetes cache policy scenario
working-directory: integration
env:
TRICKSTER_KIND_TEST: "1"
run: go test -v -timeout 15m -run TestCachePolicyKind .
- name: Deploy kubernetes gateway manifests
run: make kind-integration-gateway
- name: Run kubernetes gateway, ingress and upgrade scenarios
working-directory: integration
env:
TRICKSTER_KIND_TEST: "1"
run: go test -v -timeout 20m -run 'TestIngressKind|TestGatewayKind|TestIngressAnnotationsKind|TestGatewayRollingUpgradeKind' .
- name: Run Gateway API conformance suite
run: make kind-conformance CONFORMANCE_REPORT=integration/conformance/reports/ci.yaml
- name: Upload Gateway API conformance report
if: always()
uses: actions/upload-artifact@v4
with:
name: gateway-api-conformance-report
path: integration/conformance/reports/ci.yaml
if-no-files-found: ignore
- name: Show cluster state on failure
if: failure()
run: |
kubectl --context kind-trickster-it -n trickster-it get pods -o wide || true
kubectl --context kind-trickster-it -n trickster-it describe deployment trickster webecho trickster-ingress-endpoint trickster-ingress prometheus trickster-gateway || true
kubectl --context kind-trickster-it -n trickster-it describe trickstercachepolicies || true
kubectl --context kind-trickster-it get gatewayclass -o yaml || true
kubectl --context kind-trickster-it get gateway,httproute -A || true
kubectl --context kind-trickster-it -n trickster-it logs deployment/trickster --tail=100 || true
kubectl --context kind-trickster-it -n trickster-it logs deployment/trickster-ingress-endpoint --tail=100 || true
kubectl --context kind-trickster-it -n trickster-it logs deployment/trickster-ingress --tail=100 || true
kubectl --context kind-trickster-it -n trickster-it logs deployment/trickster-gateway --tail=200 || true
finish:
needs:
- build
- integration
runs-on: ubuntu-latest
steps:
- uses: shogo82148/actions-goveralls@v1
if: github.repository_owner == 'trickstercache' # Skip for forked repositories
continue-on-error: true
with:
parallel-finished: true