Skip to content

Commit 5481e63

Browse files
committed
KEP-4193: promote ServiceAccountTokenNodeBinding feature to beta
1 parent 8565e37 commit 5481e63

File tree

3 files changed

+12
-22
lines changed

3 files changed

+12
-22
lines changed

pkg/features/kube_features.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@ const (
699699
// owner: @munnerz
700700
// kep: http://kep.k8s.io/4193
701701
// alpha: v1.29
702+
// beta: v1.31
702703
//
703704
// Controls whether the apiserver supports binding service account tokens to Node objects.
704705
ServiceAccountTokenNodeBinding featuregate.Feature = "ServiceAccountTokenNodeBinding"
@@ -1139,7 +1140,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
11391140

11401141
ServiceAccountTokenPodNodeInfo: {Default: true, PreRelease: featuregate.Beta},
11411142

1142-
ServiceAccountTokenNodeBinding: {Default: false, PreRelease: featuregate.Alpha},
1143+
ServiceAccountTokenNodeBinding: {Default: true, PreRelease: featuregate.Beta},
11431144

11441145
ServiceAccountTokenNodeBindingValidation: {Default: true, PreRelease: featuregate.Beta},
11451146

staging/src/k8s.io/kubectl/pkg/cmd/create/create_token.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package create
1919
import (
2020
"context"
2121
"fmt"
22-
"os"
2322
"strings"
2423
"time"
2524

@@ -103,10 +102,9 @@ func boundObjectKindToAPIVersions() map[string]string {
103102
kinds := map[string]string{
104103
"Pod": "v1",
105104
"Secret": "v1",
105+
"Node": "v1",
106106
}
107-
if os.Getenv("KUBECTL_NODE_BOUND_TOKENS") == "true" {
108-
kinds["Node"] = "v1"
109-
}
107+
110108
return kinds
111109
}
112110

staging/src/k8s.io/kubectl/pkg/cmd/create/create_token_test.go

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"encoding/json"
2222
"io"
2323
"net/http"
24-
"os"
2524
"reflect"
2625
"testing"
2726
"time"
@@ -54,8 +53,6 @@ func TestCreateToken(t *testing.T) {
5453
audiences []string
5554
duration time.Duration
5655

57-
enableNodeBindingFeature bool
58-
5956
serverResponseToken string
6057
serverResponseError string
6158

@@ -118,14 +115,13 @@ status:
118115
test: "bad bound object kind",
119116
name: "mysa",
120117
boundObjectKind: "Foo",
121-
expectStderr: `error: supported --bound-object-kind values are Pod, Secret`,
118+
expectStderr: `error: supported --bound-object-kind values are Node, Pod, Secret`,
122119
},
123120
{
124-
test: "bad bound object kind (node feature enabled)",
125-
name: "mysa",
126-
enableNodeBindingFeature: true,
127-
boundObjectKind: "Foo",
128-
expectStderr: `error: supported --bound-object-kind values are Node, Pod, Secret`,
121+
test: "bad bound object kind (node feature enabled)",
122+
name: "mysa",
123+
boundObjectKind: "Foo",
124+
expectStderr: `error: supported --bound-object-kind values are Node, Pod, Secret`,
129125
},
130126
{
131127
test: "missing bound object name",
@@ -172,10 +168,9 @@ status:
172168
test: "valid bound object (Node)",
173169
name: "mysa",
174170

175-
enableNodeBindingFeature: true,
176-
boundObjectKind: "Node",
177-
boundObjectName: "mynode",
178-
boundObjectUID: "myuid",
171+
boundObjectKind: "Node",
172+
boundObjectName: "mynode",
173+
boundObjectUID: "myuid",
179174

180175
expectRequestPath: "/api/v1/namespaces/test/serviceaccounts/mysa/token",
181176
expectTokenRequest: &authenticationv1.TokenRequest{
@@ -367,10 +362,6 @@ status:
367362
if test.duration != 0 {
368363
cmd.Flags().Set("duration", test.duration.String())
369364
}
370-
if test.enableNodeBindingFeature {
371-
os.Setenv("KUBECTL_NODE_BOUND_TOKENS", "true")
372-
defer os.Unsetenv("KUBECTL_NODE_BOUND_TOKENS")
373-
}
374365
cmd.Run(cmd, []string{test.name})
375366

376367
if !reflect.DeepEqual(tokenRequest, test.expectTokenRequest) {

0 commit comments

Comments
 (0)