File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import (
20
20
corev1 "k8s.io/api/core/v1"
21
21
rbacv1 "k8s.io/api/rbac/v1"
22
22
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23
+ bootstrapapi "k8s.io/cluster-bootstrap/token/api"
23
24
"k8s.io/kubernetes/test/e2e/framework"
24
25
25
26
"github.com/onsi/ginkgo"
@@ -54,8 +55,12 @@ var _ = Describe("bootstrap token", func() {
54
55
55
56
tokenNum := 0
56
57
for _ , s := range secrets .Items {
57
- if s .Type == corev1 .SecretTypeBootstrapToken {
58
- //TODO: might be we want to further check tokens (auth-extra-groups, usage etc)
58
+ // check extra group and usage of token, make sure at least one token exist
59
+ if s .Type == corev1 .SecretTypeBootstrapToken && string (s .Data [bootstrapapi .BootstrapTokenExtraGroupsKey ]) == bootstrapTokensGroup {
60
+ usageBootstrapAuthentication := string (s .Data [bootstrapapi .BootstrapTokenUsageAuthentication ])
61
+ usageBootstrapSigning := string (s .Data [bootstrapapi .BootstrapTokenUsageSigningKey ])
62
+ gomega .Expect (usageBootstrapAuthentication ).Should (gomega .Equal ("true" ), "the bootstrap token should be able to be used for authentication" )
63
+ gomega .Expect (usageBootstrapSigning ).Should (gomega .Equal ("true" ), "the bootstrap token should be able to be used for signing" )
59
64
tokenNum ++
60
65
}
61
66
}
You can’t perform that action at this time.
0 commit comments