Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 20f9258

Browse files
authored
Merge pull request #110 from JoshVanL/e2e-ginko
Creates proper e2e testing suite
2 parents 48dbebe + 45d1c33 commit 20f9258

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2706
-1679
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
*
2-
!kube-oidc-proxy
2+
!/bin/kube-oidc-proxy

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Copyright Jetstack Ltd. See LICENSE for details.
2-
FROM alpine:3.9
2+
FROM alpine:3.10
3+
LABEL description="OIDC reverse proxy authenticator based on Kubernetes"
34

45
RUN apk --no-cache --update add ca-certificates
56

6-
COPY kube-oidc-proxy /usr/bin/
7+
COPY ./bin/kube-oidc-proxy /usr/bin/kube-oidc-proxy
78

89
CMD ["/usr/bin/kube-oidc-proxy"]

Makefile

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,17 @@ go_fmt:
6565
fi
6666

6767
go_vet:
68-
go vet
68+
go vet ./cmd
6969

7070
go_lint: $(BINDIR)/golangci-lint ## lint golang code for problems
7171
$(BINDIR)/golangci-lint run
7272

7373
clean: ## clean up created files
7474
rm -rf \
7575
$(BINDIR) \
76-
kube-oidc-proxy \
77-
pkg/mocks/authenticator.go
76+
pkg/mocks/authenticator.go \
77+
demo/bin \
78+
test/e2e/framework/issuer/bin
7879

7980
verify: depend verify_boilerplate go_fmt go_vet go_lint ## verify code and mod
8081

@@ -84,29 +85,21 @@ generate: depend ## generates mocks and assets files
8485
test: generate verify ## run all go tests
8586
go test $$(go list ./pkg/... ./cmd/... | grep -v pkg/e2e)
8687

87-
e2e: e2e-1.15 ## run end to end tests
88-
89-
e2e-1.15: build ## run end to end tests for kubernetes version 1.15
90-
KUBE_OIDC_PROXY_NODE_IMAGE=1.15.0 go test ./pkg/e2e/. -v --count=1
91-
92-
e2e-1.14: build ## run end to end tests for kubernetes version 1.14
93-
KUBE_OIDC_PROXY_NODE_IMAGE=1.14.3 go test ./pkg/e2e/. -v --count=1
94-
95-
e2e-1.13: build ## run end to end tests for kubernetes version 1.13
96-
KUBE_OIDC_PROXY_NODE_IMAGE=1.13.7 go test ./pkg/e2e/. -v --count=1
97-
98-
e2e-1.12: build ## run end to end tests for kubernetes version 1.12
99-
KUBE_OIDC_PROXY_NODE_IMAGE=1.12.8 go test ./pkg/e2e/. -v --count=1
100-
101-
e2e-1.11: build ## run end to end tests for kubernetes version 1.11
102-
KUBE_OIDC_PROXY_NODE_IMAGE=1.11.10 go test ./pkg/e2e/. -v --count=1
88+
e2e: ## run end to end tests
89+
KUBE_OIDC_PROXY_ROOT_PATH="$$(pwd)" go test -timeout 30m -v --count=1 ./test/e2e/suite/.
10390

10491
build: generate ## build kube-oidc-proxy
105-
CGO_ENABLED=0 go build -ldflags '-w $(shell hack/version-ldflags.sh)'
92+
CGO_ENABLED=0 go build -ldflags '-w $(shell hack/version-ldflags.sh)' -o ./bin/kube-oidc-proxy ./cmd/.
10693

10794
docker_build: generate test build ## build docker image
10895
docker build -t kube-oidc-proxy .
10996

11097
all: test build ## runs tests, build
11198

11299
image: all docker_build ## runs tests, build and docker build
100+
101+
dev_cluster_create: ## create dev cluster for development testing
102+
KUBE_OIDC_PROXY_ROOT_PATH="$$(pwd)" go run -v ./test/environment/dev create
103+
104+
dev_cluster_destroy: ## destroy dev cluster
105+
KUBE_OIDC_PROXY_ROOT_PATH="$$(pwd)" go run -v ./test/environment/dev destroy
File renamed without changes.

cmd/options/kube_oidc_proxy.go renamed to cmd/app/options/kube_oidc_proxy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ type KubeOIDCProxyOptions struct {
1818
func (t *TokenPassthroughOptions) AddFlags(fs *pflag.FlagSet) {
1919
fs.StringSliceVar(&t.Audiences, "token-passthrough-audiences", t.Audiences, ""+
2020
"(Alpha) List of the identifiers that the resource server presented with the token "+
21-
"identifies as. The resoure server will verify that non OIDC tokens are intended "+
21+
"identifies as. The resource server will verify that non OIDC tokens are intended "+
2222
"for at least one of the audiences in this list. If no audiences are "+
2323
"provided, the audience will default to the audience of the Kubernetes "+
24-
"apiserver.")
24+
"apiserver. Only used when --token-passthrough is also enabled.")
2525

2626
fs.BoolVar(&t.Enabled, "token-passthrough", t.Enabled, ""+
2727
"(Alpha) Requests with Bearer tokens that fail OIDC validation are tried against "+
File renamed without changes.

cmd/plugin.go renamed to cmd/app/options/plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright Jetstack Ltd. See LICENSE for details.
2-
package cmd
2+
package options
33

44
import (
55
// This package is required to be imported to register all client

cmd/run.go renamed to cmd/app/run.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright Jetstack Ltd. See LICENSE for details.
2-
package cmd
2+
package app
33

44
import (
55
"errors"
@@ -18,7 +18,7 @@ import (
1818
cliflag "k8s.io/component-base/cli/flag"
1919
"k8s.io/component-base/cli/globalflag"
2020

21-
"github.com/jetstack/kube-oidc-proxy/cmd/options"
21+
"github.com/jetstack/kube-oidc-proxy/cmd/app/options"
2222
"github.com/jetstack/kube-oidc-proxy/pkg/probe"
2323
"github.com/jetstack/kube-oidc-proxy/pkg/proxy"
2424
"github.com/jetstack/kube-oidc-proxy/pkg/proxy/tokenreview"

main.go renamed to cmd/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import (
55
"fmt"
66
"os"
77

8-
"github.com/jetstack/kube-oidc-proxy/cmd"
8+
"github.com/jetstack/kube-oidc-proxy/cmd/app"
99
"github.com/jetstack/kube-oidc-proxy/pkg/util"
1010
)
1111

1212
func main() {
1313
stopCh := util.SignalHandler()
14-
cmd := cmd.NewRunCommand(stopCh)
14+
cmd := app.NewRunCommand(stopCh)
1515

1616
if err := cmd.Execute(); err != nil {
1717
fmt.Fprintf(os.Stderr, "error: %v\n", err)

demo/yaml/kube-oidc-proxy.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,7 @@ rules:
135135
- "authentication.k8s.io"
136136
resources:
137137
- "userextras/scopes"
138+
- "tokenreviews"
138139
verbs:
140+
- "create"
139141
- "impersonate"

0 commit comments

Comments
 (0)