add tests and fix existed for --encrypt-volume option

This commit is contained in:
dima 2017-04-03 14:47:28 +02:00
parent 0da368476a
commit e7ddeb71ec
5 changed files with 285 additions and 1 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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