@@ -131,6 +131,68 @@ func (k *AdditionalTrustBundlePropagationTest) Run(t *testing.T, nodePool hyperv
131131 )
132132 }
133133
134+ // Verify AWS_CA_BUNDLE wiring on the aws-cloud-controller-manager deployment
135+ if k .hostedCluster .Spec .Platform .Type == hyperv1 .AWSPlatform {
136+ hcpNamespace := manifests .HostedControlPlaneNamespace (k .hostedCluster .Namespace , k .hostedCluster .Name )
137+ awsCCMDeployment := & appsv1.Deployment {
138+ ObjectMeta : metav1.ObjectMeta {
139+ Name : "aws-cloud-controller-manager" ,
140+ Namespace : hcpNamespace ,
141+ },
142+ }
143+ e2eutil .EventuallyObject (t , k .ctx , "Waiting for aws-cloud-controller-manager to have AWS_CA_BUNDLE wiring" ,
144+ func (ctx context.Context ) (* appsv1.Deployment , error ) {
145+ err := k .mgmtClient .Get (ctx , crclient .ObjectKeyFromObject (awsCCMDeployment ), awsCCMDeployment )
146+ return awsCCMDeployment , err
147+ },
148+ []e2eutil.Predicate [* appsv1.Deployment ]{
149+ func (obj * appsv1.Deployment ) (bool , string , error ) {
150+ // Check AWS_CA_BUNDLE env var on the first container.
151+ hasEnv := false
152+ for _ , env := range obj .Spec .Template .Spec .Containers [0 ].Env {
153+ if env .Name == "AWS_CA_BUNDLE" && env .Value == "/etc/pki/ca-trust/extracted/hypershift/combined-ca-bundle.pem" {
154+ hasEnv = true
155+ break
156+ }
157+ }
158+ if ! hasEnv {
159+ return false , "AWS_CA_BUNDLE env var not found on first container" , nil
160+ }
161+
162+ // Check setup-aws-ca-bundle init container.
163+ hasInitContainer := false
164+ for _ , ic := range obj .Spec .Template .Spec .InitContainers {
165+ if ic .Name == "setup-aws-ca-bundle" {
166+ hasInitContainer = true
167+ break
168+ }
169+ }
170+ if ! hasInitContainer {
171+ return false , "setup-aws-ca-bundle init container not found" , nil
172+ }
173+
174+ // Check aws-ca-bundle volume.
175+ hasVolume := false
176+ for _ , v := range obj .Spec .Template .Spec .Volumes {
177+ if v .Name == "aws-ca-bundle" && v .EmptyDir != nil {
178+ hasVolume = true
179+ break
180+ }
181+ }
182+ if ! hasVolume {
183+ return false , "aws-ca-bundle volume not found" , nil
184+ }
185+
186+ if ready := util .IsDeploymentReady (k .ctx , obj ); ! ready {
187+ return false , "Deployment is not ready" , nil
188+ }
189+ return true , "AWS_CA_BUNDLE wiring is present and deployment is ready" , nil
190+ },
191+ },
192+ e2eutil .WithInterval (10 * time .Second ), e2eutil .WithTimeout (5 * time .Minute ),
193+ )
194+ }
195+
134196 t .Logf ("Updating hosted cluster by removing additional trust bundle." )
135197 if err = e2eutil .UpdateObject (t , k .ctx , k .mgmtClient , k .hostedCluster , func (obj * hyperv1.HostedCluster ) {
136198 obj .Spec .AdditionalTrustBundle = nil
@@ -166,6 +228,45 @@ func (k *AdditionalTrustBundlePropagationTest) Run(t *testing.T, nodePool hyperv
166228 },
167229 )
168230
231+ // Verify AWS_CA_BUNDLE wiring is removed from the aws-cloud-controller-manager deployment
232+ if k .hostedCluster .Spec .Platform .Type == hyperv1 .AWSPlatform {
233+ hcpNamespace := manifests .HostedControlPlaneNamespace (k .hostedCluster .Namespace , k .hostedCluster .Name )
234+ awsCCMDeployment := & appsv1.Deployment {
235+ ObjectMeta : metav1.ObjectMeta {
236+ Name : "aws-cloud-controller-manager" ,
237+ Namespace : hcpNamespace ,
238+ },
239+ }
240+ e2eutil .EventuallyObject (t , k .ctx , "Waiting for aws-cloud-controller-manager to have AWS_CA_BUNDLE wiring removed" ,
241+ func (ctx context.Context ) (* appsv1.Deployment , error ) {
242+ err := k .mgmtClient .Get (ctx , crclient .ObjectKeyFromObject (awsCCMDeployment ), awsCCMDeployment )
243+ return awsCCMDeployment , err
244+ },
245+ []e2eutil.Predicate [* appsv1.Deployment ]{
246+ func (obj * appsv1.Deployment ) (bool , string , error ) {
247+ // Ensure AWS_CA_BUNDLE env var is gone.
248+ for _ , env := range obj .Spec .Template .Spec .Containers [0 ].Env {
249+ if env .Name == "AWS_CA_BUNDLE" {
250+ return false , "AWS_CA_BUNDLE env var is still present" , nil
251+ }
252+ }
253+
254+ // Ensure setup-aws-ca-bundle init container is gone.
255+ for _ , ic := range obj .Spec .Template .Spec .InitContainers {
256+ if ic .Name == "setup-aws-ca-bundle" {
257+ return false , "setup-aws-ca-bundle init container is still present" , nil
258+ }
259+ }
260+
261+ if ready := util .IsDeploymentReady (k .ctx , obj ); ! ready {
262+ return false , "Deployment is not ready" , nil
263+ }
264+ return true , "AWS_CA_BUNDLE wiring is removed and deployment is ready" , nil
265+ },
266+ },
267+ )
268+ }
269+
169270 e2eutil .EventuallyObject (t , k .ctx , fmt .Sprintf ("Waiting for NodePool %s/%s to begin updating" , nodePool .Namespace , nodePool .Name ),
170271 func (ctx context.Context ) (* hyperv1.NodePool , error ) {
171272 err := k .mgmtClient .Get (ctx , crclient .ObjectKeyFromObject (& nodePool ), & nodePool )
0 commit comments