Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] Support endpoint slices #1608

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
791fbe9
feat: add --use-endpoint-slices option to root cli command
Jul 29, 2021
e6742fa
chore: fix typo in comment
Jul 29, 2021
3f7f5af
feat: added functions for endpointslice and updated interfaces
Jul 30, 2021
504f09c
feat: added check to ensure compatibility with k8s version
Jul 30, 2021
8dc375d
feat: pass useEndpointSlices cli value
Jul 30, 2021
25e4fef
feat: refactored parser function
Jul 30, 2021
768689a
feat: add unit tests for parser functions
Jul 30, 2021
c4ad2d9
chore: slight refactor of parser methods
Jul 30, 2021
f56d00e
chore: clean up coverage (#1611)
shaneutt Jul 30, 2021
6042cfd
fix: update defaults for backend timeout to 10s (#1610)
shaneutt Jul 30, 2021
f579349
fix: dont process status for missing objs
shaneutt Jul 30, 2021
e135f44
Merge pull request #1620 from Kong/stop-status-updates-on-404
ccfish2 Jul 30, 2021
55f02b6
feat: added new unit test for checking k8s version
Jul 30, 2021
6b1e54b
chore: fixed linting
Jul 30, 2021
2c02657
chore: refactor validation logic for k8s
Jul 30, 2021
591994b
feat: add integration test for using endpoint slices
Jul 30, 2021
b4b8165
chore: seperate latest k8s release tests (#1621)
shaneutt Jul 30, 2021
2164709
fix: use requires more in webhook tests
shaneutt Jul 30, 2021
6b4ba21
fix: bulk test now periodically cleans up
shaneutt Jul 30, 2021
3a685e5
fix: ingress tests use their own namespaces
shaneutt Jul 30, 2021
4cd0cfb
fix: temp disable webhook tests on non-kind clusters
shaneutt Jul 30, 2021
3dbf48c
fix: temp disable knative tests on non-kind clusters
shaneutt Jul 30, 2021
4499d2d
chore: update ktf to v0.3.3
shaneutt Jul 30, 2021
20faaad
feat: add support to load gke clusters into test suite
shaneutt Jul 30, 2021
8a71a3f
feat: use gke for release testing
shaneutt Jul 30, 2021
3b6a548
fix: remove proxy cache backpressure system
shaneutt Jul 30, 2021
be502c5
fix: remove tests for removed behavior
shaneutt Jul 30, 2021
af1b078
fix: proxy req timeout inherit
shaneutt Jul 30, 2021
55bf923
feat: added additional pre-checks
Jul 31, 2021
eeb938c
feat: added endpoint slice to controller
Jul 31, 2021
9eeda33
feat: added endpoint slices to integration tests
Jul 31, 2021
431241e
bug: refactor kubernetes version check logic
Jul 31, 2021
b8dbe66
chore: refactor methods for endpoint slices
Jul 31, 2021
ab0e2b7
feat: added fake objects and testing for endpoint slices
Jul 31, 2021
010a3c0
feat: add --use-endpoint-slices option to root cli command
Jul 29, 2021
623de02
chore: fix typo in comment
Jul 29, 2021
2aa2c18
feat: added functions for endpointslice and updated interfaces
Jul 30, 2021
f246c4e
feat: added check to ensure compatibility with k8s version
Jul 30, 2021
120b8dc
feat: pass useEndpointSlices cli value
Jul 30, 2021
553946c
feat: refactored parser function
Jul 30, 2021
49f8144
feat: add unit tests for parser functions
Jul 30, 2021
6e72f04
chore: slight refactor of parser methods
Jul 30, 2021
b1da370
feat: added new unit test for checking k8s version
Jul 30, 2021
7c78075
chore: fixed linting
Jul 30, 2021
61615bd
chore: refactor validation logic for k8s
Jul 30, 2021
f6fde03
feat: add integration test for using endpoint slices
Jul 30, 2021
c276d25
feat: added additional pre-checks
Jul 31, 2021
647df76
feat: added endpoint slice to controller
Jul 31, 2021
2db42ae
feat: added endpoint slices to integration tests
Jul 31, 2021
e69a569
bug: refactor kubernetes version check logic
Jul 31, 2021
3a982ae
chore: refactor methods for endpoint slices
Jul 31, 2021
1665a0e
feat: added fake objects and testing for endpoint slices
Jul 31, 2021
7e8a899
feat: start either endpoint or endpoint slice controller
Jul 31, 2021
6089a90
chore: rebase
Jul 31, 2021
092d019
chore: go mod tidy
Jul 31, 2021
374f958
chore: rebase
Jul 31, 2021
034039c
chore: refactor store and tests to support passing integration tests
Jul 31, 2021
8524a33
chore: refactor kubernetes validation logic
Jul 31, 2021
bd8928f
chore: refactor parser to centralize logic for endoint address extrac…
Jul 31, 2021
6bb9606
chore: fix linting
Jul 31, 2021
d12e8b7
chore: updated change log with fix
Jul 31, 2021
ce98883
fix: fixed typo and duplicate controller definition
Jul 31, 2021
f0f6e56
fix: remove hard-coded label lookup for endpoint slices
Aug 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 42 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# TODO: right now the release is not fully automated, but the tests below must pass before a release is made manually. See RELEASE.md for more information.
name: release

on:
Expand All @@ -7,13 +8,11 @@ on:
- 'next'

jobs:
kubernetes-version-tests:
test-current-kubernetes:
runs-on: ubuntu-latest
strategy:
matrix:
kubernetes-version:
- 'v1.19.11'
- 'v1.20.7'
- 'v1.21.2'
dbmode:
- 'dbless'
Expand All @@ -40,4 +39,43 @@ jobs:
- name: Kubernetes ${{ matrix.kubernetes_version }} ${{ matrix.dbmode }} Integration Tests
run: KONG_CLUSTER_VERSION=${{ matrix.kubernetes_version }} make test.integration.${{ matrix.dbmode }}

# TODO: right now the release is not fully automated, but the above tests must pass before a release is made manually. See RELEASE.md for more information.
test-previous-kubernetes:
environment: gcloud
runs-on: ubuntu-latest
strategy:
matrix:
minor:
- '19'
- '20'
dbmode:
- 'dbless'
- 'postgres'
steps:
- name: setup golang
uses: actions/setup-go@v2
with:
go-version: '^1.16'

- name: cache go modules
uses: actions/cache@v2.1.6
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-codegen-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-build-codegen-

- name: checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: test ${{ matrix.dbmode }} on GKE v1.${{ matrix.minor }}
run: ./hack/e2e/run.sh
env:
KUBERNETES_MAJOR_VERSION: 1
KUBERNETES_MINOR_VERSION: ${{ matrix.minor }}
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
GOOGLE_PROJECT: ${{ secrets.GOOGLE_PROJECT }}
GOOGLE_LOCATION: ${{ secrets.GOOGLE_LOCATION }}

# TODO: need kubernetes latest job (test against v1.20.7 and v1.21.2): https://github.com/Kong/kubernetes-ingress-controller/issues/1616
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,14 @@
[#1563](https://github.com/Kong/kubernetes-ingress-controller/pull/1563)
- Added support for --dump-config to 2.x.
[#1589](https://github.com/Kong/kubernetes-ingress-controller/pull/1589)
- Added support for --use-endpoint-slices to 2.x.
[#1608](https://github.com/Kong/kubernetes-ingress-controller/pull/1608)

#### Fixed

- Increased the default timeout strategy for backend proxy HTTP requests
from 3 seconds to 10 seconds.
[#1610](https://github.com/Kong/kubernetes-ingress-controller/pull/1610)
- Corrected the old Ingress v1beta1 API group.
[#1584](https://github.com/Kong/kubernetes-ingress-controller/pull/1584)

Expand Down
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,8 @@ container:
# Test
# ------------------------------------------------------------------------------

PKG_LIST = ./...
PKG_LIST = ./pkg/...,./internal/...
COVERAGE_PROFILE=coverage.out
COVERAGE_INTEGRATION_PROFILE=coverage-integration.out
KIND_CLUSTER_NAME ?= "integration-tests"

.PHONY: test.all
Expand All @@ -177,14 +176,14 @@ test.integration.legacy: container
.PHONY: test.integration.dbless
test.integration.dbless:
@./scripts/check-container-environment.sh
@TEST_DATABASE_MODE="off" GOFLAGS="-tags=integration_tests" go test -timeout 15m -race -v -count=1 -covermode=atomic -coverpkg=$(PKG_LIST) -coverprofile=$(COVERAGE_INTEGRATION_PROFILE) ./test/integration/
@TEST_DATABASE_MODE="off" USE_ENDPOINT_SLICES="true" GOFLAGS="-tags=integration_tests" go test -timeout 15m -race -v -count=1 -covermode=atomic -coverpkg=$(PKG_LIST) -coverprofile=$(COVERAGE_PROFILE) ./...

# TODO: race checking has been temporarily turned off because of race conditions found with deck. This will be resolved in an upcoming Alpha release of KIC 2.0.
# See: https://github.com/Kong/kubernetes-ingress-controller/issues/1324
.PHONY: test.integration.postgres
test.integration.postgres:
@./scripts/check-container-environment.sh
@TEST_DATABASE_MODE="postgres" GOFLAGS="-tags=integration_tests" go test -timeout 15m -v -count=1 -covermode=atomic -coverpkg=$(PKG_LIST) -coverprofile=$(COVERAGE_INTEGRATION_PROFILE) ./test/integration/
@TEST_DATABASE_MODE="postgres" GOFLAGS="-tags=integration_tests" go test -timeout 15m -v -count=1 -covermode=atomic -coverpkg=$(PKG_LIST) -coverprofile=$(COVERAGE_PROFILE) ./...

# ------------------------------------------------------------------------------
# Operations
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/huandu/xstrings v1.3.2 // indirect
github.com/kong/deck v1.7.0
github.com/kong/go-kong v0.20.0
github.com/kong/kubernetes-testing-framework v0.2.2
github.com/kong/kubernetes-testing-framework v0.3.3
github.com/lithammer/dedent v1.1.0
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.4.1
Expand Down
26 changes: 21 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmW
cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg=
cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8=
cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0=
cloud.google.com/go v0.83.0 h1:bAMqZidYkmIsUqe6PtkEPT7Q+vfizScn+jfNA6jwK9c=
cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY=
cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM=
cloud.google.com/go v0.88.0 h1:MZ2cf9Elnv1wqccq8ooKO2MqHQLc+ChCp/+QWObCpxg=
cloud.google.com/go v0.88.0/go.mod h1:dnKwfYbP9hQhefiUvpbcAyoGSHUrOxR20JVElLiUvEY=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
Expand Down Expand Up @@ -466,6 +468,7 @@ github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
Expand Down Expand Up @@ -539,6 +542,7 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210715191844-86eeefc3e471/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
Expand Down Expand Up @@ -669,8 +673,8 @@ github.com/kong/deck v1.7.0/go.mod h1:o2letQaSpXVnDNoXehEibOF6q7v46qtbsKOCC+1owA
github.com/kong/go-kong v0.19.0/go.mod h1:HyNtOxzh/tzmOV//ccO5NAdmrCnq8b86YUPjmdy5aog=
github.com/kong/go-kong v0.20.0 h1:KiPsJORNs9UbjU8m1Tr3MZkIiKkzcVHIz0EYeT7SD3c=
github.com/kong/go-kong v0.20.0/go.mod h1:eQP22bzJVeiEH77hYdWD019WjecJFVFHm77kPXquC28=
github.com/kong/kubernetes-testing-framework v0.2.2 h1:gRfM85kOf8kXcpio5AA+X164DAbjVFzx2FMk/F05Yu0=
github.com/kong/kubernetes-testing-framework v0.2.2/go.mod h1:Cn5+MjhyRwN2J0Iyk7/Rdwt+1UlF+aN3oJ+ygrxeKZc=
github.com/kong/kubernetes-testing-framework v0.3.3 h1:UgWjsApvxD/86DnwLQnr6OIk/sgDi+C2lcgFEFw7Buk=
github.com/kong/kubernetes-testing-framework v0.3.3/go.mod h1:O9ARzRPAnEBURREH4fiGmCBhEUxj3HRIyUEjR9eYIVU=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
Expand Down Expand Up @@ -1206,8 +1210,9 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ
golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c h1:pkQiBZBvdos9qq4wBAHqlzuZHEXo07pqV06ef90u1WI=
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 h1:3B43BWw0xEBsLZ/NO1VALz6fppU3481pik+2Ksv45z8=
golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down Expand Up @@ -1314,6 +1319,7 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
Expand Down Expand Up @@ -1407,6 +1413,8 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down Expand Up @@ -1449,8 +1457,11 @@ google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjR
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8=
google.golang.org/api v0.47.0 h1:sQLWZQvP6jPGIP4JGPkJu4zHswrv81iobiyszr3b/0I=
google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo=
google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4=
google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw=
google.golang.org/api v0.52.0 h1:m5FLEd6dp5CU1F0tMWyqDi2XjchviIz8ntzOSz7w8As=
google.golang.org/api v0.52.0/go.mod h1:Him/adpjt0sxtkWViy0b6xyKW/SD71CwdJ7HqJo7SrU=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
Expand Down Expand Up @@ -1511,6 +1522,11 @@ google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaE
google.golang.org/genproto v0.0.0-20210416161957-9910b6c460de/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A=
google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A=
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24=
google.golang.org/genproto v0.0.0-20210721163202-f1cecdd8b78a/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
google.golang.org/genproto v0.0.0-20210722135532-667f2b7c528f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
google.golang.org/genproto v0.0.0-20210726200206-e7812ac95cc0 h1:VpRFBmFg/ol+rqJnkKLPjVebPNFbSxuj17B7bH1xMc8=
google.golang.org/genproto v0.0.0-20210726200206-e7812ac95cc0/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
Expand Down
94 changes: 94 additions & 0 deletions hack/e2e/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package main

// TODO: this is temporary: it was created for speed but will be replaced
// by upstream functionality in KTF.
// See: https://github.com/Kong/kubernetes-testing-framework/issues/61

import (
"context"
"fmt"
"os"
"strconv"

"github.com/kong/kubernetes-testing-framework/pkg/clusters"
"github.com/kong/kubernetes-testing-framework/pkg/clusters/types/gke"
)

const (
k8sNameVar = "KUBERNETES_CLUSTER_NAME"
k8sMajorVar = "KUBERNETES_MAJOR_VERSION"
k8sMinorVar = "KUBERNETES_MINOR_VERSION"
)

var (
ctx = context.Background()
cluster clusters.Cluster

gkeCreds = os.Getenv(gke.GKECredsVar)
gkeProject = os.Getenv(gke.GKEProjectVar)
gkeLocation = os.Getenv(gke.GKELocationVar)
k8sName = os.Getenv(k8sNameVar)
k8sMajor = os.Getenv(k8sMajorVar)
k8sMinor = os.Getenv(k8sMinorVar)
)

func main() {
fmt.Println("INFO: configuring GKE cloud environment for tests")
mustNotBeEmpty(gke.GKECredsVar, gkeCreds)
mustNotBeEmpty(gke.GKEProjectVar, gkeProject)
mustNotBeEmpty(gke.GKELocationVar, gkeLocation)
mustNotBeEmpty(k8sNameVar, k8sName)
mustNotBeEmpty(k8sMajorVar, k8sMajor)
mustNotBeEmpty(k8sMinorVar, k8sMinor)

fmt.Println("INFO: validating cluster version requirements")
major, err := strconv.Atoi(k8sMajor)
mustNotError(err)
minor, err := strconv.Atoi(k8sMinor)
mustNotError(err)

if len(os.Args) > 1 && os.Args[1] == "cleanup" {
fmt.Printf("INFO: cleanup called, deleting GKE cluster %s\n", k8sName)
cluster, err := gke.NewFromExistingWithEnv(ctx, k8sName)
mustNotError(err)
mustNotError(cluster.Cleanup(ctx))
fmt.Printf("INFO: GKE cluster %s successfully cleaned up\n", k8sName)
os.Exit(0)
}

fmt.Printf("INFO: configuring the GKE cluster NAME=(%s) VERSION=(v%d.%d) PROJECT=(%s) LOCATION=(%s)\n", k8sName, major, minor, gkeProject, gkeLocation)
builder := gke.NewBuilder([]byte(gkeCreds), gkeProject, gkeLocation).WithName(k8sName)
builder.WithClusterMinorVersion(uint64(major), uint64(minor))

fmt.Printf("INFO: building cluster %s (this can take some time)\n", builder.Name)
cluster, err = builder.Build(ctx)
mustNotError(err)

fmt.Println("INFO: verifying that the cluster can be communicated with")
version, err := cluster.Client().ServerVersion()
mustNotError(err)

fmt.Printf("INFO: server version found: %s\n", version)
}

func mustNotBeEmpty(name, value string) {
if value == "" {
if cluster != nil {
if err := cluster.Cleanup(ctx); err != nil {
panic(fmt.Sprintf("%s was empty, and then cleanup failed: %s", name, err))
}
}
panic(fmt.Sprintf("%s was empty", name))
}
}

func mustNotError(err error) {
if err != nil {
if cluster != nil {
if cleanupErr := cluster.Cleanup(ctx); cleanupErr != nil {
panic(fmt.Sprintf("deployment failed with %s, and then cleanup failed: %s", err, cleanupErr))
}
}
panic(fmt.Errorf("failed to deploy e2e environment: %w", err))
}
}
22 changes: 22 additions & 0 deletions hack/e2e/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# TODO: for now our e2e tests are effectively just our integration tests run
# against a conformant, production grade cluster. In the future we will
# add a dedicated e2e test suite.
#
# See: https://github.com/Kong/kubernetes-ingress-controller/issues/1605

set -euo pipefail

WORKDIR="$(dirname "${BASH_SOURCE}")/../.."
cd "${WORKDIR}"

CLUSTER_NAME="e2e-$(uuidgen)"
KUBERNETES_CLUSTER_NAME="${CLUSTER_NAME}" go run hack/e2e/main.go

function cleanup() {
KUBERNETES_CLUSTER_NAME="${CLUSTER_NAME}" go run hack/e2e/main.go cleanup
}
trap cleanup EXIT SIGINT SIGQUIT

GOFLAGS="-tags=integration_tests" KONG_TEST_CLUSTER="gke:${CLUSTER_NAME}" go test -count 1 -timeout 45m -v ./test/integration/...
23 changes: 18 additions & 5 deletions hack/generators/controllers/networking/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ import (
const (
outputFile = "../../internal/controllers/configuration/zz_generated_controllers.go"

corev1 = "k8s.io/api/core/v1"
netv1 = "k8s.io/api/networking/v1"
netv1beta1 = "k8s.io/api/networking/v1beta1"
extv1beta1 = "k8s.io/api/extensions/v1beta1"
corev1 = "k8s.io/api/core/v1"
discoveryv1 = "k8s.io/api/discovery/v1"
netv1 = "k8s.io/api/networking/v1"
netv1beta1 = "k8s.io/api/networking/v1beta1"
extv1beta1 = "k8s.io/api/extensions/v1beta1"

kongv1 = "github.com/kong/kubernetes-ingress-controller/pkg/apis/configuration/v1"
kongv1beta1 = "github.com/kong/kubernetes-ingress-controller/api/configuration/v1beta1"
Expand All @@ -30,7 +31,7 @@ const (
// inputControllersNeeded is a list of the supported Types for the
// Kong Kubernetes Ingress Controller. If you need to add a new type
// for support, add it here and a new controller will be generated
// when you run `make controllers`.
// when you run `make generate.controllers`.
var inputControllersNeeded = &typesNeeded{
typeNeeded{
PackageImportAlias: "corev1",
Expand All @@ -56,6 +57,18 @@ var inputControllersNeeded = &typesNeeded{
AcceptsIngressClassNameSpec: false,
RBACVerbs: []string{"list", "watch"},
},
typeNeeded{
PackageImportAlias: "discoveryv1",
PackageAlias: "DiscoveryV1",
Package: discoveryv1,
Type: "EndpointSlice",
Plural: "endpointslices",
URL: "\"\"",
CacheType: "EndpointSlice",
AcceptsIngressClassNameAnnotation: false,
AcceptsIngressClassNameSpec: false,
RBACVerbs: []string{"list", "watch"},
},
typeNeeded{
PackageImportAlias: "corev1",
PackageAlias: "CoreV1",
Expand Down
Loading