Skip to content

Commit de3ab56

Browse files
authored
Merge pull request #8 from stackhpc/zuul_ci
Add Operator deployment to CI/CD
2 parents 0767fa0 + 5308368 commit de3ab56

File tree

7 files changed

+374
-1
lines changed

7 files changed

+374
-1
lines changed

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ jobs:
2727
2828
- name: Run playbook
2929
run: >
30-
ansible-playbook -i ansible/inventory ansible/run.yml
30+
ansible-playbook -i ansible/inventory ansible/run.yml --check --diff
3131
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
zuul_operator_additional: []
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
---
2+
zuul_operator_crd: |
3+
apiVersion: apiextensions.k8s.io/v1
4+
kind: CustomResourceDefinition
5+
metadata:
6+
name: zuuls.operator.zuul-ci.org
7+
spec:
8+
group: operator.zuul-ci.org
9+
names:
10+
kind: Zuul
11+
listKind: ZuulList
12+
plural: zuuls
13+
singular: zuul
14+
shortNames:
15+
- zuul
16+
scope: Namespaced
17+
versions:
18+
- name: v1alpha1
19+
served: false
20+
storage: false
21+
schema:
22+
openAPIV3Schema:
23+
type: object
24+
- name: v1alpha2
25+
served: true
26+
storage: true
27+
schema:
28+
openAPIV3Schema:
29+
type: object
30+
properties:
31+
spec:
32+
type: object
33+
properties:
34+
imagePrefix:
35+
type: string
36+
imagePullSecrets:
37+
type: array
38+
items:
39+
type: string
40+
zuulImageVersion:
41+
type: string
42+
zuulPreviewImageVersion:
43+
type: string
44+
zuulRegistryImageVersion:
45+
type: string
46+
nodepoolImageVersion:
47+
type: string
48+
database:
49+
type: object
50+
properties:
51+
secretName:
52+
type: string
53+
allowUnsafeConfig:
54+
type: boolean
55+
default: false
56+
zookeeper:
57+
type: object
58+
properties:
59+
hosts:
60+
type: string
61+
secretName:
62+
type: string
63+
storageClassName:
64+
type: string
65+
env:
66+
type: array
67+
items:
68+
type: object
69+
properties:
70+
name:
71+
type: string
72+
value:
73+
type: string
74+
scheduler:
75+
type: object
76+
properties:
77+
config:
78+
type: object
79+
properties:
80+
secretName:
81+
type: string
82+
count:
83+
type: integer
84+
default: 1
85+
minimum: 1
86+
storageClassName:
87+
type: string
88+
launcher:
89+
type: object
90+
properties:
91+
config:
92+
type: object
93+
properties:
94+
secretName:
95+
type: string
96+
executor:
97+
type: object
98+
properties:
99+
count:
100+
type: integer
101+
default: 1
102+
minimum: 1
103+
sshkey:
104+
type: object
105+
properties:
106+
secretName:
107+
type: string
108+
terminationGracePeriodSeconds:
109+
type: integer
110+
default: 21600
111+
minimum: 0
112+
merger:
113+
type: object
114+
properties:
115+
count:
116+
type: integer
117+
git_user_email:
118+
type: string
119+
git_user_name:
120+
type: string
121+
web:
122+
type: object
123+
properties:
124+
count:
125+
type: integer
126+
default: 1
127+
status_url:
128+
type: string
129+
fingergw:
130+
type: object
131+
properties:
132+
count:
133+
type: integer
134+
default: 1
135+
connections:
136+
type: object
137+
x-kubernetes-preserve-unknown-fields: true
138+
externalConfig:
139+
type: object
140+
x-kubernetes-preserve-unknown-fields: true
141+
jobVolumes:
142+
type: array
143+
items:
144+
type: object
145+
properties:
146+
context:
147+
type: string
148+
pattern: ^(trusted|untrusted)$
149+
access:
150+
type: string
151+
pattern: ^(rw|ro)$
152+
path:
153+
type: string
154+
volume:
155+
type: object
156+
properties:
157+
name:
158+
type: string
159+
hostPath:
160+
type: object
161+
properties:
162+
path:
163+
type: string
164+
type:
165+
type: string
166+
preview:
167+
type: object
168+
properties:
169+
count:
170+
type: integer
171+
default: 0
172+
registry:
173+
type: object
174+
properties:
175+
count:
176+
type: integer
177+
default: 0
178+
volumeSize:
179+
type: string
180+
default: "80G"
181+
tls:
182+
type: object
183+
properties:
184+
secretName:
185+
type: string
186+
config:
187+
type: object
188+
properties:
189+
secretName:
190+
type: string
191+
storageClassName:
192+
type: string
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
zuul_operator_operator: |
3+
apiVersion: apps/v1
4+
kind: Deployment
5+
metadata:
6+
name: zuul-operator
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
name: zuul-operator
12+
template:
13+
metadata:
14+
labels:
15+
name: zuul-operator
16+
spec:
17+
serviceAccountName: zuul-operator
18+
containers:
19+
- name: operator
20+
image: "quay.io/zuul-ci/zuul-operator"
21+
imagePullPolicy: "IfNotPresent"
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
zuul_operator_rbac: |
3+
apiVersion: v1
4+
kind: ServiceAccount
5+
metadata:
6+
name: zuul-operator
7+
8+
---
9+
10+
apiVersion: rbac.authorization.k8s.io/v1
11+
kind: ClusterRole
12+
metadata:
13+
name: zuul-operator
14+
rules:
15+
- apiGroups:
16+
- ""
17+
resources:
18+
- pods
19+
- pods/exec
20+
- services
21+
- services/finalizers
22+
- endpoints
23+
- persistentvolumeclaims
24+
- events
25+
- configmaps
26+
- secrets
27+
- ingresses
28+
- namespaces
29+
verbs:
30+
- create
31+
- delete
32+
- get
33+
- list
34+
- patch
35+
- update
36+
- watch
37+
- apiGroups:
38+
- apps
39+
resources:
40+
- deployments
41+
- daemonsets
42+
- replicasets
43+
- statefulsets
44+
verbs:
45+
- create
46+
- delete
47+
- get
48+
- list
49+
- patch
50+
- update
51+
- watch
52+
- apiGroups:
53+
- networking.k8s.io
54+
resources:
55+
- ingresses
56+
verbs:
57+
- create
58+
- delete
59+
- get
60+
- list
61+
- patch
62+
- update
63+
- watch
64+
- apiGroups:
65+
- policy
66+
resources:
67+
- poddisruptionbudgets
68+
verbs:
69+
- create
70+
- delete
71+
- get
72+
- list
73+
- patch
74+
- update
75+
- watch
76+
- apiGroups:
77+
- apps
78+
resourceNames:
79+
- zuul-operator
80+
resources:
81+
- deployments/finalizers
82+
verbs:
83+
- update
84+
- apiGroups:
85+
- apps
86+
resources:
87+
- replicasets
88+
- deployments
89+
verbs:
90+
- get
91+
- apiGroups:
92+
- operator.zuul-ci.org
93+
- cert-manager.io
94+
- pxc.percona.com
95+
resources:
96+
- '*'
97+
verbs:
98+
- create
99+
- delete
100+
- get
101+
- list
102+
- patch
103+
- update
104+
- watch
105+
- apiGroups:
106+
- monitoring.coreos.com
107+
resources:
108+
- servicemonitors
109+
verbs:
110+
- get
111+
- create
112+
113+
---
114+
115+
kind: ClusterRoleBinding
116+
apiVersion: rbac.authorization.k8s.io/v1
117+
metadata:
118+
name: zuul-operator
119+
subjects:
120+
- kind: ServiceAccount
121+
name: zuul-operator
122+
namespace: zuul
123+
roleRef:
124+
kind: ClusterRole
125+
name: cluster-admin #zuul-operator
126+
apiGroup: rbac.authorization.k8s.io
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
zuul_operator_secrets: []

ansible/run.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,33 @@
1010
api_version: v1
1111
kind: Namespace
1212
state: present
13+
14+
- name: Ensure CRDs
15+
kubernetes.core.k8s:
16+
definition: "{{ zuul_operator_crd }}"
17+
namespace: "zuul"
18+
state: present
19+
20+
- name: Ensure RBAC
21+
kubernetes.core.k8s:
22+
namespace: "zuul"
23+
definition: "{{ zuul_operator_rbac }}"
24+
state: present
25+
26+
- name: Ensure Operator
27+
kubernetes.core.k8s:
28+
definition: "{{ zuul_operator_operator }}"
29+
namespace: "zuul"
30+
state: present
31+
32+
- name: Ensure Secrets
33+
kubernetes.core.k8s:
34+
namespace: "zuul"
35+
state: present
36+
loop: "{{ zuul_operator_secrets }}"
37+
38+
- name: Ensure additional config
39+
kubernetes.core.k8s:
40+
namespace: "zuul"
41+
state: present
42+
loop: "{{ zuul_operator_additional }}"

0 commit comments

Comments
 (0)