Skip to content

Commit fd5ad82

Browse files
Add e2e test for installer flow (#579)
* Add e2e test for installer flow Signed-off-by: Shubham <[email protected]>
1 parent 5bc327f commit fd5ad82

File tree

9 files changed

+666
-1
lines changed

9 files changed

+666
-1
lines changed

.github/workflows/e2e.yml

+5
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,8 @@ jobs:
2727

2828
- name: Run PR-Blocking e2e tests
2929
run: yes | GINKGO_FOCUS="\[PR-Blocking\]" make test-e2e
30+
31+
- name: Run Installer e2e tests
32+
run: |
33+
sed -i 's/e2e\/cluster-template.yaml/e2e\/installer\/cluster-template.yaml/' test/e2e/config/provider.yaml
34+
yes | GINKGO_FOCUS="\[Installer\]" make test-e2e

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ cluster-templates: kustomize cluster-templates-v1beta1
138138

139139
cluster-templates-e2e: kustomize
140140
$(KUSTOMIZE) build $(BYOH_TEMPLATES)/v1beta1/templates/e2e --load-restrictor LoadRestrictionsNone > $(BYOH_TEMPLATES)/v1beta1/templates/e2e/cluster-template.yaml
141+
$(KUSTOMIZE) build $(BYOH_TEMPLATES)/v1beta1/templates/e2e/installer --load-restrictor LoadRestrictionsNone > $(BYOH_TEMPLATES)/v1beta1/templates/e2e/installer/cluster-template.yaml
141142

142143
define WARNING
143144
#####################################################################################################

common/installer/internal/algo/ubuntu20_4k8s.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ modprobe overlay && modprobe br_netfilter
114114
tar -C / -xvf "$BUNDLE_PATH/conf.tar" && sysctl --system
115115
116116
## installing deb packages
117-
for pkg in cri-tools kubernetes-cni kubectl kubeadm kubelet; do
117+
for pkg in cri-tools kubernetes-cni kubectl kubelet kubeadm; do
118118
dpkg --install "$BUNDLE_PATH/$pkg.deb" && apt-mark hold $pkg
119119
done
120120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
apiVersion: v1
2+
binaryData: null
3+
data: ${CNI_RESOURCES}
4+
kind: ConfigMap
5+
metadata:
6+
name: cni-${CLUSTER_NAME}-crs-0
7+
---
8+
apiVersion: addons.cluster.x-k8s.io/v1beta1
9+
kind: ClusterResourceSet
10+
metadata:
11+
name: ${CLUSTER_NAME}-crs-0
12+
spec:
13+
clusterSelector:
14+
matchLabels:
15+
cni: ${CLUSTER_NAME}-crs-0
16+
resources:
17+
- kind: ConfigMap
18+
name: cni-${CLUSTER_NAME}-crs-0
19+
strategy: ApplyOnce
20+
---
21+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
22+
kind: KubeadmConfigTemplate
23+
metadata:
24+
name: ${CLUSTER_NAME}-md-0
25+
spec:
26+
template:
27+
spec:
28+
joinConfiguration:
29+
nodeRegistration:
30+
kubeletExtraArgs:
31+
cgroup-driver: cgroupfs
32+
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
33+
---
34+
apiVersion: cluster.x-k8s.io/v1beta1
35+
kind: Cluster
36+
metadata:
37+
labels:
38+
cni: ${CLUSTER_NAME}-crs-0
39+
crs: "true"
40+
name: ${CLUSTER_NAME}
41+
spec:
42+
clusterNetwork:
43+
pods:
44+
cidrBlocks:
45+
- 192.168.0.0/16
46+
serviceDomain: cluster.local
47+
services:
48+
cidrBlocks:
49+
- 10.128.0.0/12
50+
controlPlaneRef:
51+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
52+
kind: KubeadmControlPlane
53+
name: ${CLUSTER_NAME}-control-plane
54+
infrastructureRef:
55+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
56+
kind: ByoCluster
57+
name: ${CLUSTER_NAME}
58+
---
59+
apiVersion: cluster.x-k8s.io/v1beta1
60+
kind: MachineDeployment
61+
metadata:
62+
name: ${CLUSTER_NAME}-md-0
63+
spec:
64+
clusterName: ${CLUSTER_NAME}
65+
replicas: ${WORKER_MACHINE_COUNT}
66+
selector:
67+
matchLabels: null
68+
template:
69+
metadata:
70+
labels:
71+
nodepool: pool1
72+
spec:
73+
bootstrap:
74+
configRef:
75+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
76+
kind: KubeadmConfigTemplate
77+
name: ${CLUSTER_NAME}-md-0
78+
clusterName: ${CLUSTER_NAME}
79+
infrastructureRef:
80+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
81+
kind: ByoMachineTemplate
82+
name: ${CLUSTER_NAME}-md-0
83+
version: ${KUBERNETES_VERSION}
84+
---
85+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
86+
kind: KubeadmControlPlane
87+
metadata:
88+
labels:
89+
nodepool: pool0
90+
name: ${CLUSTER_NAME}-control-plane
91+
spec:
92+
kubeadmConfigSpec:
93+
clusterConfiguration:
94+
apiServer:
95+
certSANs:
96+
- localhost
97+
- 127.0.0.1
98+
- 0.0.0.0
99+
- host.docker.internal
100+
controllerManager:
101+
extraArgs:
102+
enable-hostpath-provisioner: "true"
103+
files:
104+
- content: |
105+
apiVersion: v1
106+
kind: Pod
107+
metadata:
108+
creationTimestamp: null
109+
name: kube-vip
110+
namespace: kube-system
111+
spec:
112+
containers:
113+
- args:
114+
- manager
115+
env:
116+
- name: cp_enable
117+
value: "true"
118+
- name: vip_arp
119+
value: "true"
120+
- name: vip_leaderelection
121+
value: "true"
122+
- name: vip_address
123+
value: ${CONTROL_PLANE_ENDPOINT_IP}
124+
- name: vip_interface
125+
value: {{ .DefaultNetworkInterfaceName }}
126+
- name: vip_leaseduration
127+
value: "15"
128+
- name: vip_renewdeadline
129+
value: "10"
130+
- name: vip_retryperiod
131+
value: "2"
132+
image: ghcr.io/kube-vip/kube-vip:v0.4.1
133+
imagePullPolicy: IfNotPresent
134+
name: kube-vip
135+
resources: {}
136+
securityContext:
137+
capabilities:
138+
add:
139+
- NET_ADMIN
140+
- NET_RAW
141+
volumeMounts:
142+
- mountPath: /etc/kubernetes/admin.conf
143+
name: kubeconfig
144+
hostNetwork: true
145+
hostAliases:
146+
- hostnames:
147+
- kubernetes
148+
ip: 127.0.0.1
149+
volumes:
150+
- hostPath:
151+
path: /etc/kubernetes/admin.conf
152+
type: FileOrCreate
153+
name: kubeconfig
154+
status: {}
155+
owner: root:root
156+
path: /etc/kubernetes/manifests/kube-vip.yaml
157+
initConfiguration:
158+
nodeRegistration:
159+
criSocket: /var/run/containerd/containerd.sock
160+
ignorePreflightErrors:
161+
- Swap
162+
- DirAvailable--etc-kubernetes-manifests
163+
- FileAvailable--etc-kubernetes-kubelet.conf
164+
kubeletExtraArgs:
165+
cgroup-driver: cgroupfs
166+
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
167+
joinConfiguration:
168+
nodeRegistration:
169+
criSocket: /var/run/containerd/containerd.sock
170+
ignorePreflightErrors:
171+
- Swap
172+
- DirAvailable--etc-kubernetes-manifests
173+
- FileAvailable--etc-kubernetes-kubelet.conf
174+
kubeletExtraArgs:
175+
cgroup-driver: cgroupfs
176+
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
177+
machineTemplate:
178+
infrastructureRef:
179+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
180+
kind: ByoMachineTemplate
181+
name: ${CLUSTER_NAME}-control-plane
182+
namespace: ${NAMESPACE}
183+
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
184+
version: ${KUBERNETES_VERSION}
185+
---
186+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
187+
kind: ByoCluster
188+
metadata:
189+
name: ${CLUSTER_NAME}
190+
spec:
191+
bundleLookupBaseRegistry: projects.registry.vmware.com/cluster_api_provider_bringyourownhost
192+
bundleLookupTag: ${BUNDLE_LOOKUP_TAG}
193+
controlPlaneEndpoint:
194+
host: ${CONTROL_PLANE_ENDPOINT_IP}
195+
port: 6443
196+
---
197+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
198+
kind: ByoMachineTemplate
199+
metadata:
200+
name: ${CLUSTER_NAME}-control-plane
201+
spec:
202+
template:
203+
spec:
204+
installerRef:
205+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
206+
kind: K8sInstallerConfigTemplate
207+
name: ${CLUSTER_NAME}-control-plane
208+
namespace: ${NAMESPACE}
209+
---
210+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
211+
kind: ByoMachineTemplate
212+
metadata:
213+
name: ${CLUSTER_NAME}-md-0
214+
spec:
215+
template:
216+
spec:
217+
installerRef:
218+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
219+
kind: K8sInstallerConfigTemplate
220+
name: ${CLUSTER_NAME}-md-0
221+
namespace: ${NAMESPACE}
222+
---
223+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
224+
kind: K8sInstallerConfigTemplate
225+
metadata:
226+
name: ${CLUSTER_NAME}-control-plane
227+
spec:
228+
template:
229+
spec:
230+
bundleRepo: projects.registry.vmware.com/cluster_api_provider_bringyourownhost
231+
bundleType: k8s
232+
---
233+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
234+
kind: K8sInstallerConfigTemplate
235+
metadata:
236+
name: ${CLUSTER_NAME}-md-0
237+
spec:
238+
template:
239+
spec:
240+
bundleRepo: projects.registry.vmware.com/cluster_api_provider_bringyourownhost
241+
bundleType: k8s

0 commit comments

Comments
 (0)