Skip to content

Commit 314e59f

Browse files
perdasilvaPer G. da Silva
andauthored
Add regression test for bundles with webhooks (#2294)
Signed-off-by: Per G. da Silva <[email protected]> Co-authored-by: Per G. da Silva <[email protected]>
1 parent 1572d1c commit 314e59f

14 files changed

+1136
-0
lines changed

test/regression/convert/generate-manifests.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ func main() {
7777
watchNamespace: "argocd-system",
7878
bundle: "argocd-operator.v0.6.0",
7979
testCaseName: "own-namespace",
80+
}, {
81+
name: "Webhooks",
82+
installNamespace: "webhook-system",
83+
bundle: "webhook-operator.v0.0.5",
84+
testCaseName: "all-webhook-types",
8085
},
8186
} {
8287
bundlePath := filepath.Join(bundleRootDir, tc.bundle)
Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
apiVersion: operators.coreos.com/v1alpha1
2+
kind: ClusterServiceVersion
3+
metadata:
4+
annotations:
5+
alm-examples: |-
6+
[
7+
{
8+
"apiVersion": "webhook.operators.coreos.io/v1",
9+
"kind": "WebhookTest",
10+
"metadata": {
11+
"labels": {
12+
"app.kubernetes.io/managed-by": "kustomize",
13+
"app.kubernetes.io/name": "webhook-operator"
14+
},
15+
"name": "webhooktest-sample"
16+
},
17+
"spec": null
18+
},
19+
{
20+
"apiVersion": "webhook.operators.coreos.io/v2",
21+
"kind": "WebhookTest",
22+
"metadata": {
23+
"labels": {
24+
"app.kubernetes.io/managed-by": "kustomize",
25+
"app.kubernetes.io/name": "webhook-operator"
26+
},
27+
"name": "webhooktest-sample"
28+
},
29+
"spec": null
30+
}
31+
]
32+
capabilities: Basic Install
33+
operators.operatorframework.io/builder: operator-sdk-v1.41.1
34+
operators.operatorframework.io/project_layout: go.kubebuilder.io/v4
35+
name: webhook-operator.v0.0.5
36+
namespace: placeholder
37+
spec:
38+
apiservicedefinitions: {}
39+
customresourcedefinitions:
40+
owned:
41+
- description: WebhookTest is the Schema for the webhooktests API
42+
displayName: Webhook Test
43+
kind: WebhookTest
44+
name: webhooktests.webhook.operators.coreos.io
45+
version: v1
46+
- description: WebhookTest is the Schema for the webhooktests API
47+
displayName: Webhook Test
48+
kind: WebhookTest
49+
name: webhooktests.webhook.operators.coreos.io
50+
version: v2
51+
description: webhook-operator test fixture
52+
displayName: webhook-operator
53+
icon:
54+
- base64data: ""
55+
mediatype: ""
56+
install:
57+
spec:
58+
clusterPermissions:
59+
- rules:
60+
- apiGroups:
61+
- webhook.operators.coreos.io
62+
resources:
63+
- webhooktests
64+
verbs:
65+
- create
66+
- delete
67+
- get
68+
- list
69+
- patch
70+
- update
71+
- watch
72+
- apiGroups:
73+
- webhook.operators.coreos.io
74+
resources:
75+
- webhooktests/finalizers
76+
verbs:
77+
- update
78+
- apiGroups:
79+
- webhook.operators.coreos.io
80+
resources:
81+
- webhooktests/status
82+
verbs:
83+
- get
84+
- patch
85+
- update
86+
- apiGroups:
87+
- authentication.k8s.io
88+
resources:
89+
- tokenreviews
90+
verbs:
91+
- create
92+
- apiGroups:
93+
- authorization.k8s.io
94+
resources:
95+
- subjectaccessreviews
96+
verbs:
97+
- create
98+
serviceAccountName: webhook-operator-controller-manager
99+
deployments:
100+
- label:
101+
app.kubernetes.io/managed-by: kustomize
102+
app.kubernetes.io/name: webhook-operator
103+
control-plane: controller-manager
104+
name: webhook-operator-controller-manager
105+
spec:
106+
replicas: 1
107+
selector:
108+
matchLabels:
109+
app.kubernetes.io/name: webhook-operator
110+
control-plane: controller-manager
111+
strategy: {}
112+
template:
113+
metadata:
114+
annotations:
115+
kubectl.kubernetes.io/default-container: manager
116+
labels:
117+
app.kubernetes.io/name: webhook-operator
118+
control-plane: controller-manager
119+
spec:
120+
containers:
121+
- args:
122+
- --metrics-bind-address=:8443
123+
- --leader-elect
124+
- --health-probe-bind-address=:8081
125+
- --webhook-cert-path=/tmp/k8s-webhook-server/serving-certs
126+
command:
127+
- /manager
128+
image: quay.io/olmtest/webhook-operator:v0.0.5
129+
livenessProbe:
130+
httpGet:
131+
path: /healthz
132+
port: 8081
133+
initialDelaySeconds: 15
134+
periodSeconds: 20
135+
name: manager
136+
ports:
137+
- containerPort: 9443
138+
name: webhook-server
139+
protocol: TCP
140+
readinessProbe:
141+
httpGet:
142+
path: /readyz
143+
port: 8081
144+
initialDelaySeconds: 5
145+
periodSeconds: 10
146+
resources:
147+
limits:
148+
cpu: 500m
149+
memory: 128Mi
150+
requests:
151+
cpu: 10m
152+
memory: 64Mi
153+
securityContext:
154+
allowPrivilegeEscalation: false
155+
capabilities:
156+
drop:
157+
- ALL
158+
readOnlyRootFilesystem: true
159+
volumeMounts:
160+
- mountPath: /tmp/k8s-webhook-server/serving-certs
161+
name: webhook-certs
162+
readOnly: true
163+
securityContext:
164+
runAsNonRoot: true
165+
seccompProfile:
166+
type: RuntimeDefault
167+
serviceAccountName: webhook-operator-controller-manager
168+
terminationGracePeriodSeconds: 10
169+
volumes:
170+
- name: webhook-certs
171+
secret:
172+
secretName: webhook-server-cert
173+
permissions:
174+
- rules:
175+
- apiGroups:
176+
- ""
177+
resources:
178+
- configmaps
179+
verbs:
180+
- get
181+
- list
182+
- watch
183+
- create
184+
- update
185+
- patch
186+
- delete
187+
- apiGroups:
188+
- coordination.k8s.io
189+
resources:
190+
- leases
191+
verbs:
192+
- get
193+
- list
194+
- watch
195+
- create
196+
- update
197+
- patch
198+
- delete
199+
- apiGroups:
200+
- ""
201+
resources:
202+
- events
203+
verbs:
204+
- create
205+
- patch
206+
serviceAccountName: webhook-operator-controller-manager
207+
strategy: deployment
208+
installModes:
209+
- supported: false
210+
type: OwnNamespace
211+
- supported: false
212+
type: SingleNamespace
213+
- supported: false
214+
type: MultiNamespace
215+
- supported: true
216+
type: AllNamespaces
217+
keywords:
218+
- test
219+
- operator
220+
- webhooks
221+
links:
222+
- name: Webhook Operator
223+
url: https://webhook-operator.domain
224+
maintainers:
225+
226+
name: no-reply
227+
maturity: alpha
228+
provider:
229+
name: operator-framework
230+
version: 0.0.5
231+
webhookdefinitions:
232+
- admissionReviewVersions:
233+
- v1
234+
containerPort: 443
235+
conversionCRDs:
236+
- webhooktests.webhook.operators.coreos.io
237+
deploymentName: webhook-operator-controller-manager
238+
generateName: cwebhooktests.kb.io
239+
sideEffects: None
240+
targetPort: 9443
241+
type: ConversionWebhook
242+
webhookPath: /convert
243+
- admissionReviewVersions:
244+
- v1
245+
containerPort: 443
246+
deploymentName: webhook-operator-controller-manager
247+
failurePolicy: Fail
248+
generateName: mwebhooktest-v1.kb.io
249+
rules:
250+
- apiGroups:
251+
- webhook.operators.coreos.io
252+
apiVersions:
253+
- v1
254+
operations:
255+
- CREATE
256+
- UPDATE
257+
resources:
258+
- webhooktests
259+
sideEffects: None
260+
targetPort: 9443
261+
type: MutatingAdmissionWebhook
262+
webhookPath: /mutate-webhook-operators-coreos-io-v1-webhooktest
263+
- admissionReviewVersions:
264+
- v1
265+
containerPort: 443
266+
deploymentName: webhook-operator-controller-manager
267+
failurePolicy: Fail
268+
generateName: vwebhooktest-v1.kb.io
269+
rules:
270+
- apiGroups:
271+
- webhook.operators.coreos.io
272+
apiVersions:
273+
- v1
274+
operations:
275+
- CREATE
276+
- UPDATE
277+
resources:
278+
- webhooktests
279+
sideEffects: None
280+
targetPort: 9443
281+
type: ValidatingAdmissionWebhook
282+
webhookPath: /validate-webhook-operators-coreos-io-v1-webhooktest

0 commit comments

Comments
 (0)