Add Zuul charts

Depends-On: https://review.opendev.org/c/700222
Change-Id: I61010a03b5e9f7144444058279dbe8dfe21d1fe4
This commit is contained in:
Mohammed Naser 2019-12-23 19:11:13 -05:00 committed by James E. Blair
parent 9afaed4d37
commit 975cac9899
12 changed files with 421 additions and 0 deletions

7
charts/zuul/Chart.yaml Normal file
View File

@ -0,0 +1,7 @@
---
apiVersion: v1
name: zuul
description: Zuul is a program that drives continuous integration, delivery, and deployment systems with a focus on project gating and interrelated projects.
home: https://zuul-ci.org/docs/zuul/
appVersion: 3.14.0
version: 0.0.1

View File

@ -0,0 +1,66 @@
{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "zuul.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "zuul.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Generate basic labels
*/}}
{{- define "zuul.common.labels" }}
app.kubernetes.io/name: {{ include "zuul.fullname" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/part-of: zuul
{{- end }}
{{/*
Generate Zuul-executor labels
*/}}
{{- define "zuul.executor.labels" }}
{{- include "zuul.common.labels" . }}
app.kubernetes.io/component: zuul-executor
{{- end }}
{{/*
Generate Zuul-merger labels
*/}}
{{- define "zuul.merger.labels" }}
{{- include "zuul.common.labels" . }}
app.kubernetes.io/component: zuul-merger
{{- end }}
{{/*
Generate Zuul-scheduler labels
*/}}
{{- define "zuul.scheduler.labels" }}
{{- include "zuul.common.labels" . }}
app.kubernetes.io/component: zuul-scheduler
{{- end }}
{{/*
Generate Zuul-web labels
*/}}
{{- define "zuul.web.labels" }}
{{- include "zuul.common.labels" . }}
app.kubernetes.io/component: zuul-web
{{- end }}

View File

@ -0,0 +1,19 @@
---
{{ if .Values.executor.enabled }}
apiVersion: v1
kind: Service
metadata:
namespace: {{ .Release.Namespace }}
name: {{ include "zuul.fullname" . }}-executor
labels:
{{- include "zuul.executor.labels" . | indent 4 }}
spec:
type: ClusterIP
ports:
- name: logs
port: 7900
protocol: TCP
targetPort: logs
selector:
{{- include "zuul.executor.labels" . | indent 4 }}
{{ end }}

View File

@ -0,0 +1,50 @@
---
{{ if .Values.executor.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
namespace: {{ .Release.Namespace }}
name: {{ include "zuul.fullname" . }}-executor
labels:
{{- include "zuul.executor.labels" . | indent 4 }}
spec:
serviceName: {{ include "zuul.fullname" . }}-executor
replicas: {{ .Values.executor.replicas }}
selector:
matchLabels:
{{- include "zuul.executor.labels" . | indent 6 }}
template:
metadata:
labels:
{{- include "zuul.executor.labels" . | indent 8 }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
spec:
containers:
- name: executor
image: zuul/zuul-executor:latest
args:
- /usr/local/bin/zuul-executor
- -d
ports:
- name: logs
containerPort: 7900
volumeMounts:
- name: zuul-config
mountPath: /etc/zuul
securityContext:
privileged: true
volumes:
- name: zuul-config
secret:
secretName: {{ include "zuul.fullname" . }}
defaultMode: 256
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{ end }}

View File

@ -0,0 +1,44 @@
---
{{ if .Values.merger.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: {{ .Release.Namespace }}
name: {{ include "zuul.fullname" . }}-merger
labels:
{{- include "zuul.merger.labels" . | indent 4 }}
spec:
replicas: {{ .Values.merger.replicas }}
selector:
matchLabels:
{{- include "zuul.merger.labels" . | indent 6 }}
template:
metadata:
labels:
{{- include "zuul.merger.labels" . | indent 8 }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
spec:
containers:
- name: merger
image: zuul/zuul-merger:latest
args:
- /usr/local/bin/zuul-merger
- -d
volumeMounts:
- name: zuul-config
mountPath: /etc/zuul
volumes:
- name: zuul-config
secret:
secretName: {{ include "zuul.fullname" . }}
defaultMode: 256
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{ end }}

View File

@ -0,0 +1,19 @@
---
{{ if .Values.scheduler.enabled }}
apiVersion: v1
kind: Service
metadata:
namespace: {{ .Release.Namespace }}
name: {{ include "zuul.fullname" . }}-gearman
labels:
{{- include "zuul.scheduler.labels" . | indent 4 }}
spec:
type: ClusterIP
ports:
- name: gearman
port: {{ .Values.scheduler.gearman.port }}
protocol: TCP
targetPort: gearman
selector:
{{- include "zuul.scheduler.labels" . | indent 4 }}
{{ end }}

View File

@ -0,0 +1,59 @@
---
{{ if .Values.scheduler.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
namespace: {{ .Release.Namespace }}
name: {{ include "zuul.fullname" . }}-scheduler
labels:
{{- include "zuul.scheduler.labels" . | indent 4 }}
spec:
replicas: 1
serviceName: zuul-scheduler
selector:
matchLabels:
{{- include "zuul.scheduler.labels" . | indent 6 }}
template:
metadata:
labels:
{{- include "zuul.scheduler.labels" . | indent 8 }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
spec:
containers:
- name: launcher
image: zuul/zuul-scheduler:latest
args:
- /usr/local/bin/zuul-scheduler
- -d
ports:
- name: gearman
containerPort: {{ .Values.scheduler.gearman.port }}
volumeMounts:
- name: zuul-config
mountPath: /etc/zuul
- name: {{ include "zuul.fullname" . }}-scheduler
mountPath: /var/lib/zuul
volumes:
- name: zuul-config
secret:
secretName: {{ include "zuul.fullname" . }}
defaultMode: 256
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
volumeClaimTemplates:
- metadata:
name: {{ include "zuul.fullname" . }}-scheduler
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 80Gi
{{ end }}

View File

@ -0,0 +1,37 @@
---
apiVersion: v1
kind: Secret
metadata:
namespace: {{ .Release.Namespace }}
name: {{ include "zuul.fullname" . }}
labels:
{{- include "zuul.common.labels" . | indent 4 }}
stringData:
zuul.conf: |
[gearman]
server={{ include "zuul.fullname" . }}-gearman
port={{ .Values.scheduler.gearman.port }}
[zookeeper]
hosts={{ .Values.zookeeper.hosts }}
[gearman_server]
start=true
port={{ .Values.scheduler.gearman.port }}
[web]
listen_address=0.0.0.0
root=https://{{ .Values.web.host }}
port={{ .Values.web.port }}
[scheduler]
tenant_config=/etc/zuul/main.yaml
[executor]
private_key_file={{ .Values.executor.private_key_file }}
{{ range $connection, $options := .Values.connections }}
[connection {{ $connection }}]
{{ range $key, $value := $options }}
{{ $key }} = {{ $value }}
{{ end }}
{{ end }}
main.yaml: |
{{ toYaml .Values.tenantConfig | indent 4 }}
{{ if .Values.extraFiles }}
{{ (toYaml .Values.extraFiles | indent 2) }}
{{ end }}

View File

@ -0,0 +1,47 @@
---
{{ if .Values.web.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: {{ .Release.Namespace }}
name: {{ include "zuul.fullname" . }}-web
labels:
{{- include "zuul.web.labels" . | indent 4 }}
spec:
replicas: {{ .Values.web.replicas }}
selector:
matchLabels:
{{- include "zuul.web.labels" . | indent 6 }}
template:
metadata:
labels:
{{- include "zuul.web.labels" . | indent 8 }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
spec:
containers:
- name: web
image: zuul/zuul-web:latest
args:
- /usr/local/bin/zuul-web
- -d
ports:
- name: zuul-web
containerPort: {{ .Values.web.port }}
volumeMounts:
- name: zuul-config
mountPath: /etc/zuul
volumes:
- name: zuul-config
secret:
secretName: {{ include "zuul.fullname" . }}
defaultMode: 256
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{ end }}

View File

@ -0,0 +1,27 @@
---
{{ if and .Values.ingress.enabled .Values.web.enabled }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
namespace: {{ .Release.Namespace }}
name: {{ include "zuul.fullname" . }}-web
labels:
{{- include "zuul.web.labels" . | indent 4 }}
annotations:
kubernetes.io/ingress.class: nginx
certmanager.k8s.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
rules:
- host: {{ .Values.web.host }}
http:
paths:
- backend:
serviceName: {{ include "zuul.fullname" . }}-web
servicePort: {{ .Values.web.port }}
path: /
tls:
- hosts:
- {{ .Values.web.host }}
secretName: {{ include "zuul.fullname" . }}-web-certs
{{ end }}

View File

@ -0,0 +1,19 @@
---
{{ if .Values.web.enabled }}
apiVersion: v1
kind: Service
metadata:
namespace: {{ .Release.Namespace }}
name: {{ include "zuul.fullname" . }}-web
labels:
{{- include "zuul.web.labels" . | indent 4 }}
spec:
type: ClusterIP
ports:
- name: zuul-web
port: {{ .Values.web.port }}
protocol: TCP
targetPort: zuul-web
selector:
{{- include "zuul.web.labels" . | indent 4 }}
{{ end }}

27
charts/zuul/values.yaml Normal file
View File

@ -0,0 +1,27 @@
---
zookeeper:
hosts: zookeeper
executor:
enabled: true
replicas: 3
merger:
enabled: true
replicas: 3
scheduler:
enabled: true
gearman:
port: 4730
web:
enabled: true
replicas: 3
port: 9000
ingress:
enabled: false
tenantConfig: {}
extraFiles: {}