-
Notifications
You must be signed in to change notification settings - Fork 7
/
_helpers.tpl
100 lines (76 loc) · 3.1 KB
/
_helpers.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# define pod names (equal service names)
{{- define "geoserver_pod_name" -}}
{{ .Release.Name }}-{{ .Values.geoserver.pod_name }}
{{- end -}}
{{- define "geonode_pod_name" -}}
{{ .Release.Name }}-{{ .Values.geonode.pod_name }}
{{- end -}}
{{- define "postgres_pod_name" -}}
{{ .Release.Name }}-{{ .Values.postgres.operator_manifest.pod_name }}
{{- end -}}
{{- define "nginx_pod_name" -}}
{{ .Release.Name }}-{{ .Values.nginx.pod_name }}
{{- end -}}
# Database definitions
{{- define "database_hostname" -}}
{{- if (index .Values "postgres-operator" "enabled") -}}
{{ include "postgres_pod_name" . }}
{{- else if .Values.postgres.external_postgres.enabled -}}
{{- .Values.postgres.external_postgres.hostname -}}
{{- end -}}
{{- end -}}
{{- define "database_port" -}}
{{- if (index .Values "postgres-operator" "enabled") -}}
5432
{{- else if .Values.postgres.external_postgres.enabled -}}
{{ .Values.postgres.external_postgres.port }}
{{- end -}}
{{- end -}}
# secret key reference for the password of user: .Values.postgres.username
{{- define "database_postgres_password_secret_key_ref" -}}
{{- if (index .Values "postgres-operator" "enabled") -}}
"{{ .Values.postgres.username }}.{{ include "postgres_pod_name" . }}.credentials.postgresql.acid.zalan.do"
{{- else if .Values.postgres.external_postgres.enabled -}}
"{{ .Release.Name }}-postgres-external-secrets"
{{- end -}}
{{- end -}}
# secret key reference for the password of user: .Values.postgres.geonodedatabase_and_username
{{- define "database_geonode_password_secret_key_ref" -}}
{{- if (index .Values "postgres-operator" "enabled") -}}
"{{ .Values.postgres.geonode_databasename_and_username }}.{{ include "postgres_pod_name" . }}.credentials.postgresql.acid.zalan.do"
{{- else if .Values.postgres.external_postgres.enabled -}}
"{{ .Release.Name }}-geonode-external-secrets"
{{- end -}}
{{- end -}}
# secret key reference for the password of user: .Values.postgres.geodatabasename_and_username
{{- define "database_geodata_password_secret_key_ref" -}}
{{- if (index .Values "postgres-operator" "enabled") -}}
"{{ .Values.postgres.geodata_databasename_and_username }}.{{ include "postgres_pod_name" . }}.credentials.postgresql.acid.zalan.do"
{{- else if .Values.postgres.external_postgres.enabled -}}
"{{ .Release.Name }}-geodata-external-secrets"
{{- end -}}
{{- end -}}
# Volume names
{{- define "persistant_volume_name" -}}
persistence
{{- end -}}
# ports and endpoints
{{- define "rabbit_host" -}}
{{ .Release.Name }}-rabbitmq:5672
{{- end -}}
{{- define "broker_url" -}}
amqp://{{ .Values.rabbitmq.auth.username }}:{{ .Values.rabbitmq.auth.password }}@{{ include "rabbit_host" . }}/
{{- end -}}
{{- define "external_port" -}}
{{- if or (eq (toString .Values.geonode.ingress.externalPort) "80") (eq (toString .Values.geonode.ingress.externalPort) "443") -}}
{{- else -}}
:{{ .Values.geonode.ingress.externalPort}}
{{- end -}}
{{- end -}}
{{- define "public_url" -}}
{{ .Values.geonode.ingress.externalScheme }}://{{ .Values.geonode.ingress.externalDomain }}{{ include "external_port" . }}
{{- end -}}
# function
{{- define "boolean2str" -}}
{{ . | ternary "True" "False" }}
{{- end -}}