Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gce tests lifecycle #8760

Merged
merged 2 commits into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions cmd/kops/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ func TestMinimal(t *testing.T) {
runTestAWS(t, "minimal.example.com", "minimal", "v1alpha2", false, 1, true, false, nil, true, false)
}

// TestMinimalGCE runs tests on a minimal GCE configuration
func TestMinimalGCE(t *testing.T) {
runTestGCE(t, "minimal-gce.example.com", "minimal_gce", nil, "v1alpha2", false, 1, true)
}

// TestRestrictAccess runs the test on a simple SG configuration, similar to kops create cluster minimal.example.com --ssh-access=$(IPS) --admin-access=$(IPS) --master-count=3
func TestRestrictAccess(t *testing.T) {
runTestAWS(t, "restrictaccess.example.com", "restrict_access", "v1alpha2", false, 1, true, false, nil, true, false)
Expand All @@ -71,7 +76,7 @@ func TestHA(t *testing.T) {
// TestHighAvailabilityGCE runs the test on a simple HA GCE configuration, similar to kops create cluster ha-gce.example.com
// --zones us-test1-a,us-test1-b,us-test1-c --master-count=3
func TestHighAvailabilityGCE(t *testing.T) {
runTestGCE(t, "ha-gce.example.com", "ha_gce", "v1alpha2", false, 3, true)
runTestGCE(t, "ha-gce.example.com", "ha_gce", nil, "v1alpha2", false, 3, true)
}

// TestComplex runs the test on a more complex configuration, intended to hit more of the edge cases
Expand Down Expand Up @@ -517,7 +522,7 @@ func runTestPhase(t *testing.T, clusterName string, srcDir string, version strin
runTest(t, h, clusterName, srcDir, version, private, zones, expectedFilenames, tfFileName, "", &phase, nil, sshKey)
}

func runTestGCE(t *testing.T, clusterName string, srcDir string, version string, private bool, zones int, sshKey bool) {
func runTestGCE(t *testing.T, clusterName string, srcDir string, lifecycleOverrides []string, version string, private bool, zones int, sshKey bool) {
featureflag.ParseFlags("+AlphaAllowGCE")

h := testutils.NewIntegrationTestHarness(t)
Expand All @@ -543,7 +548,7 @@ func runTestGCE(t *testing.T, clusterName string, srcDir string, version string,
expectedFilenames = append(expectedFilenames, prefix+"kops-k8s-io-instance-group-name")
}

runTest(t, h, clusterName, srcDir, version, private, zones, expectedFilenames, "", "", nil, nil, sshKey)
runTest(t, h, clusterName, srcDir, version, private, zones, expectedFilenames, "", "", nil, lifecycleOverrides, sshKey)
}

func runTestCloudformation(t *testing.T, clusterName string, srcDir string, version string, private bool, lifecycleOverrides []string, sshKey bool) {
Expand Down
97 changes: 97 additions & 0 deletions tests/integration/minimal_gce/expected-v1alpha2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
apiVersion: kops.k8s.io/v1alpha2
kind: Cluster
metadata:
creationTimestamp: "2017-01-01T00:00:00Z"
name: minimal-gce.example.com
spec:
api:
dns: {}
authorization:
rbac: {}
channel: stable
cloudProvider: gce
configBase: memfs://tests/ha-gce.example.com
containerRuntime: docker
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: master-us-test1-a
name: a
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test1-a
name: a
memoryRequest: 100Mi
name: events
iam:
allowContainerRegistry: true
legacy: false
kubelet:
anonymousAuth: false
kubernetesApiAccess:
- 0.0.0.0/0
kubernetesVersion: v1.16.0
masterPublicName: api.minimal-gce.example.com
networking:
kubenet: {}
nonMasqueradeCIDR: 100.64.0.0/10
project: testproject
sshAccess:
- 0.0.0.0/0
subnets:
- name: us-test1
region: us-test1
type: Public
topology:
dns:
type: Public
masters: public
nodes: public

---

apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: "2017-01-01T00:00:00Z"
labels:
kops.k8s.io/cluster: minimal-gce.example.com
name: master-us-test1-a
spec:
image: cos-cloud/cos-stable-65-10323-99-0
machineType: n1-standard-1
maxSize: 1
minSize: 1
nodeLabels:
cloud.google.com/metadata-proxy-ready: "true"
kops.k8s.io/instancegroup: master-us-test1-a
role: Master
subnets:
- us-test1
zones:
- us-test1-a

---

apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: "2017-01-01T00:00:00Z"
labels:
kops.k8s.io/cluster: minimal-gce.example.com
name: nodes
spec:
image: cos-cloud/cos-stable-65-10323-99-0
machineType: n1-standard-2
maxSize: 2
minSize: 2
nodeLabels:
cloud.google.com/metadata-proxy-ready: "true"
kops.k8s.io/instancegroup: nodes
role: Node
subnets:
- us-test1
zones:
- us-test1-a
5 changes: 5 additions & 0 deletions tests/integration/minimal_gce/options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ClusterName: minimal-gce.example.com
Zones:
- us-test1-a
Cloud: gce
KubernetesVersion: v1.16.0
1 change: 1 addition & 0 deletions tests/integration/update_cluster/minimal_gce/id_rsa.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCtWu40XQo8dczLsCq0OWV+hxm9uV3WxeH9Kgh4sMzQxNtoU1pvW0XdjpkBesRKGoolfWeCLXWxpyQb1IaiMkKoz7MdhQ/6UKjMjP66aFWWp3pwD0uj0HuJ7tq4gKHKRYGTaZIRWpzUiANBrjugVgA+Sd7E/mYwc/DMXkIyRZbvhQ==
83 changes: 83 additions & 0 deletions tests/integration/update_cluster/minimal_gce/in-v1alpha2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
apiVersion: kops.k8s.io/v1alpha2
kind: Cluster
metadata:
creationTimestamp: "2017-01-01T00:00:00Z"
name: minimal-gce.example.com
spec:
api:
dns: {}
authorization:
alwaysAllow: {}
channel: stable
cloudProvider: gce
configBase: memfs://tests/minimal-gce.example.com
etcdClusters:
- etcdMembers:
- instanceGroup: master-us-test1-a
name: "1"
name: main
- etcdMembers:
- instanceGroup: master-us-test1-a
name: "1"
name: events
iam:
legacy: false
kubernetesApiAccess:
- 0.0.0.0/0
kubernetesVersion: v1.14.0
masterPublicName: api.minimal-gce.example.com
networking:
kubenet: {}
nonMasqueradeCIDR: 100.64.0.0/10
project: testproject
sshAccess:
- 0.0.0.0/0
subnets:
- name: us-test1
region: us-test1
type: Public
topology:
dns:
type: Public
masters: public
nodes: public

---

apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: "2017-01-01T00:00:00Z"
labels:
kops.k8s.io/cluster: minimal-gce.example.com
name: master-us-test1-a
spec:
image: cos-cloud/cos-stable-57-9202-64-0
machineType: n1-standard-1
maxSize: 1
minSize: 1
role: Master
subnets:
- us-test1
zones:
- us-test1-a

---

apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: "2017-01-01T00:00:00Z"
labels:
kops.k8s.io/cluster: minimal-gce.example.com
name: nodes
spec:
image: cos-cloud/cos-stable-57-9202-64-0
machineType: n1-standard-2
maxSize: 2
minSize: 2
role: Node
subnets:
- us-test1
zones:
- us-test1-a
Loading