mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +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"
|
corev1 "k8s.io/api/core/v1"
|
||||||
rbacv1 "k8s.io/api/rbac/v1"
|
rbacv1 "k8s.io/api/rbac/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
bootstrapapi "k8s.io/cluster-bootstrap/token/api"
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
@ -54,8 +55,12 @@ var _ = Describe("bootstrap token", func() {
|
|||||||
|
|
||||||
tokenNum := 0
|
tokenNum := 0
|
||||||
for _, s := range secrets.Items {
|
for _, s := range secrets.Items {
|
||||||
if s.Type == corev1.SecretTypeBootstrapToken {
|
// check extra group and usage of token, make sure at least one token exist
|
||||||
//TODO: might be we want to further check tokens (auth-extra-groups, usage etc)
|
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++
|
tokenNum++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user