2021-07-31 14:04:27 +00:00
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
name: "{{ tpl .Values.identifier . }}"
|
|
|
|
labels:
|
|
|
|
app: openldap
|
|
|
|
spec:
|
|
|
|
replicas: 1
|
2021-08-02 06:20:14 +00:00
|
|
|
strategy:
|
|
|
|
# Delete old pod before starting the new one - slapd doesn't react well
|
|
|
|
# with two instances hitting the same database.
|
|
|
|
type: "Recreate"
|
2021-07-31 14:04:27 +00:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app: "{{ tpl .Values.identifier . }}-openldap"
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: "{{ tpl .Values.identifier . }}-openldap"
|
|
|
|
spec:
|
2021-08-02 07:49:28 +00:00
|
|
|
initContainers:
|
|
|
|
- name: wait-for-cert
|
|
|
|
image: busybox
|
|
|
|
command:
|
|
|
|
- "sh"
|
|
|
|
- "-c"
|
|
|
|
- "until ls /etc/letsencrypt/live/{{ tpl .Values.fqdn . }}/fullchain.pem; do sleep 5; done"
|
|
|
|
volumeMounts:
|
|
|
|
- name: "{{ tpl .Values.identifier . }}-letsencrypt-certs"
|
|
|
|
mountPath: /etc/letsencrypt
|
2021-07-31 14:04:27 +00:00
|
|
|
containers:
|
|
|
|
- name: "openldap"
|
2021-08-02 16:08:56 +00:00
|
|
|
image: "ungleich/openldap:{{ .Chart.AppVersion }}"
|
|
|
|
args: ["--loglevel", "trace"]
|
2021-07-31 14:04:27 +00:00
|
|
|
ports:
|
|
|
|
- name: ldap
|
|
|
|
containerPort: 389
|
|
|
|
protocol: TCP
|
|
|
|
- name: ldaps
|
|
|
|
containerPort: 636
|
|
|
|
protocol: TCP
|
|
|
|
livenessProbe:
|
|
|
|
tcpSocket:
|
|
|
|
port: 389
|
|
|
|
initialDelaySeconds: 10
|
|
|
|
periodSeconds: 10
|
|
|
|
readinessProbe:
|
|
|
|
tcpSocket:
|
|
|
|
port: 389
|
|
|
|
initialDelaySeconds: 10
|
|
|
|
periodSeconds: 10
|
|
|
|
env:
|
|
|
|
- name: HOSTNAME
|
|
|
|
value: "{{ tpl .Values.fqdn . }}"
|
|
|
|
- name: LDAP_LOG_LEVEL
|
2021-08-02 16:08:56 +00:00
|
|
|
value: "{{ tpl .Values.ldap.logLevel . }}"
|
2021-07-31 14:04:27 +00:00
|
|
|
- name: LDAP_ORGANISATION
|
2021-08-02 16:08:56 +00:00
|
|
|
value: "{{ tpl .Values.ldap.organisation . }}"
|
2021-07-31 14:04:27 +00:00
|
|
|
- name: LDAP_DOMAIN
|
2021-08-02 16:08:56 +00:00
|
|
|
value: "{{ tpl .Values.ldap.domain . }}"
|
2021-07-31 14:04:27 +00:00
|
|
|
- name: LDAP_ADMIN_PASSWORD
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
2021-08-02 16:08:56 +00:00
|
|
|
name: "{{ tpl .Values.ldap.adminPasswordSecretRef . }}"
|
|
|
|
key: "{{ tpl .Values.ldap.adminPasswordSecretKey . }}"
|
|
|
|
- name: LDAP_CONFIG_PASSWORD
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: "{{ tpl .Values.ldap.adminPasswordSecretRef . }}"
|
|
|
|
key: "{{ tpl .Values.ldap.adminPasswordSecretKey . }}"
|
2021-08-02 07:49:28 +00:00
|
|
|
- name: LDAP_TLS_CRT_FILENAME
|
|
|
|
value: "live/{{ tpl .Values.fqdn . }}/cert.pem"
|
|
|
|
- name: LDAP_TLS_KEY_FILENAME
|
|
|
|
value: "live/{{ tpl .Values.fqdn . }}/privkey.pem"
|
|
|
|
- name: LDAP_TLS_CA_CRT_FILENAME
|
|
|
|
value: "live/{{ tpl .Values.fqdn . }}/fullchain.pem"
|
|
|
|
- name: LDAP_TLS_VERIFY_CLIENT
|
|
|
|
value: "try"
|
2021-08-02 16:08:56 +00:00
|
|
|
- name: LDAP_REPLICATION
|
|
|
|
value: "{{ .Values.ldap.enableReplication }}"
|
|
|
|
- name: LDAP_REPLICATION_HOSTS
|
|
|
|
value: "{{ tpl .Values.ldap.replicationHosts . }}"
|
|
|
|
- name: LDAP_REPLICATION_CONFIG_SYNCPROV
|
|
|
|
value: "{{ tpl .Values.ldap.replicationConfigSyncprov . }}"
|
|
|
|
- name: LDAP_REPLICATION_DB_SYNCPROV
|
|
|
|
value: "{{ tpl .Values.ldap.replicationDbSyncprov . }}"
|
2021-07-31 14:04:27 +00:00
|
|
|
volumeMounts:
|
|
|
|
- name: "{{ tpl .Values.identifier . }}-openldap-data"
|
|
|
|
mountPath: "/etc/ldap/slapd.d"
|
|
|
|
subPath: configuration
|
|
|
|
- name: "{{ tpl .Values.identifier . }}-openldap-data"
|
|
|
|
mountPath: "/var/lib/ldap"
|
|
|
|
subPath: database
|
2021-08-02 07:49:28 +00:00
|
|
|
- name: "{{ tpl .Values.identifier . }}-letsencrypt-certs"
|
2021-07-31 14:04:27 +00:00
|
|
|
mountPath: /container/service/slapd/assets/certs
|
|
|
|
volumes:
|
|
|
|
- name: "{{ tpl .Values.identifier . }}-openldap-data"
|
|
|
|
persistentVolumeClaim:
|
|
|
|
claimName: "{{ tpl .Values.identifier . }}-openldap-data"
|
2021-08-02 07:49:28 +00:00
|
|
|
- name: "{{ tpl .Values.identifier . }}-letsencrypt-certs"
|
|
|
|
persistentVolumeClaim:
|
|
|
|
claimName: {{ tpl .Values.identifier . }}-letsencrypt-certs
|
|
|
|
---
|
|
|
|
apiVersion: batch/v1
|
|
|
|
kind: Job
|
|
|
|
metadata:
|
|
|
|
name: {{ tpl .Values.identifier . }}-getcert
|
|
|
|
spec:
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: {{ tpl .Values.identifier . }}-openldap
|
|
|
|
spec:
|
|
|
|
restartPolicy: Never
|
|
|
|
containers:
|
|
|
|
- name: certbot
|
|
|
|
image: ungleich/ungleich-certbot
|
|
|
|
ports:
|
|
|
|
- containerPort: 80
|
|
|
|
env:
|
|
|
|
- name: ONLYGETCERT
|
|
|
|
value: "yes"
|
|
|
|
- name: DOMAIN
|
|
|
|
value: "{{ tpl .Values.fqdn . }}"
|
|
|
|
- name: EMAIL
|
|
|
|
value: "{{ .Values.letsencryptEmail }}"
|
2021-08-02 16:08:56 +00:00
|
|
|
{{ if not .Values.letsencryptStaging }}
|
2021-08-02 07:49:28 +00:00
|
|
|
- name: STAGING
|
|
|
|
value: "no"
|
|
|
|
{{ end }}
|
|
|
|
volumeMounts:
|
|
|
|
- name: "{{ tpl .Values.identifier . }}-letsencrypt-certs"
|
|
|
|
mountPath: /etc/letsencrypt
|
|
|
|
volumes:
|
|
|
|
- name: "{{ tpl .Values.identifier . }}-letsencrypt-certs"
|
|
|
|
persistentVolumeClaim:
|
|
|
|
claimName: {{ tpl .Values.identifier . }}-letsencrypt-certs
|
|
|
|
backoffLimit: 3
|