Skip to content

Commit e0e9f6c

Browse files
committed
Add cluster creation test
1 parent 8cb4e39 commit e0e9f6c

File tree

3 files changed

+88
-0
lines changed

3 files changed

+88
-0
lines changed

cmd/kops/create_cluster_integration_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ func TestCreateClusterKarpenter(t *testing.T) {
195195
runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/karpenter", "v1alpha2")
196196
}
197197

198+
// TestCreateClusterZeroNodes runs kops create cluster --node-count=0
199+
func TestCreateClusterZeroNodes(t *testing.T) {
200+
runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/zero-nodes", "v1alpha2")
201+
}
202+
198203
func runCreateClusterIntegrationTest(t *testing.T, srcDir string, version string) {
199204
ctx := context.Background()
200205

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
apiVersion: kops.k8s.io/v1alpha2
2+
kind: Cluster
3+
metadata:
4+
creationTimestamp: "2017-01-01T00:00:00Z"
5+
name: minimal.example.com
6+
spec:
7+
api:
8+
loadBalancer:
9+
class: Network
10+
type: Public
11+
authorization:
12+
rbac: {}
13+
channel: stable
14+
cloudProvider: aws
15+
configBase: memfs://tests/minimal.example.com
16+
etcdClusters:
17+
- cpuRequest: 200m
18+
etcdMembers:
19+
- encryptedVolume: true
20+
instanceGroup: control-plane-us-test-1a
21+
name: a
22+
manager:
23+
backupRetentionDays: 90
24+
memoryRequest: 100Mi
25+
name: main
26+
- cpuRequest: 100m
27+
etcdMembers:
28+
- encryptedVolume: true
29+
instanceGroup: control-plane-us-test-1a
30+
name: a
31+
manager:
32+
backupRetentionDays: 90
33+
memoryRequest: 100Mi
34+
name: events
35+
iam:
36+
allowContainerRegistry: true
37+
legacy: false
38+
kubelet:
39+
anonymousAuth: false
40+
kubernetesApiAccess:
41+
- 0.0.0.0/0
42+
- ::/0
43+
kubernetesVersion: v1.32.0
44+
networkCIDR: 172.20.0.0/16
45+
networking:
46+
cni: {}
47+
nonMasqueradeCIDR: 100.64.0.0/10
48+
sshAccess:
49+
- 0.0.0.0/0
50+
- ::/0
51+
subnets:
52+
- cidr: 172.20.0.0/16
53+
name: us-test-1a
54+
type: Public
55+
zone: us-test-1a
56+
topology:
57+
dns:
58+
type: None
59+
60+
---
61+
62+
apiVersion: kops.k8s.io/v1alpha2
63+
kind: InstanceGroup
64+
metadata:
65+
creationTimestamp: "2017-01-01T00:00:00Z"
66+
labels:
67+
kops.k8s.io/cluster: minimal.example.com
68+
name: control-plane-us-test-1a
69+
spec:
70+
image: 099720109477/ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-20250610
71+
machineType: m3.medium
72+
maxSize: 1
73+
minSize: 1
74+
role: Master
75+
subnets:
76+
- us-test-1a
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ClusterName: minimal.example.com
2+
Zones:
3+
- us-test-1a
4+
CloudProvider: aws
5+
Networking: cni
6+
KubernetesVersion: v1.32.0
7+
NodeCount: 0

0 commit comments

Comments
 (0)