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

Commit d15cd62

Browse files
authored
Merge pull request #70 from JoshVanL/update-vendor-k8s-1.15
Update k8s to 1.15 and us go modules
2 parents c08b133 + d049462 commit d15cd62

File tree

36,702 files changed

+112841
-15451959
lines changed

Some content is hidden

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

36,702 files changed

+112841
-15451959
lines changed

Gopkg.lock

Lines changed: 0 additions & 1981 deletions
This file was deleted.

Gopkg.toml

Lines changed: 0 additions & 71 deletions
This file was deleted.

Makefile

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,15 @@ help: ## display this help
1111
UNAME_S := $(shell uname -s)
1212
ifeq ($(UNAME_S),Linux)
1313
SHASUM := sha256sum -c
14-
DEP_URL := https://github.com/golang/dep/releases/download/v0.5.1/dep-linux-amd64
15-
DEP_HASH := 7479cca72da0596bb3c23094d363ea32b7336daa5473fa785a2099be28ecd0e3
16-
KUBECTL_URL := https://storage.googleapis.com/kubernetes-release/release/v1.13.3/bin/linux/amd64/kubectl
17-
KUBECTL_HASH := f3be209a48394e0e649b30ea376ce5093205fd6769c12e62c7ab39a0827c26fb
14+
KUBECTL_URL := https://storage.googleapis.com/kubernetes-release/release/v1.15.0/bin/linux/amd64/kubectl
15+
KUBECTL_HASH := ecec7fe4ffa03018ff00f14e228442af5c2284e57771e4916b977c20ba4e5b39
1816
GOLANGCILINT_URL := https://github.com/golangci/golangci-lint/releases/download/v1.15.0/golangci-lint-1.15.0-linux-amd64.tar.gz
1917
GOLANGCILINT_HASH := f37f4a15eb309578b0546703da5ea96bc5bd472f45f204338051aaca6fbbfc5b
2018
endif
2119
ifeq ($(UNAME_S),Darwin)
2220
SHASUM := shasum -a 256 -c
23-
DEP_URL := https://github.com/golang/dep/releases/download/v0.5.1/dep-darwin-amd64
24-
DEP_HASH := 7479cca72da0596bb3c23094d363ea32b7336daa5473fa785a2099be28ecd0e3
25-
KUBECTL_URL := https://storage.googleapis.com/kubernetes-release/release/v1.13.3/bin/darwin/amd64/kubectl
26-
KUBECTL_HASH := 2ff06345a02636f1e6934f19dbc55452b587e06b2828c775dcdb29229c8da40f
21+
KUBECTL_URL := https://storage.googleapis.com/kubernetes-release/release/v1.15.0/bin/darwin/amd64/kubectl
22+
KUBECTL_HASH := 63f1ace419edffa1f5ebb64a6c63597afd48f8d94a61d4fb44e820139adbbe54
2723
GOLANGCILINT_URL := https://github.com/golangci/golangci-lint/releases/download/v1.15.0/golangci-lint-1.15.0-darwin-amd64.tar.gz
2824
GOLANGCILINT_HASH := 083941efa692bfe3c29ba709964e9fe5896889316d51813e523157c96c3153e0
2925
endif
@@ -32,12 +28,6 @@ $(BINDIR)/mockgen:
3228
mkdir -p $(BINDIR)
3329
go build -o $(BINDIR)/mockgen ./vendor/github.com/golang/mock/mockgen
3430

35-
$(BINDIR)/dep:
36-
mkdir -p $(BINDIR)
37-
curl -sL -o $@ $(DEP_URL)
38-
echo "$(DEP_HASH) $@" | $(SHASUM)
39-
chmod +x $@
40-
4131
$(BINDIR)/kubectl:
4232
mkdir -p $(BINDIR)
4333
curl --fail -sL -o $(BINDIR)/.kubectl $(KUBECTL_URL)
@@ -53,13 +43,13 @@ $(BINDIR)/golangci-lint:
5343
mv $(BINDIR)/.golangci-lint/*/golangci-lint $(BINDIR)/golangci-lint
5444
rm -rf $(BINDIR)/.golangci-lint $(BINDIR)/.golangci-lint.tar.gz
5545

56-
depend: $(BINDIR)/mockgen $(BINDIR)/dep $(BINDIR)/kubectl $(BINDIR)/golangci-lint
46+
depend: $(BINDIR)/mockgen $(BINDIR)/kubectl $(BINDIR)/golangci-lint
5747

5848
verify_boilerplate:
5949
$(HACK_DIR)/verify-boilerplate.sh
6050

61-
verify_vendor: $(BINDIR)/dep
62-
$(BINDIR)/dep ensure -no-vendor -dry-run -v
51+
verify_vendor:
52+
go mod verify
6353

6454
go_fmt:
6555
@set -e; \
@@ -73,8 +63,11 @@ go_fmt:
7363
go_vet:
7464
go vet $$(go list ./pkg/... ./cmd/...)
7565

66+
# We vendor packages using ./hack/tools with go modules for building binaries.
67+
# These files will fail linting since they use '_' importing with no usage so
68+
# must be ommited.
7669
go_lint: $(BINDIR)/golangci-lint ## lint golang code for problems
77-
$(BINDIR)/golangci-lint run
70+
go list -f '{{.Dir}}' ./... | fgrep -v hack/tools | xargs realpath --relative-to=. | xargs $(BINDIR)/golangci-lint run
7871

7972
clean: ## clean up created files
8073
rm -rf \
@@ -90,19 +83,22 @@ generate: depend ## generates mocks and assets files
9083
test: generate verify ## run all go tests
9184
go test $$(go list ./pkg/... ./cmd/... | grep -v pkg/e2e)
9285

93-
e2e: e2e-1.14 ## run end to end tests
86+
e2e: e2e-1.15 ## run end to end tests
87+
88+
e2e-1.15: build ## run end to end tests for kubernetes version 1.15
89+
KUBE_OIDC_PROXY_NODE_IMAGE=1.15.0 go test ./pkg/e2e/. -v --count=1
9490

9591
e2e-1.14: build ## run end to end tests for kubernetes version 1.14
96-
KUBE_OIDC_PROXY_NODE_IMAGE=1.14.0 go test ./pkg/e2e/. -v --count=1
92+
KUBE_OIDC_PROXY_NODE_IMAGE=1.14.3 go test ./pkg/e2e/. -v --count=1
9793

9894
e2e-1.13: build ## run end to end tests for kubernetes version 1.13
99-
KUBE_OIDC_PROXY_NODE_IMAGE=1.13.3 go test ./pkg/e2e/. -v --count=1
95+
KUBE_OIDC_PROXY_NODE_IMAGE=1.13.7 go test ./pkg/e2e/. -v --count=1
10096

10197
e2e-1.12: build ## run end to end tests for kubernetes version 1.12
102-
KUBE_OIDC_PROXY_NODE_IMAGE=1.12.5 go test ./pkg/e2e/. -v --count=1
98+
KUBE_OIDC_PROXY_NODE_IMAGE=1.12.8 go test ./pkg/e2e/. -v --count=1
10399

104100
e2e-1.11: build ## run end to end tests for kubernetes version 1.11
105-
KUBE_OIDC_PROXY_NODE_IMAGE=1.11.3 go test ./pkg/e2e/. -v --count=1
101+
KUBE_OIDC_PROXY_NODE_IMAGE=1.11.10 go test ./pkg/e2e/. -v --count=1
106102

107103
build: generate ## build kube-oidc-proxy
108104
CGO_ENABLED=0 go build -ldflags '-w $(shell hack/version-ldflags.sh)'

cmd/options/options.go

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Copyright Jetstack Ltd. See LICENSE for details.
2+
package options
3+
4+
import (
5+
"fmt"
6+
7+
"github.com/spf13/pflag"
8+
9+
cliflag "k8s.io/component-base/cli/flag"
10+
)
11+
12+
type OIDCAuthenticationOptions struct {
13+
APIAudiences []string
14+
CAFile string
15+
ClientID string
16+
IssuerURL string
17+
UsernameClaim string
18+
UsernamePrefix string
19+
GroupsClaim string
20+
GroupsPrefix string
21+
SigningAlgs []string
22+
RequiredClaims map[string]string
23+
}
24+
25+
func (o *OIDCAuthenticationOptions) Validate() error {
26+
if o != nil && (len(o.IssuerURL) > 0) != (len(o.ClientID) > 0) {
27+
return fmt.Errorf("oidc-issuer-url and oidc-client-id should be specified together")
28+
}
29+
30+
return nil
31+
}
32+
33+
func (o *OIDCAuthenticationOptions) AddFlags(fs *pflag.FlagSet) {
34+
fs.StringSliceVar(&o.APIAudiences, "api-audiences", o.APIAudiences, ""+
35+
"Identifiers of the API. The service account token authenticator will validate that "+
36+
"tokens used against the API are bound to at least one of these audiences. If the "+
37+
"--service-account-issuer flag is configured and this flag is not, this field "+
38+
"defaults to a single element list containing the issuer URL .")
39+
40+
fs.StringVar(&o.IssuerURL, "oidc-issuer-url", o.IssuerURL, ""+
41+
"The URL of the OpenID issuer, only HTTPS scheme will be accepted. "+
42+
"If set, it will be used to verify the OIDC JSON Web Token (JWT).")
43+
44+
fs.StringVar(&o.ClientID, "oidc-client-id", o.ClientID,
45+
"The client ID for the OpenID Connect client, must be set if oidc-issuer-url is set.")
46+
47+
fs.StringVar(&o.CAFile, "oidc-ca-file", o.CAFile, ""+
48+
"If set, the OpenID server's certificate will be verified by one of the authorities "+
49+
"in the oidc-ca-file, otherwise the host's root CA set will be used.")
50+
51+
fs.StringVar(&o.UsernameClaim, "oidc-username-claim", "sub", ""+
52+
"The OpenID claim to use as the user name. Note that claims other than the default ('sub') "+
53+
"is not guaranteed to be unique and immutable. This flag is experimental, please see "+
54+
"the authentication documentation for further details.")
55+
56+
fs.StringVar(&o.UsernamePrefix, "oidc-username-prefix", "", ""+
57+
"If provided, all usernames will be prefixed with this value. If not provided, "+
58+
"username claims other than 'email' are prefixed by the issuer URL to avoid "+
59+
"clashes. To skip any prefixing, provide the value '-'.")
60+
61+
fs.StringVar(&o.GroupsClaim, "oidc-groups-claim", "", ""+
62+
"If provided, the name of a custom OpenID Connect claim for specifying user groups. "+
63+
"The claim value is expected to be a string or array of strings. This flag is experimental, "+
64+
"please see the authentication documentation for further details.")
65+
66+
fs.StringVar(&o.GroupsPrefix, "oidc-groups-prefix", "", ""+
67+
"If provided, all groups will be prefixed with this value to prevent conflicts with "+
68+
"other authentication strategies.")
69+
70+
fs.StringSliceVar(&o.SigningAlgs, "oidc-signing-algs", []string{"RS256"}, ""+
71+
"Comma-separated list of allowed JOSE asymmetric signing algorithms. JWTs with a "+
72+
"'alg' header value not in this list will be rejected. "+
73+
"Values are defined by RFC 7518 https://tools.ietf.org/html/rfc7518#section-3.1.")
74+
75+
fs.Var(cliflag.NewMapStringStringNoSplit(&o.RequiredClaims), "oidc-required-claim", ""+
76+
"A key=value pair that describes a required claim in the ID Token. "+
77+
"If set, the claim is verified to be present in the ID Token with a matching value. "+
78+
"Repeat this flag to specify multiple claims.")
79+
}

0 commit comments

Comments
 (0)