Skip to content

Commit

Permalink
Adding tests for launchtemplate placement data
Browse files Browse the repository at this point in the history
Ensure that the data in awsnodetemplates ends up in the requests to
create launchtemplates
  • Loading branch information
Sebastian Cole committed Jun 5, 2023
1 parent a665d72 commit 1d93a3d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/providers/launchtemplate/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1644,6 +1644,19 @@ var _ = Describe("LaunchTemplates", func() {
Expect(len(input.LaunchTemplateData.NetworkInterfaces)).To(BeNumerically("==", 0))
})
})
Context("Placement Launch Template Configuration", func() {
It("should set 'LicenseSpecification' and 'Placement.HostResourceGroupArn' in the launch template", func() {
nodeTemplate.Spec.LicenseSpecifications = []string{"foo"}
nodeTemplate.Spec.Placement = v1alpha1.Placement{HostResourceGroupArn: "myhrg"}
ExpectApplied(ctx, env.Client, provisioner, nodeTemplate)
pod := coretest.UnschedulablePod()
ExpectProvisioned(ctx, env.Client, cluster, cloudProvider, prov, pod)
ExpectScheduled(ctx, env.Client, pod)
input := awsEnv.EC2API.CalledWithCreateLaunchTemplateInput.Pop()
Expect(len(input.LaunchTemplateData.LicenseSpecifications)).To(Equal("myLicense"))
Expect(len(*input.LaunchTemplateData.Placement.HostResourceGroupArn)).To(Equal("myhrg"))
})
})
Context("Kubelet Args", func() {
It("should specify the --dns-cluster-ip flag when clusterDNSIP is set", func() {
provisioner.Spec.KubeletConfiguration = &v1alpha5.KubeletConfiguration{ClusterDNS: []string{"10.0.10.100"}}
Expand Down
3 changes: 3 additions & 0 deletions website/content/en/preview/concepts/node-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ spec:
metadataOptions: { ... } # optional, configures IMDS for the instance
blockDeviceMappings: [ ... ] # optional, configures storage devices for the instance
detailedMonitoring: "..." # optional, configures detailed monitoring for the instance
licenseSpecifications: [ ... ] # optional, configures licenseSpecifications in aws launch templates
placement:
hostResourceGroupArn: "..." # optional, configures the Host Resource Group ARN to place instances on dedicated hosts
status:
subnets: { ... } # resolved subnets
securityGroups: { ... } # resolved security groups
Expand Down

0 comments on commit 1d93a3d

Please sign in to comment.