Add merger support

Also, update web and executors to use the replica count from the
spec.

Change-Id: Ifb9ce9d82a18e5b4dd2e30dd7968c2aa32cbeb4f
This commit is contained in:
James E. Blair 2021-04-07 13:50:48 -07:00
parent e503cef9d5
commit a0b182199e
2 changed files with 59 additions and 9 deletions

View File

@ -181,7 +181,7 @@ metadata:
app.kubernetes.io/part-of: zuul
app.kubernetes.io/component: zuul-web
spec:
replicas: {{ zuul_web.replicas }}
replicas: {{ spec.web.count }}
selector:
matchLabels:
app.kubernetes.io/name: zuul
@ -229,7 +229,7 @@ metadata:
app.kubernetes.io/component: zuul-executor
spec:
serviceName: zuul-executor
replicas: {{ zuul_executor.replicas }}
replicas: {{ spec.executor.count }}
podManagementPolicy: Parallel
selector:
matchLabels:
@ -300,3 +300,57 @@ spec:
{%- for volume in spec.get('jobVolumes', []) %}
- {{ volume.volume | zuul_to_json }}
{%- endfor %}
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: zuul-merger
labels:
app.kubernetes.io/name: zuul
app.kubernetes.io/instance: {{ instance_name }}
app.kubernetes.io/part-of: zuul
app.kubernetes.io/component: zuul-merger
spec:
serviceName: zuul-merger
replicas: {{ spec.merger.count }}
podManagementPolicy: Parallel
selector:
matchLabels:
app.kubernetes.io/name: zuul
app.kubernetes.io/instance: {{ instance_name }}
app.kubernetes.io/part-of: zuul
app.kubernetes.io/component: zuul-merger
template:
metadata:
labels:
app.kubernetes.io/name: zuul
app.kubernetes.io/instance: {{ instance_name }}
app.kubernetes.io/part-of: zuul
app.kubernetes.io/component: zuul-merger
annotations:
zuulConfSha: "{{ zuul_conf_sha }}"
spec:
securityContext:
runAsUser: 10001
runAsGroup: 10001
containers:
- name: merger
image: zuul/zuul-merger:{{ zuul_version }}
volumeMounts:
- name: zuul-config
mountPath: /etc/zuul
- name: zuul-var
mountPath: /var/lib/zuul
- name: zookeeper-client-tls
mountPath: /tls/client
readOnly: true
terminationGracePeriodSeconds: 3600
volumes:
- name: zuul-var
emptyDir: {}
- name: zuul-config
secret:
secretName: zuul-config
- name: zookeeper-client-tls
secret:
secretName: {{ spec.zookeeper.secretName }}

View File

@ -67,7 +67,9 @@ class Zuul:
self.spec.setdefault('scheduler', {})['tenant_config'] = \
'/etc/zuul/tenant/main.yaml'
ex = self.spec.setdefault('executor', {})
self.spec.setdefault('executor', {}).setdefault('count', 1)
self.spec.setdefault('merger', {}).setdefault('count', 0)
self.spec.setdefault('web', {}).setdefault('count', 1)
self.cert_manager = certmanager.CertManager(
self.api, self.namespace, self.log)
@ -293,12 +295,6 @@ class Zuul:
kw = {
'zuul_conf_sha': self.zuul_conf_sha,
'zuul_version': '4.1.0',
'zuul_web': {
'replicas': 3,
},
'zuul_executor': {
'replicas': 3,
},
'zuul_tenant_secret': self.tenant_secret,
'instance_name': self.name,
'connections': self.spec['connections'],