Skip to content

Commit 0e54ea1

Browse files
committed
Added test
1 parent fa051d4 commit 0e54ea1

File tree

2 files changed

+253
-0
lines changed

2 files changed

+253
-0
lines changed

test/e2e/helm_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,27 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
206206
Expect(err).ToNot(HaveOccurred())
207207
Expect(manifests).To(Equal(string(expectedManifests)))
208208
})
209+
It("should deploy core and infra with feature gates enabled", func() {
210+
manifests, err := helmChart.Run(map[string]string{
211+
"configSecret.name": "aws-variables",
212+
"configSecret.namespace": "default",
213+
"infrastructure": "aws:v2.4.0",
214+
"addon": "helm:",
215+
"image.manager.tag": "v0.9.1",
216+
"cert-manager.enabled": "false",
217+
"cert-manager.installCRDs": "false",
218+
"core": "cluster-api:v1.6.2",
219+
"manager.featureGates.core.ClusterTopology": "true",
220+
"manager.featureGates.core.MachinePool": "true",
221+
"manager.featureGates.aws.ClusterTopology": "true",
222+
"manager.featureGates.aws.MachinePool": "true",
223+
"manager.featureGates.aws.EKSEnableIAM": "true",
224+
"manager.featureGates.aws.EKSAllowAddRoles": "true",
225+
})
226+
Expect(err).ToNot(HaveOccurred())
227+
Expect(manifests).ToNot(BeEmpty())
228+
expectedManifests, err := os.ReadFile(filepath.Join(customManifestsFolder, "feature-gates.yaml"))
229+
Expect(err).ToNot(HaveOccurred())
230+
Expect(manifests).To(Equal(string(expectedManifests)))
231+
})
209232
})

test/e2e/resources/feature-gates.yaml

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
---
2+
# Source: cluster-api-operator/templates/deployment.yaml
3+
apiVersion: apps/v1
4+
kind: Deployment
5+
metadata:
6+
name: capi-cluster-api-operator
7+
namespace: 'default'
8+
labels:
9+
app: cluster-api-operator
10+
app.kubernetes.io/name: cluster-api-operator
11+
app.kubernetes.io/instance: capi
12+
app.kubernetes.io/component: "controller"
13+
control-plane: controller-manager
14+
clusterctl.cluster.x-k8s.io/core: capi-operator
15+
spec:
16+
replicas: 1
17+
selector:
18+
matchLabels:
19+
app.kubernetes.io/name: cluster-api-operator
20+
app.kubernetes.io/instance: capi
21+
app.kubernetes.io/component: "controller"
22+
control-plane: controller-manager
23+
clusterctl.cluster.x-k8s.io/core: capi-operator
24+
template:
25+
metadata:
26+
labels:
27+
app: cluster-api-operator
28+
app.kubernetes.io/name: cluster-api-operator
29+
app.kubernetes.io/instance: capi
30+
app.kubernetes.io/component: "controller"
31+
control-plane: controller-manager
32+
clusterctl.cluster.x-k8s.io/core: capi-operator
33+
spec:
34+
containers:
35+
- args:
36+
- --v=2
37+
- --health-addr=:8081
38+
- --metrics-bind-addr=127.0.0.1:8080
39+
- --diagnostics-address=8443
40+
- --leader-elect=true
41+
command:
42+
- /manager
43+
image: "gcr.io/k8s-staging-capi-operator/cluster-api-operator:v0.9.1"
44+
imagePullPolicy: IfNotPresent
45+
name: manager
46+
ports:
47+
- containerPort: 9443
48+
name: webhook-server
49+
protocol: TCP
50+
resources:
51+
limits:
52+
cpu: 100m
53+
memory: 150Mi
54+
requests:
55+
cpu: 100m
56+
memory: 100Mi
57+
volumeMounts:
58+
- mountPath: /tmp/k8s-webhook-server/serving-certs
59+
name: cert
60+
readOnly: true
61+
terminationGracePeriodSeconds: 10
62+
volumes:
63+
- name: cert
64+
secret:
65+
defaultMode: 420
66+
secretName: capi-operator-webhook-service-cert
67+
affinity:
68+
nodeAffinity:
69+
requiredDuringSchedulingIgnoredDuringExecution:
70+
nodeSelectorTerms:
71+
- matchExpressions:
72+
- key: kubernetes.io/arch
73+
operator: In
74+
values:
75+
- amd64
76+
- arm64
77+
- ppc64le
78+
- key: kubernetes.io/os
79+
operator: In
80+
values:
81+
- linux
82+
tolerations:
83+
- effect: NoSchedule
84+
key: node-role.kubernetes.io/master
85+
- effect: NoSchedule
86+
key: node-role.kubernetes.io/control-plane
87+
---
88+
# Source: cluster-api-operator/templates/addon.yaml
89+
# Addon provider
90+
---
91+
# Source: cluster-api-operator/templates/bootstrap.yaml
92+
# Bootstrap provider
93+
---
94+
# Source: cluster-api-operator/templates/control-plane.yaml
95+
# Control plane provider
96+
---
97+
# Source: cluster-api-operator/templates/core-conditions.yaml
98+
# Deploy core components if not specified
99+
---
100+
# Source: cluster-api-operator/templates/core.yaml
101+
# Core provider
102+
---
103+
# Source: cluster-api-operator/templates/infra-conditions.yaml
104+
# Deploy bootstrap, and infrastructure components if not specified
105+
---
106+
# Source: cluster-api-operator/templates/infra.yaml
107+
# Infrastructure providers
108+
---
109+
# Source: cluster-api-operator/templates/addon.yaml
110+
apiVersion: v1
111+
kind: Namespace
112+
metadata:
113+
annotations:
114+
"helm.sh/hook": "post-install"
115+
"helm.sh/hook-weight": "1"
116+
name: helm-addon-system
117+
---
118+
# Source: cluster-api-operator/templates/core.yaml
119+
apiVersion: v1
120+
kind: Namespace
121+
metadata:
122+
annotations:
123+
"helm.sh/hook": "post-install"
124+
"helm.sh/hook-weight": "1"
125+
name: capi-system
126+
---
127+
# Source: cluster-api-operator/templates/infra-conditions.yaml
128+
apiVersion: v1
129+
kind: Namespace
130+
metadata:
131+
annotations:
132+
"helm.sh/hook": "post-install"
133+
"helm.sh/hook-weight": "1"
134+
name: capi-kubeadm-bootstrap-system
135+
---
136+
# Source: cluster-api-operator/templates/infra-conditions.yaml
137+
apiVersion: v1
138+
kind: Namespace
139+
metadata:
140+
annotations:
141+
"helm.sh/hook": "post-install"
142+
"helm.sh/hook-weight": "1"
143+
name: capi-kubeadm-control-plane-system
144+
---
145+
# Source: cluster-api-operator/templates/infra.yaml
146+
apiVersion: v1
147+
kind: Namespace
148+
metadata:
149+
annotations:
150+
"helm.sh/hook": "post-install"
151+
"helm.sh/hook-weight": "1"
152+
name: aws-infrastructure-system
153+
---
154+
# Source: cluster-api-operator/templates/addon.yaml
155+
apiVersion: operator.cluster.x-k8s.io/v1alpha2
156+
kind: AddonProvider
157+
metadata:
158+
name: helm
159+
namespace: helm-addon-system
160+
annotations:
161+
"helm.sh/hook": "post-install"
162+
"helm.sh/hook-weight": "2"
163+
---
164+
# Source: cluster-api-operator/templates/infra-conditions.yaml
165+
apiVersion: operator.cluster.x-k8s.io/v1alpha2
166+
kind: BootstrapProvider
167+
metadata:
168+
name: kubeadm
169+
namespace: capi-kubeadm-bootstrap-system
170+
annotations:
171+
"helm.sh/hook": "post-install"
172+
"helm.sh/hook-weight": "2"
173+
spec:
174+
configSecret:
175+
name: aws-variables
176+
namespace: default
177+
---
178+
# Source: cluster-api-operator/templates/infra-conditions.yaml
179+
apiVersion: operator.cluster.x-k8s.io/v1alpha2
180+
kind: ControlPlaneProvider
181+
metadata:
182+
name: kubeadm
183+
namespace: capi-kubeadm-control-plane-system
184+
annotations:
185+
"helm.sh/hook": "post-install"
186+
"helm.sh/hook-weight": "2"
187+
spec:
188+
configSecret:
189+
name: aws-variables
190+
namespace: default
191+
---
192+
# Source: cluster-api-operator/templates/core.yaml
193+
apiVersion: operator.cluster.x-k8s.io/v1alpha2
194+
kind: CoreProvider
195+
metadata:
196+
name: cluster-api
197+
namespace: capi-system
198+
annotations:
199+
"helm.sh/hook": "post-install"
200+
"helm.sh/hook-weight": "2"
201+
spec:
202+
version: v1.6.2
203+
manager:
204+
featureGates:
205+
ClusterTopology: true
206+
MachinePool: true
207+
configSecret:
208+
name: aws-variables
209+
namespace: default
210+
---
211+
# Source: cluster-api-operator/templates/infra.yaml
212+
apiVersion: operator.cluster.x-k8s.io/v1alpha2
213+
kind: InfrastructureProvider
214+
metadata:
215+
name: aws
216+
namespace: aws-infrastructure-system
217+
annotations:
218+
"helm.sh/hook": "post-install"
219+
"helm.sh/hook-weight": "2"
220+
spec:
221+
version: v2.4.0
222+
manager:
223+
featureGates:
224+
ClusterTopology: true
225+
EKSAllowAddRoles: true
226+
EKSEnableIAM: true
227+
MachinePool: true
228+
configSecret:
229+
name: aws-variables
230+
namespace: default

0 commit comments

Comments
 (0)