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

Automated cherry pick of #16497: Support multiple service-account-issuer flags #16512

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions k8s/crds/kops.k8s.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1568,6 +1568,12 @@ spec:
description: KubeAPIServerConfig defines the configuration for the
kube api
properties:
additionalServiceAccountIssuers:
description: AdditionalServiceAccountIssuers can contain additional
service account token issuers.
items:
type: string
type: array
address:
description: 'Address is the binding address for the kube api:
Deprecated - use insecure-bind-address and bind-address'
Expand Down
3 changes: 3 additions & 0 deletions nodeup/pkg/model/kube_apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,9 @@ func (b *KubeAPIServerBuilder) buildPod(ctx context.Context, kubeAPIServer *kops
"/usr/local/bin/kube-apiserver",
}
container.Args = append(container.Args, sortedStrings(flags)...)
for _, issuer := range kubeAPIServer.AdditionalServiceAccountIssuers {
container.Args = append(container.Args, "--service-account-issuer="+issuer)
}
}

for _, path := range b.SSLHostPaths() {
Expand Down
6 changes: 6 additions & 0 deletions nodeup/pkg/model/tests/golden/oidc/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ spec:
- claim2=value2
oidcUsernameClaim: user
oidcUsernamePrefix: 'oidc:'
serviceAccountIssuer: https://huh.com/multisaissuer.example.com
additionalServiceAccountIssuers:
- https://foobar.com
- https://aaa.com
- https://hello.com
- https://dorld.com
kubelet:
anonymousAuth: false
kubernetesVersion: v1.23.0
Expand Down
8 changes: 6 additions & 2 deletions nodeup/pkg/model/tests/golden/oidc/tasks-kube-apiserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,19 @@ contents: |
- --requestheader-group-headers=X-Remote-Group
- --requestheader-username-headers=X-Remote-User
- --secure-port=443
- --service-account-issuer=https://api.internal.minimal.example.com
- --service-account-jwks-uri=https://api.internal.minimal.example.com/openid/v1/jwks
- --service-account-issuer=https://huh.com/multisaissuer.example.com
- --service-account-jwks-uri=https://huh.com/multisaissuer.example.com/openid/v1/jwks
- --service-account-key-file=/srv/kubernetes/kube-apiserver/service-account.pub
- --service-account-signing-key-file=/srv/kubernetes/kube-apiserver/service-account.key
- --service-cluster-ip-range=100.64.0.0/13
- --storage-backend=etcd3
- --tls-cert-file=/srv/kubernetes/kube-apiserver/server.crt
- --tls-private-key-file=/srv/kubernetes/kube-apiserver/server.key
- --v=2
- --service-account-issuer=https://foobar.com
- --service-account-issuer=https://aaa.com
- --service-account-issuer=https://hello.com
- --service-account-issuer=https://dorld.com
command:
- /go-runner
image: registry.k8s.io/kube-apiserver:v1.23.0
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/kops/componentconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,9 @@ type KubeAPIServerConfig struct {
// in "iss" claim of issued tokens. This value is a string or URI.
ServiceAccountIssuer *string `json:"serviceAccountIssuer,omitempty" flag:"service-account-issuer"`

// AdditionalServiceAccountIssuers can contain additional service account token issuers.
AdditionalServiceAccountIssuers []string `json:"additionalServiceAccountIssuers,omitempty"`

// ServiceAccountJWKSURI overrides the path for the jwks document; this is useful when we are republishing the service account discovery information elsewhere.
ServiceAccountJWKSURI *string `json:"serviceAccountJWKSURI,omitempty" flag:"service-account-jwks-uri"`

Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/kops/v1alpha2/componentconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@ type KubeAPIServerConfig struct {
// in "iss" claim of issued tokens. This value is a string or URI.
ServiceAccountIssuer *string `json:"serviceAccountIssuer,omitempty" flag:"service-account-issuer"`

// AdditionalServiceAccountIssuers can contain additional service account token issuers.
AdditionalServiceAccountIssuers []string `json:"additionalServiceAccountIssuers,omitempty"`

// ServiceAccountJWKSURI overrides the path for the jwks document; this is useful when we are republishing the service account discovery information elsewhere.
ServiceAccountJWKSURI *string `json:"serviceAccountJWKSURI,omitempty" flag:"service-account-jwks-uri"`

Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/kops/v1alpha2/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/apis/kops/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkg/apis/kops/v1alpha3/componentconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,9 @@ type KubeAPIServerConfig struct {
// in "iss" claim of issued tokens. This value is a string or URI.
ServiceAccountIssuer *string `json:"serviceAccountIssuer,omitempty" flag:"service-account-issuer"`

// AdditionalServiceAccountIssuers can contain additional service account token issuers.
AdditionalServiceAccountIssuers []string `json:"additionalServiceAccountIssuers,omitempty"`

// ServiceAccountJWKSURI overrides the path for the jwks document; this is useful when we are republishing the service account discovery information elsewhere.
ServiceAccountJWKSURI *string `json:"serviceAccountJWKSURI,omitempty" flag:"service-account-jwks-uri"`

Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/kops/v1alpha3/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/apis/kops/v1alpha3/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/apis/kops/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading