File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -945,7 +945,7 @@ func TestKarpenter(t *testing.T) {
945945 withOIDCDiscovery ().
946946 withDefaults24 ().
947947 withAddons ("karpenter.sh-k8s-1.19" ).
948- withServiceAccountRole ( "aws-node-termination-handler.kube-system" , true ).
948+ withoutNTH ( ).
949949 withServiceAccountRole ("karpenter.kube-system" , true )
950950 test .expectTerraformFilenames = append (test .expectTerraformFilenames ,
951951 "aws_s3_object_nodeupscript-karpenter-nodes-single-machinetype_content" ,
Original file line number Diff line number Diff line change @@ -39,12 +39,21 @@ func (b *NodeTerminationHandlerOptionsBuilder) BuildOptions(o *kops.Cluster) err
3939 clusterSpec .CloudProvider .AWS .NodeTerminationHandler = & kops.NodeTerminationHandlerSpec {}
4040 }
4141 nth := clusterSpec .CloudProvider .AWS .NodeTerminationHandler
42+ if nth .Enabled == nil {
43+ if clusterSpec .Karpenter != nil && clusterSpec .Karpenter .Enabled {
44+ // Karpenter manages its own NTH, so we disable the NTH addon.
45+ // https://karpenter.sh/docs/troubleshooting/#aws-node-termination-handler-nth-interactions
46+ nth .Enabled = fi .PtrTo (false )
47+ } else {
48+ nth .Enabled = fi .PtrTo (true )
49+ }
50+ }
51+ if ! fi .ValueOf (nth .Enabled ) {
52+ return nil
53+ }
4254 if nth .DeleteSQSMsgIfNodeNotFound == nil {
4355 nth .DeleteSQSMsgIfNodeNotFound = fi .PtrTo (false )
4456 }
45- if nth .Enabled == nil {
46- nth .Enabled = fi .PtrTo (true )
47- }
4857 if nth .EnableSpotInterruptionDraining == nil {
4958 nth .EnableSpotInterruptionDraining = fi .PtrTo (true )
5059 }
You can’t perform that action at this time.
0 commit comments