Skip to content

Commit a710a1b

Browse files
authored
Enable enclave options in EC2 Launch Template (#8349)
1 parent ea76a8e commit a710a1b

File tree

5 files changed

+31
-1
lines changed

5 files changed

+31
-1
lines changed

pkg/apis/eksctl.io/v1alpha5/assets/schema.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -1840,6 +1840,11 @@
18401840
"description": "Enable EC2 detailed monitoring",
18411841
"x-intellij-html-description": "Enable EC2 detailed monitoring"
18421842
},
1843+
"enclaveEnabled": {
1844+
"type": "boolean",
1845+
"description": "determines if the EC2 instance will be Nitro enclave enabled",
1846+
"x-intellij-html-description": "determines if the EC2 instance will be Nitro enclave enabled"
1847+
},
18431848
"iam": {
18441849
"$ref": "#/definitions/NodeGroupIAM"
18451850
},
@@ -2068,7 +2073,8 @@
20682073
"kubeletExtraConfig",
20692074
"containerRuntime",
20702075
"maxInstanceLifetime",
2071-
"localZones"
2076+
"localZones",
2077+
"enclaveEnabled"
20722078
],
20732079
"additionalProperties": false,
20742080
"description": "holds configuration attributes that are specific to an unmanaged nodegroup",

pkg/apis/eksctl.io/v1alpha5/types.go

+4
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,10 @@ type NodeGroup struct {
13321332
// The cluster should have been created with all of the local zones specified in this field.
13331333
// +optional
13341334
LocalZones []string `json:"localZones,omitempty"`
1335+
1336+
// EnclaveEnabled determines if the EC2 instance will be Nitro enclave enabled
1337+
// +optional
1338+
EnclaveEnabled *bool `json:"enclaveEnabled,omitempty"`
13351339
}
13361340

13371341
// GetContainerRuntime returns the container runtime.

pkg/cfn/builder/fakes/fake_cfn_template.go

+3
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ type LaunchTemplateData struct {
168168
CreditSpecification *struct {
169169
CPUCredits string
170170
}
171+
EnclaveOptions *struct {
172+
Enabled *bool
173+
}
171174
MetadataOptions MetadataOptions
172175
TagSpecifications []TagSpecification
173176
Placement Placement

pkg/cfn/builder/nodegroup.go

+6
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,12 @@ func newLaunchTemplateData(ctx context.Context, n *NodeGroupResourceSet) (*gfnec
461461
TagSpecifications: makeTags(ng.NodeGroupBase, n.options.ClusterConfig.Metadata),
462462
}
463463

464+
if ng.EnclaveEnabled != nil {
465+
launchTemplateData.EnclaveOptions = &gfnec2.LaunchTemplate_EnclaveOptions{
466+
Enabled: gfnt.NewBoolean(*ng.EnclaveEnabled),
467+
}
468+
}
469+
464470
if ng.CapacityReservation != nil {
465471
valueOrNil := func(value *string) *gfnt.Value {
466472
if value != nil {

pkg/cfn/builder/nodegroup_test.go

+11
Original file line numberDiff line numberDiff line change
@@ -1354,6 +1354,17 @@ var _ = Describe("Unmanaged NodeGroup Template Builder", func() {
13541354
Expect(ngTemplate.Resources).NotTo(HaveKey("EgressInterClusterAPI"))
13551355
})
13561356
})
1357+
1358+
Context("ng.EnclaveEnabled is set", func() {
1359+
BeforeEach(func() {
1360+
ng.EnclaveEnabled = aws.Bool(true)
1361+
})
1362+
1363+
It("enables the value on the launch template", func() {
1364+
properties := ngTemplate.Resources["NodeGroupLaunchTemplate"].Properties
1365+
Expect(properties.LaunchTemplateData.EnclaveOptions.Enabled).To(Equal(aws.Bool(true)))
1366+
})
1367+
})
13571368
})
13581369
})
13591370

0 commit comments

Comments
 (0)