Skip to content

Commit

Permalink
Disable static tokens as of Kubernetes 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
johngmyers committed Apr 5, 2020
1 parent b5f3114 commit f6af815
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion nodeup/pkg/model/kube_apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ func (b *KubeAPIServerBuilder) buildPod() (*v1.Pod, error) {
kubeAPIServer.ClientCAFile = filepath.Join(b.PathSrvKubernetes(), "ca.crt")
kubeAPIServer.TLSCertFile = filepath.Join(b.PathSrvKubernetes(), "server.cert")
kubeAPIServer.TLSPrivateKeyFile = filepath.Join(b.PathSrvKubernetes(), "server.key")
kubeAPIServer.TokenAuthFile = filepath.Join(b.PathSrvKubernetes(), "known_tokens.csv")
if b.IsKubernetesLT("1.18") {
kubeAPIServer.TokenAuthFile = filepath.Join(b.PathSrvKubernetes(), "known_tokens.csv")
}

if !kubeAPIServer.DisableBasicAuth {
kubeAPIServer.BasicAuthFile = filepath.Join(b.PathSrvKubernetes(), "basic_auth.csv")
Expand Down
2 changes: 1 addition & 1 deletion nodeup/pkg/model/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (b *SecretBuilder) Build(c *fi.ModelBuilderContext) error {
c.AddTask(t)
}

if b.SecretStore != nil {
if b.IsKubernetesLT("1.18") && b.SecretStore != nil {
allTokens, err := b.allAuthTokens()
if err != nil {
return err
Expand Down
8 changes: 5 additions & 3 deletions pkg/model/pki.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,11 @@ func (b *PKIModelBuilder) Build(c *fi.ModelBuilderContext) error {
})
}

// Create auth tokens (though this is deprecated)
for _, x := range tokens.GetKubernetesAuthTokens_Deprecated() {
c.AddTask(&fitasks.Secret{Name: fi.String(x), Lifecycle: b.Lifecycle})
if b.IsKubernetesLT("1.18") {
// Create auth tokens (though this is deprecated)
for _, x := range tokens.GetKubernetesAuthTokens_Deprecated() {
c.AddTask(&fitasks.Secret{Name: fi.String(x), Lifecycle: b.Lifecycle})
}
}

{
Expand Down

0 comments on commit f6af815

Please sign in to comment.