diff --git a/cmd/kops/create_cluster.go b/cmd/kops/create_cluster.go index 393807a962..08032184bf 100644 --- a/cmd/kops/create_cluster.go +++ b/cmd/kops/create_cluster.go @@ -438,7 +438,9 @@ func RunCreateCluster(f *util.Factory, out io.Writer, c *CreateClusterOptions) e for i, ig := range masters { m := &api.EtcdMemberSpec{} - m.EncryptedVolume = &c.EncryptVolume + if c.EncryptVolume { + m.EncryptedVolume = &c.EncryptVolume + } m.Name = names[i] m.InstanceGroup = fi.String(ig.ObjectMeta.Name) diff --git a/cmd/kops/create_cluster_integration_test.go b/cmd/kops/create_cluster_integration_test.go index 852ba7cc6b..2df1dc081e 100644 --- a/cmd/kops/create_cluster_integration_test.go +++ b/cmd/kops/create_cluster_integration_test.go @@ -42,6 +42,8 @@ func TestCreateClusterMinimal(t *testing.T) { func TestCreateClusterHA(t *testing.T) { runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/ha", "v1alpha1") runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/ha", "v1alpha2") + runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/ha_encrypt", "v1alpha1") + runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/ha_encrypt", "v1alpha2") } // TestCreateClusterHASharedZones tests kops create cluster when the master count is bigger than the numebr of zones diff --git a/tests/integration/create_cluster/ha_encrypt/expected-v1alpha1.yaml b/tests/integration/create_cluster/ha_encrypt/expected-v1alpha1.yaml new file mode 100644 index 0000000000..f9355c2da4 --- /dev/null +++ b/tests/integration/create_cluster/ha_encrypt/expected-v1alpha1.yaml @@ -0,0 +1,130 @@ +apiVersion: kops/v1alpha1 +kind: Cluster +metadata: + creationTimestamp: 2017-01-01T00:00:00Z + name: ha.example.com +spec: + adminAccess: + - 0.0.0.0/0 + api: + dns: {} + authorization: + alwaysAllow: {} + channel: stable + cloudProvider: aws + configBase: memfs://tests/ha.example.com + etcdClusters: + - etcdMembers: + - encryptedVolume: true + name: a + zone: us-test-1a + - encryptedVolume: true + name: b + zone: us-test-1b + - encryptedVolume: true + name: c + zone: us-test-1c + name: main + - etcdMembers: + - encryptedVolume: true + name: a + zone: us-test-1a + - encryptedVolume: true + name: b + zone: us-test-1b + - encryptedVolume: true + name: c + zone: us-test-1c + name: events + kubernetesVersion: v1.6.0-alpha.3 + masterPublicName: api.ha.example.com + networkCIDR: 172.20.0.0/16 + networking: + kubenet: {} + nonMasqueradeCIDR: 100.64.0.0/10 + topology: + dns: + type: Public + masters: public + nodes: public + zones: + - cidr: 172.20.32.0/19 + name: us-test-1a + - cidr: 172.20.64.0/19 + name: us-test-1b + - cidr: 172.20.96.0/19 + name: us-test-1c + +--- + +apiVersion: kops/v1alpha1 +kind: InstanceGroup +metadata: + creationTimestamp: 2017-01-01T00:00:00Z + labels: + kops.k8s.io/cluster: ha.example.com + name: master-us-test-1a +spec: + image: kope.io/k8s-1.5-debian-jessie-amd64-hvm-ebs-2017-01-09 + machineType: m3.medium + maxSize: 1 + minSize: 1 + role: Master + zones: + - us-test-1a + +--- + +apiVersion: kops/v1alpha1 +kind: InstanceGroup +metadata: + creationTimestamp: 2017-01-01T00:00:00Z + labels: + kops.k8s.io/cluster: ha.example.com + name: master-us-test-1b +spec: + image: kope.io/k8s-1.5-debian-jessie-amd64-hvm-ebs-2017-01-09 + machineType: m3.medium + maxSize: 1 + minSize: 1 + role: Master + zones: + - us-test-1b + +--- + +apiVersion: kops/v1alpha1 +kind: InstanceGroup +metadata: + creationTimestamp: 2017-01-01T00:00:00Z + labels: + kops.k8s.io/cluster: ha.example.com + name: master-us-test-1c +spec: + image: kope.io/k8s-1.5-debian-jessie-amd64-hvm-ebs-2017-01-09 + machineType: m3.medium + maxSize: 1 + minSize: 1 + role: Master + zones: + - us-test-1c + +--- + +apiVersion: kops/v1alpha1 +kind: InstanceGroup +metadata: + creationTimestamp: 2017-01-01T00:00:00Z + labels: + kops.k8s.io/cluster: ha.example.com + name: nodes +spec: + image: kope.io/k8s-1.5-debian-jessie-amd64-hvm-ebs-2017-01-09 + machineType: t2.medium + maxSize: 2 + minSize: 2 + role: Node + zones: + - us-test-1a + - us-test-1b + - us-test-1c diff --git a/tests/integration/create_cluster/ha_encrypt/expected-v1alpha2.yaml b/tests/integration/create_cluster/ha_encrypt/expected-v1alpha2.yaml new file mode 100644 index 0000000000..c59c68b520 --- /dev/null +++ b/tests/integration/create_cluster/ha_encrypt/expected-v1alpha2.yaml @@ -0,0 +1,138 @@ +apiVersion: kops/v1alpha2 +kind: Cluster +metadata: + creationTimestamp: 2017-01-01T00:00:00Z + name: ha.example.com +spec: + api: + dns: {} + authorization: + alwaysAllow: {} + channel: stable + cloudProvider: aws + configBase: memfs://tests/ha.example.com + etcdClusters: + - etcdMembers: + - encryptedVolume: true + instanceGroup: master-us-test-1a + name: a + - encryptedVolume: true + instanceGroup: master-us-test-1b + name: b + - encryptedVolume: true + instanceGroup: master-us-test-1c + name: c + name: main + - etcdMembers: + - encryptedVolume: true + instanceGroup: master-us-test-1a + name: a + - encryptedVolume: true + instanceGroup: master-us-test-1b + name: b + - encryptedVolume: true + instanceGroup: master-us-test-1c + name: c + name: events + kubernetesApiAccess: + - 0.0.0.0/0 + kubernetesVersion: v1.6.0-alpha.3 + masterPublicName: api.ha.example.com + networkCIDR: 172.20.0.0/16 + networking: + kubenet: {} + nonMasqueradeCIDR: 100.64.0.0/10 + sshAccess: + - 0.0.0.0/0 + subnets: + - cidr: 172.20.32.0/19 + name: us-test-1a + type: Public + zone: us-test-1a + - cidr: 172.20.64.0/19 + name: us-test-1b + type: Public + zone: us-test-1b + - cidr: 172.20.96.0/19 + name: us-test-1c + type: Public + zone: us-test-1c + topology: + dns: + type: Public + masters: public + nodes: public + +--- + +apiVersion: kops/v1alpha2 +kind: InstanceGroup +metadata: + creationTimestamp: 2017-01-01T00:00:00Z + labels: + kops.k8s.io/cluster: ha.example.com + name: master-us-test-1a +spec: + image: kope.io/k8s-1.5-debian-jessie-amd64-hvm-ebs-2017-01-09 + machineType: m3.medium + maxSize: 1 + minSize: 1 + role: Master + subnets: + - us-test-1a + +--- + +apiVersion: kops/v1alpha2 +kind: InstanceGroup +metadata: + creationTimestamp: 2017-01-01T00:00:00Z + labels: + kops.k8s.io/cluster: ha.example.com + name: master-us-test-1b +spec: + image: kope.io/k8s-1.5-debian-jessie-amd64-hvm-ebs-2017-01-09 + machineType: m3.medium + maxSize: 1 + minSize: 1 + role: Master + subnets: + - us-test-1b + +--- + +apiVersion: kops/v1alpha2 +kind: InstanceGroup +metadata: + creationTimestamp: 2017-01-01T00:00:00Z + labels: + kops.k8s.io/cluster: ha.example.com + name: master-us-test-1c +spec: + image: kope.io/k8s-1.5-debian-jessie-amd64-hvm-ebs-2017-01-09 + machineType: m3.medium + maxSize: 1 + minSize: 1 + role: Master + subnets: + - us-test-1c + +--- + +apiVersion: kops/v1alpha2 +kind: InstanceGroup +metadata: + creationTimestamp: 2017-01-01T00:00:00Z + labels: + kops.k8s.io/cluster: ha.example.com + name: nodes +spec: + image: kope.io/k8s-1.5-debian-jessie-amd64-hvm-ebs-2017-01-09 + machineType: t2.medium + maxSize: 2 + minSize: 2 + role: Node + subnets: + - us-test-1a + - us-test-1b + - us-test-1c diff --git a/tests/integration/create_cluster/ha_encrypt/options.yaml b/tests/integration/create_cluster/ha_encrypt/options.yaml new file mode 100644 index 0000000000..3bf96aebd7 --- /dev/null +++ b/tests/integration/create_cluster/ha_encrypt/options.yaml @@ -0,0 +1,12 @@ +ClusterName: ha.example.com +Zones: +- us-test-1a +- us-test-1b +- us-test-1c +MasterZones: +- us-test-1a +- us-test-1b +- us-test-1c +Cloud: aws +KubernetesVersion: v1.6.0-alpha.3 +EncryptVolume: true