Helm and GitOps at CERN
Helm and GitOps at CERN
Ricardo Rocha
Why
Single source of truth
Reusability
Includes all required manifests, plus any required libraries for lifecycle
apiVersion: v1
kind: ConfigMap
metadata:
name: eosxd-config
labels:
app: {{ template "eosxd.name" . }}
chart: {{ template "eosxd.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
...
{{- range $area, $mountpoints := .Values.mounts }}
{{- range $mountpoint, $letters := $mountpoints }}
{{- end }}
{{- end }}
Template Values
apiVersion: v1 image:
kind: ConfigMap repository: gitlab-registry.../eosd
metadata: tag: 0.4.0
name: eosxd-config pullPolicy: IfNotPresent
labels: mounts:
app: {{ template "eosxd.name" . }} ams:
chart: {{ template "eosxd.chart" . }} atlas:
release: {{ .Release.Name }} cms:
heritage: {{ .Release.Service }} experiment:
... lhcb:
{{- range $area, $mountpoints := .Values.mounts }} project:
{{- range $mountpoint, $letters := $mountpoints }} project-i00: "a e j g v k q y"
project-i01: "l h b p s f w n o"
fuse.{{ $mountpoint }}.conf: |+ project-i02: "d c i r m t u x z"
{"name":"{{ $mountpoint }}","hostport":"eos{{ theory:
$mountpoint }}.cern.ch","localmountdir":"/eos/{{ user:
$mountpoint }}/", "remotemountdir":"/eos/{{ $area }}/", home-i00: "l n t z"
"bind":"{{ $letters }}"} home-i01: "a g j k w"
home-i02: "h o r s y"
{{- end }} home-i03: "b e m v x"
{{- end }} home-i04: "c f i p q"
workspace:
Charts Repository
CERN instance: https://charts.cern.ch
https://hub.helm.sh
Charts Repository
A central instance: the Helm Hub
https://hub.helm.sh
Charts Repository
A central instance: the Helm Hub
https://hub.helm.sh
Umbrella Charts
Charts are reusable deployments units
Umbrella charts wrap all the required charts into a single deployment unit
$ dependencies:
- name: mysql
version: 5.3
repository: https://kubernetes-charts.storage.googleapis.com/
- name: nginx
version: 1.16.1
repository: https://kubernetes-charts.storage.googleapis.com/
$ helm install fluxcd/flux \
--namespace flux --name flux --values flux-values.yaml
$ cat flux-values.yaml
rbac:
Our end goal from the start create: true
helmOperator:
create: true
Relying on chart updates only chartsSyncInterval: 5m
configureRepositories:
enable: true
repositories:
- name: jupyterhub
url: https://charts.cern.ch/jupyterhub
Registry
...
docker push
Helm
Meta FluxCD Helm
Release
Chart Operator
CRD
git push git pull
Flux and GitOps |-- charts
|-- hub
Chart.yaml requirements.yaml values.yaml
|-- templates
custom-manifest.yaml
What’s in a Helm Release? |-- namespaces
prod.yaml stg.yaml
|-- releases
apiVersion: flux.weave.works/v1beta1 |-- prod
kind: HelmRelease hub.yaml
metadata: |-- stg
name: hub hub.yaml
namespace: prod |-- secrets
spec: |-- prod
releaseName: hub secrets.yaml
chart: |-- stg
git: https://gitlab.cern.ch/.../hub.git secrets.yaml
path: charts/hub
ref: master
valuesFrom:
- secretKeyRef:
name: hub-secrets
key: values.yaml
This is how we plug our encrypted
values: values data
binderhub:
...
A Barbican Secret Plugin for Helm
Similar interface to futuresimple helm-secrets
https://github.com/cernops/helm-barbican
Deployment Model
1 ⇢ 1: This is currently our most common model