KEP-4193: promote ServiceAccountTokenNodeBinding feature to beta

Kubernetes-commit: 5481e630dea4c57c31b65a4fadf1bbeca77c2c57
This commit is contained in:
James Munnelly 2024-05-31 12:16:03 +01:00 committed by Kubernetes Publisher
parent 21275cf4d0
commit b57bb4f06e
2 changed files with 10 additions and 21 deletions

View File

@ -19,7 +19,6 @@ package create
import ( import (
"context" "context"
"fmt" "fmt"
"os"
"strings" "strings"
"time" "time"
@ -103,10 +102,9 @@ func boundObjectKindToAPIVersions() map[string]string {
kinds := map[string]string{ kinds := map[string]string{
"Pod": "v1", "Pod": "v1",
"Secret": "v1", "Secret": "v1",
"Node": "v1",
} }
if os.Getenv("KUBECTL_NODE_BOUND_TOKENS") == "true" {
kinds["Node"] = "v1"
}
return kinds return kinds
} }

View File

@ -21,7 +21,6 @@ import (
"encoding/json" "encoding/json"
"io" "io"
"net/http" "net/http"
"os"
"reflect" "reflect"
"testing" "testing"
"time" "time"
@ -54,8 +53,6 @@ func TestCreateToken(t *testing.T) {
audiences []string audiences []string
duration time.Duration duration time.Duration
enableNodeBindingFeature bool
serverResponseToken string serverResponseToken string
serverResponseError string serverResponseError string
@ -118,12 +115,11 @@ status:
test: "bad bound object kind", test: "bad bound object kind",
name: "mysa", name: "mysa",
boundObjectKind: "Foo", boundObjectKind: "Foo",
expectStderr: `error: supported --bound-object-kind values are Pod, Secret`, expectStderr: `error: supported --bound-object-kind values are Node, Pod, Secret`,
}, },
{ {
test: "bad bound object kind (node feature enabled)", test: "bad bound object kind (node feature enabled)",
name: "mysa", name: "mysa",
enableNodeBindingFeature: true,
boundObjectKind: "Foo", boundObjectKind: "Foo",
expectStderr: `error: supported --bound-object-kind values are Node, Pod, Secret`, expectStderr: `error: supported --bound-object-kind values are Node, Pod, Secret`,
}, },
@ -172,7 +168,6 @@ status:
test: "valid bound object (Node)", test: "valid bound object (Node)",
name: "mysa", name: "mysa",
enableNodeBindingFeature: true,
boundObjectKind: "Node", boundObjectKind: "Node",
boundObjectName: "mynode", boundObjectName: "mynode",
boundObjectUID: "myuid", boundObjectUID: "myuid",
@ -367,10 +362,6 @@ status:
if test.duration != 0 { if test.duration != 0 {
cmd.Flags().Set("duration", test.duration.String()) cmd.Flags().Set("duration", test.duration.String())
} }
if test.enableNodeBindingFeature {
os.Setenv("KUBECTL_NODE_BOUND_TOKENS", "true")
defer os.Unsetenv("KUBECTL_NODE_BOUND_TOKENS")
}
cmd.Run(cmd, []string{test.name}) cmd.Run(cmd, []string{test.name})
if !reflect.DeepEqual(tokenRequest, test.expectTokenRequest) { if !reflect.DeepEqual(tokenRequest, test.expectTokenRequest) {