1 /* 2 Copyright 2019 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package kubeadm 18 19 import ( 20 "context" 21 22 "k8s.io/kubernetes/test/e2e/framework" 23 admissionapi "k8s.io/pod-security-admission/api" 24 25 "github.com/onsi/ginkgo/v2" 26 ) 27 28 const ( 29 bootstrapTokensSignerRoleName = "system:controller:bootstrap-signer" 30 ) 31 32 // Define container for all the test specification aimed at verifying 33 // that kubeadm creates the bootstrap signer 34 var _ = Describe("bootstrap signer", func() { 35 36 // Get an instance of the k8s test framework 37 f := framework.NewDefaultFramework("bootstrap token") 38 f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged 39 40 // Tests in this container are not expected to create new objects in the cluster 41 // so we are disabling the creation of a namespace in order to get a faster execution 42 f.SkipNamespaceCreation = true 43 44 ginkgo.It("should be active", func(ctx context.Context) { 45 //NB. this is technically implemented a part of the control-plane phase 46 // and more specifically if the controller manager is properly configured, 47 // the bootstrapsigner controller is activated and the system:controller:bootstrap-signer 48 // group will be automatically created 49 ExpectRole(f.ClientSet, kubeSystemNamespace, bootstrapTokensSignerRoleName) 50 }) 51 }) 52