Skip to content

Commit

Permalink
add rabbitmq support into helm chart (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
edevosc2c authored Nov 7, 2023
1 parent 09f19a4 commit f4e765f
Show file tree
Hide file tree
Showing 12 changed files with 245 additions and 136 deletions.
9 changes: 6 additions & 3 deletions Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami/
version: 12.1.15
digest: sha256:fafad9c35344a9fa85f52ea0764a2d5c40e247eef01220edbf6d21dcc7541426
generated: "2023-02-16T17:52:10.601623147+01:00"
version: 12.11.2
- name: rabbitmq
repository: https://charts.bitnami.com/bitnami/
version: 12.1.7
digest: sha256:be61e7484f2581cd0d28933a0e101ef044932abc76696bd8f240b4e226828960
generated: "2023-11-06T14:57:29.583497777+01:00"
7 changes: 6 additions & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ appVersion: "22.0"

dependencies:
- name: postgresql
version: ~12.1.14
version: ~12.11.2
repository: "https://charts.bitnami.com/bitnami/"
condition: database.builtin
alias: database
- name: rabbitmq
version: ~12.1.4
repository: "https://charts.bitnami.com/bitnami/"
condition: rabbitmq.enabled, rabbitmq.builtin
alias: rabbitmq
45 changes: 45 additions & 0 deletions templates/_helpers-database.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{/*
Insert database georchestra environment variables
*/}}
{{- define "georchestra.database-georchestra-envs" -}}
{{- $database := .Values.database -}}
{{- $database_secret_georchestra_name := printf "%s-database-georchestra-secret" (include "georchestra.fullname" .) -}}
{{- if $database.builtin }}
- name: PGHOST
value: "{{ .Release.Name }}-database"
{{- else }}
{{- if $database.auth.existingSecret }}
{{- $database_secret_georchestra_name = $database.auth.existingSecret -}}
{{- end }}
- name: PGHOST
valueFrom:
secretKeyRef:
name: {{ $database_secret_georchestra_name }}
key: host
optional: false
{{- end }}
- name: PGPORT
valueFrom:
secretKeyRef:
name: {{ $database_secret_georchestra_name }}
key: port
optional: false
- name: PGDATABASE
valueFrom:
secretKeyRef:
name: {{ $database_secret_georchestra_name }}
key: dbname
optional: false
- name: PGUSER
valueFrom:
secretKeyRef:
name: {{ $database_secret_georchestra_name }}
key: user
optional: false
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: {{ $database_secret_georchestra_name }}
key: password
optional: false
{{- end }}
51 changes: 51 additions & 0 deletions templates/_helpers-envs.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/*
Insert service host environment variables
*/}}
{{- define "georchestra.service-envs" -}}
- name: ANALYTICS_HOST
value: "{{ include "georchestra.fullname" . }}-analytics-svc"
- name: CAS_HOST
value: "{{ include "georchestra.fullname" . }}-cas-svc"
- name: CONSOLE_HOST
value: "{{ include "georchestra.fullname" . }}-console-svc"
- name: GEONETWORK_HOST
value: "{{ include "georchestra.fullname" . }}-geonetwork-svc"
- name: GEOSERVER_HOST
value: "{{ include "georchestra.fullname" . }}-geoserver-svc"
- name: HEADER_HOST
value: "{{ include "georchestra.fullname" . }}-header-svc"
- name: GEOWEBCACHE_HOST
value: "{{ include "georchestra.fullname" . }}-geowebcache-svc"
- name: MAPSTORE_HOST
value: "{{ include "georchestra.fullname" . }}-mapstore-svc"
- name: DATAFEEDER_HOST
value: "{{ include "georchestra.fullname" . }}-datafeeder-svc"
- name: IMPORT_HOST
value: "{{ include "georchestra.fullname" . }}-import-svc"
- name: DATAHUB_HOST
value: "datahub-datahub-svc"
- name: OGC_API_RECORDS_HOST
value: "{{ include "georchestra.fullname" . }}-gn4-ogc-api-records-svc"
- name: ES_HOST
value: "{{ include "georchestra.fullname" . }}-gn4-elasticsearch-svc"
- name: ES_PORT
value: "9200"
- name: KB_HOST
value: "{{ include "georchestra.fullname" . }}-gn4-kibana-svc"
- name: KB_PORT
value: "5601"
{{- end }}

{{/*
Insert common environment variables
*/}}
{{- define "georchestra.common-envs" -}}
- name: FQDN
value: "{{ .Values.fqdn }}"
{{- if .Values.georchestra.smtp_smarthost.enabled }}
- name: SMTPHOST
value: "{{ include "georchestra.fullname" . }}-smtp-svc"
- name: SMTPPORT
value: "25"
{{- end }}
{{- end }}
33 changes: 33 additions & 0 deletions templates/_helpers-ldap.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{/*
Insert LDAP environment variables
*/}}
{{- define "georchestra.ldap-envs" -}}
{{- $ldap := .Values.ldap -}}
{{- if .Values.georchestra.webapps.openldap.enabled }}
- name: LDAPHOST
value: "{{ include "georchestra.fullname" . }}-ldap-svc"
{{- else }}
- name: LDAPHOST
value: "{{ $ldap.host }}"
{{- end }}
- name: LDAPPORT
value: "{{ $ldap.port }}"
- name: LDAPSCHEME
value: "{{ $ldap.scheme }}"
- name: LDAPBASEDN
value: "{{ $ldap.baseDn }}"
- name: LDAPADMINDN
value: "{{ $ldap.adminDn }}"
- name: LDAPADMINPASSWORD
valueFrom:
secretKeyRef:
name: {{ $ldap.existingSecret | default (printf "%s-ldap-passwords-secret" (include "georchestra.fullname" .)) }}
key: SLAPD_PASSWORD
optional: false
- name: LDAPUSERSRDN
value: "{{ $ldap.usersRdn }}"
- name: LDAPROLESRDN
value: "{{ $ldap.rolesRdn }}"
- name: LDAPORGSRDN
value: "{{ $ldap.orgsRdn }}"
{{- end }}
38 changes: 38 additions & 0 deletions templates/_helpers-rabbitmq.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{/*
Insert rabbitmq georchestra environment variables
*/}}
{{- define "georchestra.rabbitmq-georchestra-envs" -}}
{{- $rabbitmq := .Values.rabbitmq -}}
{{- $rabbitmq_secret_georchestra_name := "" -}}
{{- if $rabbitmq.builtin }}
{{- $rabbitmq_secret_georchestra_name = printf "%s-rabbitmq-georchestra-secret" (include "georchestra.fullname" .) -}}
- name: RABBITMQ_HOST
value: "{{ .Release.Name }}-rabbitmq"
{{- else }}
{{- $rabbitmq_secret_georchestra_name = .Values.rabbitmq.auth.existingSecret -}}
- name: RABBITMQ_HOST
valueFrom:
secretKeyRef:
name: {{ $rabbitmq_secret_georchestra_name }}
key: host
optional: false
{{- end }}
- name: RABBITMQ_PORT
valueFrom:
secretKeyRef:
name: {{ $rabbitmq_secret_georchestra_name }}
key: port
optional: false
- name: RABBITMQ_USERNAME
valueFrom:
secretKeyRef:
name: {{ $rabbitmq_secret_georchestra_name }}
key: user
optional: false
- name: RABBITMQ_PASSWORD
valueFrom:
secretKeyRef:
name: {{ $rabbitmq_secret_georchestra_name }}
key: password
optional: false
{{- end }}
132 changes: 0 additions & 132 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,135 +60,3 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Insert database georchestra environment variables
*/}}
{{- define "georchestra.database-georchestra-envs" -}}
{{- $database := .Values.database -}}
{{- $database_secret_georchestra_name := printf "%s-database-georchestra-secret" (include "georchestra.fullname" .) -}}
{{- if $database.builtin }}
- name: PGHOST
value: "{{ .Release.Name }}-database"
{{- else }}
{{- if $database.auth.existingSecret }}
{{- $database_secret_georchestra_name = $database.auth.existingSecret -}}
{{- end }}
- name: PGHOST
valueFrom:
secretKeyRef:
name: {{ $database_secret_georchestra_name }}
key: host
optional: false
{{- end }}
- name: PGPORT
valueFrom:
secretKeyRef:
name: {{ $database_secret_georchestra_name }}
key: port
optional: false
- name: PGDATABASE
valueFrom:
secretKeyRef:
name: {{ $database_secret_georchestra_name }}
key: dbname
optional: false
- name: PGUSER
valueFrom:
secretKeyRef:
name: {{ $database_secret_georchestra_name }}
key: user
optional: false
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: {{ $database_secret_georchestra_name }}
key: password
optional: false
{{- end }}

{{/*
Insert LDAP environment variables
*/}}
{{- define "georchestra.ldap-envs" -}}
{{- $ldap := .Values.ldap -}}
{{- if .Values.georchestra.webapps.openldap.enabled }}
- name: LDAPHOST
value: "{{ include "georchestra.fullname" . }}-ldap-svc"
{{- else }}
- name: LDAPHOST
value: "{{ $ldap.host }}"
{{- end }}
- name: LDAPPORT
value: "{{ $ldap.port }}"
- name: LDAPSCHEME
value: "{{ $ldap.scheme }}"
- name: LDAPBASEDN
value: "{{ $ldap.baseDn }}"
- name: LDAPADMINDN
value: "{{ $ldap.adminDn }}"
- name: LDAPADMINPASSWORD
valueFrom:
secretKeyRef:
name: {{ $ldap.existingSecret | default (printf "%s-ldap-passwords-secret" (include "georchestra.fullname" .)) }}
key: SLAPD_PASSWORD
optional: false
- name: LDAPUSERSRDN
value: "{{ $ldap.usersRdn }}"
- name: LDAPROLESRDN
value: "{{ $ldap.rolesRdn }}"
- name: LDAPORGSRDN
value: "{{ $ldap.orgsRdn }}"
{{- end }}

{{/*
Insert service host environment variables
*/}}
{{- define "georchestra.service-envs" -}}
- name: ANALYTICS_HOST
value: "{{ include "georchestra.fullname" . }}-analytics-svc"
- name: CAS_HOST
value: "{{ include "georchestra.fullname" . }}-cas-svc"
- name: CONSOLE_HOST
value: "{{ include "georchestra.fullname" . }}-console-svc"
- name: GEONETWORK_HOST
value: "{{ include "georchestra.fullname" . }}-geonetwork-svc"
- name: GEOSERVER_HOST
value: "{{ include "georchestra.fullname" . }}-geoserver-svc"
- name: HEADER_HOST
value: "{{ include "georchestra.fullname" . }}-header-svc"
- name: GEOWEBCACHE_HOST
value: "{{ include "georchestra.fullname" . }}-geowebcache-svc"
- name: MAPSTORE_HOST
value: "{{ include "georchestra.fullname" . }}-mapstore-svc"
- name: DATAFEEDER_HOST
value: "{{ include "georchestra.fullname" . }}-datafeeder-svc"
- name: IMPORT_HOST
value: "{{ include "georchestra.fullname" . }}-import-svc"
- name: DATAHUB_HOST
value: "datahub-datahub-svc"
- name: OGC_API_RECORDS_HOST
value: "{{ include "georchestra.fullname" . }}-gn4-ogc-api-records-svc"
- name: ES_HOST
value: "{{ include "georchestra.fullname" . }}-gn4-elasticsearch-svc"
- name: ES_PORT
value: "9200"
- name: KB_HOST
value: "{{ include "georchestra.fullname" . }}-gn4-kibana-svc"
- name: KB_PORT
value: "5601"
{{- end }}

{{/*
Insert common environment variables
*/}}
{{- define "georchestra.common-envs" -}}
- name: FQDN
value: "{{ .Values.fqdn }}"
{{- if .Values.georchestra.smtp_smarthost.enabled }}
- name: SMTPHOST
value: "{{ include "georchestra.fullname" . }}-smtp-svc"
- name: SMTPPORT
value: "25"
{{- end }}
{{- end }}
3 changes: 3 additions & 0 deletions templates/console/console-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ spec:
{{- include "georchestra.common-envs" . | nindent 10 }}
{{- include "georchestra.ldap-envs" . | nindent 10 }}
{{- include "georchestra.database-georchestra-envs" . | nindent 10 }}
{{- if .Values.rabbitmq.enabled -}}
{{- include "georchestra.rabbitmq-georchestra-envs" . | nindent 10 }}
{{- end }}
{{- if $webapp.extra_environment }}
{{- $webapp.extra_environment | toYaml | nindent 10 }}
{{- end }}
Expand Down
3 changes: 3 additions & 0 deletions templates/gateway/gateway-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ spec:
{{- include "georchestra.common-envs" . | nindent 10 }}
{{- include "georchestra.ldap-envs" . | nindent 10 }}
{{- include "georchestra.database-georchestra-envs" . | nindent 10 }}
{{- if .Values.rabbitmq.enabled -}}
{{- include "georchestra.rabbitmq-georchestra-envs" . | nindent 10 }}
{{- end }}
{{- if $webapp.extra_environment }}
{{- $webapp.extra_environment | toYaml | nindent 10 }}
{{- end }}
Expand Down
22 changes: 22 additions & 0 deletions templates/rabbitmq/rabbitmq-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- $rabbitmq := .Values.rabbitmq -}}
{{- if and $rabbitmq.enabled $rabbitmq.storage -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "georchestra.fullname" . }}-rabbitmq
labels:
{{- include "georchestra.labels" . | nindent 4 }}
app.kubernetes.io/component: {{ include "georchestra.fullname" . }}-rabbitmq
spec:
accessModes:
- ReadWriteOnce
{{- if $rabbitmq.storage.storage_class_name }}
storageClassName: {{ $rabbitmq.storage.storage_class_name }}
{{- end }}
{{- if $rabbitmq.storage.pv_name }}
volumeName: {{ $rabbitmq.storage.pv_name }}
{{- end }}
resources:
requests:
storage: {{ $rabbitmq.storage.size }}
{{- end }}
21 changes: 21 additions & 0 deletions templates/rabbitmq/rabbitmq-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- $rabbitmq := .Values.rabbitmq -}}
{{- if $rabbitmq.enabled -}}
{{- if not $rabbitmq.auth.existingSecret -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "georchestra.fullname" . }}-rabbitmq-georchestra-secret
labels:
{{- include "georchestra.labels" . | nindent 4 }}
type: Opaque
data:
{{- if $rabbitmq.builtin }}
host: {{ printf "%s-rabbitmq" .Release.Name | b64enc | quote }}
{{- else }}
host: {{ $rabbitmq.auth.host | b64enc | quote }}
{{- end }}
password: {{ $rabbitmq.auth.password | b64enc | quote }}
port: {{ $rabbitmq.auth.port | b64enc | quote }}
user: {{ $rabbitmq.auth.username | b64enc | quote }}
{{- end }}
{{- end }}
Loading

0 comments on commit f4e765f

Please sign in to comment.