Skip to content

Commit

Permalink
Remove support for launch configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
bharath-123 authored and hakman committed Mar 9, 2021
1 parent 6ce35f9 commit 0c0767c
Show file tree
Hide file tree
Showing 28 changed files with 50 additions and 4,091 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
7 changes: 2 additions & 5 deletions k8s/crds/kops.k8s.io_instancegroups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -751,11 +751,8 @@ spec:
x-kubernetes-int-or-string: true
type: object
rootVolumeDeleteOnTermination:
description: 'RootVolumeDeleteOnTermination configures root volume
retention policy upon instance termination. The root volume is deleted
by default. Cluster deletion does not remove retained root volumes.
NOTE: This setting applies only to the Launch Configuration and
does not affect Launch Templates.'
description: RootVolumeDeleteOnTermination is deprecated as of kOps
1.21 and has no effect
type: boolean
rootVolumeEncryption:
description: RootVolumeEncryption enables EBS root volume encryption
Expand Down
4 changes: 1 addition & 3 deletions pkg/apis/kops/instancegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ type InstanceGroupSpec struct {
RootVolumeThroughput *int32 `json:"rootVolumeThroughput,omitempty"`
// RootVolumeOptimization enables EBS optimization for an instance
RootVolumeOptimization *bool `json:"rootVolumeOptimization,omitempty"`
// RootVolumeDeleteOnTermination configures root volume retention policy upon instance termination.
// The root volume is deleted by default. Cluster deletion does not remove retained root volumes.
// NOTE: This setting applies only to the Launch Configuration and does not affect Launch Templates.
// RootVolumeDeleteOnTermination is deprecated as of kOps 1.21 and has no effect
RootVolumeDeleteOnTermination *bool `json:"rootVolumeDeleteOnTermination,omitempty"`
// RootVolumeEncryption enables EBS root volume encryption for an instance
RootVolumeEncryption *bool `json:"rootVolumeEncryption,omitempty"`
Expand Down
4 changes: 1 addition & 3 deletions pkg/apis/kops/v1alpha2/instancegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ type InstanceGroupSpec struct {
RootVolumeThroughput *int32 `json:"rootVolumeThroughput,omitempty"`
// RootVolumeOptimization enables EBS optimization for an instance
RootVolumeOptimization *bool `json:"rootVolumeOptimization,omitempty"`
// RootVolumeDeleteOnTermination configures root volume retention policy upon instance termination.
// The root volume is deleted by default. Cluster deletion does not remove retained root volumes.
// NOTE: This setting applies only to the Launch Configuration and does not affect Launch Templates.
// RootVolumeDeleteOnTermination is deprecated as of kOps 1.21 and has no effect
RootVolumeDeleteOnTermination *bool `json:"rootVolumeDeleteOnTermination,omitempty"`
// RootVolumeEncryption enables EBS root volume encryption for an instance
RootVolumeEncryption *bool `json:"rootVolumeEncryption,omitempty"`
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 0c0767c

Please sign in to comment.