@@ -57,6 +57,11 @@ import (
5757 "sigs.k8s.io/cluster-api/util/predicates"
5858)
5959
60+ const (
61+ // NodeTypeAL2023 represents the AL2023 node type.
62+ NodeTypeAL2023 = "al2023"
63+ )
64+
6065// EKSConfigReconciler reconciles a EKSConfig object.
6166type EKSConfigReconciler struct {
6267 client.Client
@@ -229,7 +234,7 @@ func (r *EKSConfigReconciler) joinWorker(ctx context.Context, cluster *clusterv1
229234
230235 // For AL2023, requeue to ensure we retry when control plane is ready
231236 // For AL2, follow upstream behavior and return nil
232- if config .Spec .NodeType == "al2023" {
237+ if config .Spec .NodeType == NodeTypeAL2023 {
233238 log .Info ("AL2023 detected, returning requeue after 30 seconds" )
234239 return ctrl.Result {RequeueAfter : 30 * time .Second }, nil
235240 }
@@ -244,16 +249,16 @@ func (r *EKSConfigReconciler) joinWorker(ctx context.Context, cluster *clusterv1
244249 }
245250
246251 // Check if control plane is ready (skip in test environments for AL2023)
247- if config .Spec .NodeType == "al2023" && ! conditions .IsTrue (controlPlane , ekscontrolplanev1 .EKSControlPlaneReadyCondition ) {
248- // In test environments, skip the control plane readiness check for AL2023
249- if os .Getenv ("TEST_ENV" ) == "true" {
250- // Skipping control plane readiness check for AL2023 in test environment
251- } else {
252+ if config .Spec .NodeType == NodeTypeAL2023 && ! conditions .IsTrue (controlPlane , ekscontrolplanev1 .EKSControlPlaneReadyCondition ) {
253+ // Skip control plane readiness check for AL2023 in test environment
254+ if os .Getenv ("TEST_ENV" ) != "true" {
255+ log .Info ("AL2023 detected, waiting for control plane to be ready" )
252256 conditions .MarkFalse (config , eksbootstrapv1 .DataSecretAvailableCondition ,
253257 eksbootstrapv1 .DataSecretGenerationFailedReason ,
254258 clusterv1 .ConditionSeverityInfo , "Control plane is not ready yet" )
255259 return ctrl.Result {RequeueAfter : 30 * time .Second }, nil
256260 }
261+ log .Info ("Skipping control plane readiness check for AL2023 in test environment" )
257262 }
258263 log .Info ("Control plane is ready, proceeding with userdata generation" )
259264
@@ -304,7 +309,7 @@ func (r *EKSConfigReconciler) joinWorker(ctx context.Context, cluster *clusterv1
304309 }
305310
306311 // Set AMI family type and AL2023-specific fields if needed
307- if config .Spec .NodeType == "al2023" {
312+ if config .Spec .NodeType == NodeTypeAL2023 {
308313 log .Info ("Processing AL2023 node type" )
309314 nodeInput .AMIFamilyType = userdata .AMIFamilyAL2023
310315
0 commit comments