mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #86573 from zhlhahaha/e2e_kubeadm_1410
add extra group and usage check for bootstraptoken
This commit is contained in:
commit
2914ba8e04
@ -20,6 +20,7 @@ import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
rbacv1 "k8s.io/api/rbac/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
bootstrapapi "k8s.io/cluster-bootstrap/token/api"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
@ -54,8 +55,12 @@ var _ = Describe("bootstrap token", func() {
|
||||
|
||||
tokenNum := 0
|
||||
for _, s := range secrets.Items {
|
||||
if s.Type == corev1.SecretTypeBootstrapToken {
|
||||
//TODO: might be we want to further check tokens (auth-extra-groups, usage etc)
|
||||
// check extra group and usage of token, make sure at least one token exist
|
||||
if s.Type == corev1.SecretTypeBootstrapToken && string(s.Data[bootstrapapi.BootstrapTokenExtraGroupsKey]) == bootstrapTokensGroup {
|
||||
usageBootstrapAuthentication := string(s.Data[bootstrapapi.BootstrapTokenUsageAuthentication])
|
||||
usageBootstrapSigning := string(s.Data[bootstrapapi.BootstrapTokenUsageSigningKey])
|
||||
gomega.Expect(usageBootstrapAuthentication).Should(gomega.Equal("true"), "the bootstrap token should be able to be used for authentication")
|
||||
gomega.Expect(usageBootstrapSigning).Should(gomega.Equal("true"), "the bootstrap token should be able to be used for signing")
|
||||
tokenNum++
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user