Merge pull request #125238 from munnerz/kep-4193-nodebinding-beta

KEP-4193: promote ServiceAccountTokenNodeBinding feature to beta

Kubernetes-commit: 790dfdbe386e4a115f41d38058c127d2dd0e6f44
This commit is contained in:
Kubernetes Publisher 2024-05-31 12:27:18 -07:00
commit f74c97d4ab
2 changed files with 10 additions and 21 deletions

View File

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

View File

@ -21,7 +21,6 @@ import (
"encoding/json"
"io"
"net/http"
"os"
"reflect"
"testing"
"time"
@ -54,8 +53,6 @@ func TestCreateToken(t *testing.T) {
audiences []string
duration time.Duration
enableNodeBindingFeature bool
serverResponseToken string
serverResponseError string
@ -118,14 +115,13 @@ status:
test: "bad bound object kind",
name: "mysa",
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)",
name: "mysa",
enableNodeBindingFeature: true,
boundObjectKind: "Foo",
expectStderr: `error: supported --bound-object-kind values are Node, Pod, Secret`,
test: "bad bound object kind (node feature enabled)",
name: "mysa",
boundObjectKind: "Foo",
expectStderr: `error: supported --bound-object-kind values are Node, Pod, Secret`,
},
{
test: "missing bound object name",
@ -172,10 +168,9 @@ status:
test: "valid bound object (Node)",
name: "mysa",
enableNodeBindingFeature: true,
boundObjectKind: "Node",
boundObjectName: "mynode",
boundObjectUID: "myuid",
boundObjectKind: "Node",
boundObjectName: "mynode",
boundObjectUID: "myuid",
expectRequestPath: "/api/v1/namespaces/test/serviceaccounts/mysa/token",
expectTokenRequest: &authenticationv1.TokenRequest{
@ -367,10 +362,6 @@ status:
if test.duration != 0 {
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})
if !reflect.DeepEqual(tokenRequest, test.expectTokenRequest) {