@@ -412,6 +412,7 @@ func (r *KarpenterMachinePoolReconciler) createOrUpdateEC2NodeClass(ctx context.
412
412
ec2NodeClass .SetGroupVersionKind (ec2NodeClassGVR .GroupVersion ().WithKind ("EC2NodeClass" ))
413
413
ec2NodeClass .SetName (karpenterMachinePool .Name )
414
414
ec2NodeClass .SetNamespace ("" )
415
+ ec2NodeClass .SetLabels (map [string ]string {"app.kubernetes.io/managed-by" : "aws-resolver-rules-operator" })
415
416
416
417
// Generate user data for Ignition
417
418
userData := r .generateUserData (awsCluster .Spec .S3Bucket .Name , cluster .Name , karpenterMachinePool .Name )
@@ -527,51 +528,7 @@ func (r *KarpenterMachinePoolReconciler) createOrUpdateNodePool(ctx context.Cont
527
528
nodePool .SetGroupVersionKind (nodePoolGVR .GroupVersion ().WithKind ("NodePool" ))
528
529
nodePool .SetName (karpenterMachinePool .Name )
529
530
nodePool .SetNamespace ("" )
530
-
531
- // Set default requirements and overwrite with the user provided configuration
532
- requirements := []map [string ]interface {}{
533
- {
534
- "key" : "karpenter.k8s.aws/instance-family" ,
535
- "operator" : "NotIn" ,
536
- "values" : []string {"t3" , "t3a" , "t2" },
537
- },
538
- {
539
- "key" : "karpenter.k8s.aws/instance-cpu" ,
540
- "operator" : "In" ,
541
- "values" : []string {"4" , "8" , "16" , "32" },
542
- },
543
- {
544
- "key" : "karpenter.k8s.aws/instance-hypervisor" ,
545
- "operator" : "In" ,
546
- "values" : []string {"nitro" },
547
- },
548
- {
549
- "key" : "kubernetes.io/arch" ,
550
- "operator" : "In" ,
551
- "values" : []string {"amd64" },
552
- },
553
- {
554
- "key" : "karpenter.sh/capacity-type" ,
555
- "operator" : "In" ,
556
- "values" : []string {"spot" , "on-demand" },
557
- },
558
- {
559
- "key" : "kubernetes.io/os" ,
560
- "operator" : "In" ,
561
- "values" : []string {"linux" },
562
- },
563
- }
564
- if len (karpenterMachinePool .Spec .NodePool .Template .Spec .Requirements ) > 0 {
565
- requirements = []map [string ]interface {}{}
566
- for _ , req := range karpenterMachinePool .Spec .NodePool .Template .Spec .Requirements {
567
- requirement := map [string ]interface {}{
568
- "key" : req .Key ,
569
- "operator" : req .Operator ,
570
- "values" : req .Values ,
571
- }
572
- requirements = append (requirements , requirement )
573
- }
574
- }
531
+ nodePool .SetLabels (map [string ]string {"app.kubernetes.io/managed-by" : "aws-resolver-rules-operator" })
575
532
576
533
// Set default labels and overwrite with the user provided configuration
577
534
labels := map [string ]string {
@@ -603,7 +560,7 @@ func (r *KarpenterMachinePoolReconciler) createOrUpdateNodePool(ctx context.Cont
603
560
"value" : "true" ,
604
561
},
605
562
},
606
- "requirements" : requirements ,
563
+ "requirements" : karpenterMachinePool . Spec . NodePool . Template . Spec . Requirements ,
607
564
"nodeClassRef" : map [string ]interface {}{
608
565
"group" : "karpenter.k8s.aws" ,
609
566
"kind" : "EC2NodeClass" ,
0 commit comments