Skip to content

Commit

Permalink
Remove launch configurations in favour of launch templates
Browse files Browse the repository at this point in the history
  • Loading branch information
bharath-123 committed Mar 8, 2021
1 parent 6ce35f9 commit 7fb8c30
Show file tree
Hide file tree
Showing 31 changed files with 95 additions and 4,105 deletions.
1 change: 0 additions & 1 deletion cloudmock/aws/mockautoscaling/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

143 changes: 0 additions & 143 deletions cloudmock/aws/mockautoscaling/launchconfigurations.go

This file was deleted.

35 changes: 5 additions & 30 deletions cmd/kops/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ type integrationTest struct {
expectPolicies bool
// expectServiceAccountRoles is true if we expect to assign per-ServiceAccount IAM roles (instead of just using the node roles)
expectServiceAccountRoles bool
launchConfiguration bool
lifecycleOverrides []string
sshKey bool
// caKey is true if we should use a provided ca.crt & ca.key as our CA
Expand Down Expand Up @@ -128,11 +127,6 @@ func (i *integrationTest) withPrivate() *integrationTest {
return i
}

func (i *integrationTest) withLaunchConfiguration() *integrationTest {
i.launchConfiguration = true
return i
}

func (i *integrationTest) withBastionUserData() *integrationTest {
i.bastionUserData = true
return i
Expand Down Expand Up @@ -347,18 +341,6 @@ func TestDockerCustom(t *testing.T) {
newIntegrationTest("docker.example.com", "docker-custom").runTestCloudformation(t)
}

// TestLaunchConfigurationASG tests ASGs using launch configurations instead of launch templates
func TestLaunchConfigurationASG(t *testing.T) {
featureflag.ParseFlags("-EnableLaunchTemplates")
unsetFeatureFlags := func() {
featureflag.ParseFlags("+EnableLaunchTemplates")
}
defer unsetFeatureFlags()

newIntegrationTest("launchtemplates.example.com", "launch_templates").withZones(3).withLaunchConfiguration().runTestTerraformAWS(t)
newIntegrationTest("launchtemplates.example.com", "launch_templates").withZones(3).withLaunchConfiguration().runTestCloudformation(t)
}

// TestPublicJWKS runs a simple configuration, but with UseServiceAccountIAM and PublicJWKS enabled
func TestPublicJWKS(t *testing.T) {
featureflag.ParseFlags("+UseServiceAccountIAM,+PublicJWKS")
Expand Down Expand Up @@ -536,22 +518,15 @@ func (i *integrationTest) runTestTerraformAWS(t *testing.T) {

expectedFilenames := []string{}

if i.launchConfiguration {
expectedFilenames = append(expectedFilenames, "aws_launch_configuration_nodes."+i.clusterName+"_user_data")
} else {
expectedFilenames = append(expectedFilenames, "aws_launch_template_nodes."+i.clusterName+"_user_data")
}
expectedFilenames = append(expectedFilenames, "aws_launch_template_nodes."+i.clusterName+"_user_data")

if i.sshKey {
expectedFilenames = append(expectedFilenames, "aws_key_pair_kubernetes."+i.clusterName+"-c4a6ed9aa889b9e2c39cd663eb9c7157_public_key")
}

for j := 0; j < i.zones; j++ {
zone := "us-test-1" + string([]byte{byte('a') + byte(j)})
if featureflag.EnableLaunchTemplates.Enabled() {
expectedFilenames = append(expectedFilenames, "aws_launch_template_master-"+zone+".masters."+i.clusterName+"_user_data")
} else {
expectedFilenames = append(expectedFilenames, "aws_launch_configuration_master-"+zone+".masters."+i.clusterName+"_user_data")
}
expectedFilenames = append(expectedFilenames, "aws_launch_template_master-"+zone+".masters."+i.clusterName+"_user_data")
}

if i.expectPolicies {
Expand Down Expand Up @@ -611,12 +586,12 @@ func (i *integrationTest) runTestPhase(t *testing.T, phase cloudup.Phase) {
}
} else if phase == cloudup.PhaseCluster {
expectedFilenames = []string{
"aws_launch_configuration_nodes." + i.clusterName + "_user_data",
"aws_launch_template_nodes." + i.clusterName + "_user_data",
}

for j := 0; j < i.zones; j++ {
zone := "us-test-1" + string([]byte{byte('a') + byte(j)})
s := "aws_launch_configuration_master-" + zone + ".masters." + i.clusterName + "_user_data"
s := "aws_launch_template_master-" + zone + ".masters." + i.clusterName + "_user_data"
expectedFilenames = append(expectedFilenames, s)
}
}
Expand Down
2 changes: 0 additions & 2 deletions pkg/featureflag/featureflag.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ var (
CacheNodeidentityInfo = New("CacheNodeidentityInfo", Bool(false))
// DNSPreCreate controls whether we pre-create DNS records.
DNSPreCreate = New("DNSPreCreate", Bool(true))
// EnableLaunchTemplates indicates we wish to switch to using launch templates rather than launchconfigurations
EnableLaunchTemplates = New("EnableLaunchTemplates", Bool(true))
//EnableExternalCloudController toggles the use of cloud-controller-manager introduced in v1.7
EnableExternalCloudController = New("EnableExternalCloudController", Bool(false))
// EnableExternalDNS enables external DNS
Expand Down
Loading

0 comments on commit 7fb8c30

Please sign in to comment.