@@ -77,6 +77,9 @@ var _ = ginkgo.Describe("[managed] [auth] EKS authentication mode tests", func()
7777 ginkgo .By ("verifying cluster has the correct authentication mode" )
7878 verifyClusterAuthenticationMode (ctx , eksClusterName , ekstypes .AuthenticationModeApiAndConfigMap , e2eCtx .BootstrapUserAWSSessionV2 )
7979
80+ ginkgo .By ("verifying cluster has default bootstrap permissions" )
81+ verifyClusterBootstrapPermissions (ctx , eksClusterName , true , e2eCtx .BootstrapUserAWSSessionV2 )
82+
8083 ginkgo .By ("attempting to downgrade from api_and_config_map to config_map should fail" )
8184 controlPlaneName := fmt .Sprintf ("%s-control-plane" , clusterName )
8285 controlPlane := & ekscontrolplanev1.AWSManagedControlPlane {}
@@ -130,5 +133,56 @@ var _ = ginkgo.Describe("[managed] [auth] EKS authentication mode tests", func()
130133 ArtifactFolder : e2eCtx .Settings .ArtifactFolder ,
131134 }, e2eCtx .E2EConfig .GetIntervals ("" , "wait-delete-cluster" )... )
132135 })
133- })
134136
137+ shared .ConditionalIt (runGeneralTests , "should create a cluster with bootstrapClusterCreatorAdminPermissions disabled" , func () {
138+ ginkgo .By ("should have a valid test configuration" )
139+ Expect (e2eCtx .Environment .BootstrapClusterProxy ).ToNot (BeNil (), "Invalid argument. BootstrapClusterProxy can't be nil" )
140+ Expect (e2eCtx .E2EConfig ).ToNot (BeNil (), "Invalid argument. e2eConfig can't be nil when calling bootstrap spec" )
141+ Expect (e2eCtx .E2EConfig .Variables ).To (HaveKey (shared .KubernetesVersion ))
142+
143+ ctx = context .TODO ()
144+ namespace = shared .SetupSpecNamespace (ctx , "bootstrap" , e2eCtx )
145+ clusterName = fmt .Sprintf ("bootstrap-%s" , util .RandomString (6 ))
146+ eksClusterName := getEKSClusterName (namespace .Name , clusterName )
147+
148+ ginkgo .By ("should create an EKS control plane with bootstrapClusterCreatorAdminPermissions disabled" )
149+ ManagedClusterSpec (ctx , func () ManagedClusterSpecInput {
150+ return ManagedClusterSpecInput {
151+ E2EConfig : e2eCtx .E2EConfig ,
152+ ConfigClusterFn : defaultConfigCluster ,
153+ BootstrapClusterProxy : e2eCtx .Environment .BootstrapClusterProxy ,
154+ AWSSession : e2eCtx .BootstrapUserAWSSession ,
155+ AWSSessionV2 : e2eCtx .BootstrapUserAWSSessionV2 ,
156+ Namespace : namespace ,
157+ ClusterName : clusterName ,
158+ Flavour : EKSAuthBootstrapDisabledFlavor ,
159+ ControlPlaneMachineCount : 1 ,
160+ WorkerMachineCount : 0 ,
161+ }
162+ })
163+
164+ ginkgo .By ("EKS cluster should be active" )
165+ verifyClusterActiveAndOwned (ctx , eksClusterName , e2eCtx .BootstrapUserAWSSessionV2 )
166+
167+ ginkgo .By ("verifying cluster has bootstrap permissions disabled" )
168+ verifyClusterBootstrapPermissions (ctx , eksClusterName , false , e2eCtx .BootstrapUserAWSSessionV2 )
169+
170+ cluster := framework .GetClusterByName (ctx , framework.GetClusterByNameInput {
171+ Getter : e2eCtx .Environment .BootstrapClusterProxy .GetClient (),
172+ Namespace : namespace .Name ,
173+ Name : clusterName ,
174+ })
175+ Expect (cluster ).NotTo (BeNil (), "couldn't find CAPI cluster" )
176+
177+ framework .DeleteCluster (ctx , framework.DeleteClusterInput {
178+ Deleter : e2eCtx .Environment .BootstrapClusterProxy .GetClient (),
179+ Cluster : cluster ,
180+ })
181+ framework .WaitForClusterDeleted (ctx , framework.WaitForClusterDeletedInput {
182+ ClusterProxy : e2eCtx .Environment .BootstrapClusterProxy ,
183+ Cluster : cluster ,
184+ ClusterctlConfigPath : e2eCtx .Environment .ClusterctlConfigPath ,
185+ ArtifactFolder : e2eCtx .Settings .ArtifactFolder ,
186+ }, e2eCtx .E2EConfig .GetIntervals ("" , "wait-delete-cluster" )... )
187+ })
188+ })
0 commit comments