Skip to content

Commit cd8ab6d

Browse files
Raymond Augébrianchandotcom
authored andcommitted
LCD-46035 implement more flexible helm values composition
1 parent 53a35fc commit cd8ab6d

File tree

6 files changed

+58
-60
lines changed

6 files changed

+58
-60
lines changed

cloud/helm/aws/values.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,22 @@ liferay-default:
1919
s3Region="$[env:S3_BUCKET_REGION]"
2020
secretKey=""
2121
customEnvFrom:
22-
- secretRef:
23-
name: managed-service-details
22+
x-liferay-aws:
23+
- secretRef:
24+
name: managed-service-details
2425
customLabels:
2526
origin: liferay-aws
2627
customVolumeMounts:
27-
- mountPath: /opt/liferay/osgi/configs/com.liferay.portal.search.opensearch2.configuration.OpenSearchConfiguration.config
28-
name: liferay-configmap
29-
subPath: com.liferay.portal.search.opensearch2.configuration.OpenSearchConfiguration.config
30-
- mountPath: /opt/liferay/osgi/configs/com.liferay.portal.search.opensearch2.configuration.OpenSearchConnectionConfiguration-REMOTE.config
31-
name: liferay-configmap
32-
subPath: com.liferay.portal.search.opensearch2.configuration.OpenSearchConnectionConfiguration-REMOTE.config
33-
- mountPath: /opt/liferay/osgi/configs/com.liferay.portal.store.s3.configuration.S3StoreConfiguration.config
34-
name: liferay-configmap
35-
subPath: com.liferay.portal.store.s3.configuration.S3StoreConfiguration.config
28+
x-liferay-aws:
29+
- mountPath: /opt/liferay/osgi/configs/com.liferay.portal.search.opensearch2.configuration.OpenSearchConfiguration.config
30+
name: liferay-configmap
31+
subPath: com.liferay.portal.search.opensearch2.configuration.OpenSearchConfiguration.config
32+
- mountPath: /opt/liferay/osgi/configs/com.liferay.portal.search.opensearch2.configuration.OpenSearchConnectionConfiguration-REMOTE.config
33+
name: liferay-configmap
34+
subPath: com.liferay.portal.search.opensearch2.configuration.OpenSearchConnectionConfiguration-REMOTE.config
35+
- mountPath: /opt/liferay/osgi/configs/com.liferay.portal.store.s3.configuration.S3StoreConfiguration.config
36+
name: liferay-configmap
37+
subPath: com.liferay.portal.store.s3.configuration.S3StoreConfiguration.config
3638
portalBundleDenyList:
3739
- com.liferay.portal.search.elasticsearch.cross.cluster.replication.impl
3840
- com.liferay.portal.search.elasticsearch.monitoring.web

cloud/helm/default/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ description:
55
icon: https://www-cdn.liferay.com/documents/d/guest/liferay-logo
66
name: liferay-default
77
type: application
8-
version: 0.0.4
8+
version: 0.0.5

cloud/helm/default/templates/_statefulset.tpl

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ spec:
3636
{{- with .statefulset.env }}
3737
{{- toYaml . | nindent 22 }}
3838
{{- end }}
39-
{{- with .statefulset.customEnv }}
40-
{{- toYaml . | nindent 22 }}
39+
{{- range $k, $v := .statefulset.customEnv }}
40+
{{- toYaml $v | nindent 22 }}
4141
{{- end }}
4242
{{- end }}
4343
{{- if or .statefulset.envFrom .statefulset.customEnvFrom }}
4444
envFrom:
4545
{{- with .statefulset.envFrom }}
4646
{{- toYaml . | nindent 22 }}
4747
{{- end }}
48-
{{- with .statefulset.customEnvFrom }}
49-
{{- toYaml . | nindent 22 }}
48+
{{- range $k, $v := .statefulset.customEnvFrom }}
49+
{{- toYaml $v | nindent 22 }}
5050
{{- end }}
5151
{{- end }}
5252
image: {{ printf "%s:%s" .statefulset.image.repository (.statefulset.image.tag | toString) }}
@@ -61,8 +61,8 @@ spec:
6161
{{- with .statefulset.ports }}
6262
{{- toYaml . | nindent 22 }}
6363
{{- end }}
64-
{{- with .statefulset.customPorts }}
65-
{{- toYaml . | nindent 22 }}
64+
{{- range $k, $v := .statefulset.customPorts }}
65+
{{- toYaml $v | nindent 22 }}
6666
{{- end }}
6767
{{- end }}
6868
{{- with .statefulset.readinessProbe }}
@@ -86,21 +86,21 @@ spec:
8686
{{- with .statefulset.volumeMounts }}
8787
{{- toYaml . | nindent 22 }}
8888
{{- end }}
89-
{{- with .statefulset.customVolumeMounts }}
90-
{{- toYaml . | nindent 22 }}
89+
{{- range $k, $v := .statefulset.customVolumeMounts }}
90+
{{- toYaml $v | nindent 22 }}
9191
{{- end }}
9292
{{- end }}
9393
{{- if or .statefulset.pullSecrets .statefulset.customPullSecrets}}
9494
imagePullSecrets:
9595
{{- with .statefulset.pullSecrets }}
9696
{{- toYaml . | nindent 16 }}
9797
{{- end }}
98-
{{- with .statefulset.customPullSecrets }}
99-
{{- toYaml . | nindent 16 }}
98+
{{- range $k, $v := .statefulset.customPullSecrets }}
99+
{{- toYaml $v | nindent 16 }}
100100
{{- end }}
101101
{{- end }}
102102
{{- if or .statefulset.initContainers .statefulset.customInitContainers }}
103-
{{- $statefulset := .statefulset }}
103+
{{- $statefulset := merge .statefulset (dict "liferayname" (include "liferay.name" .root)) }}
104104
initContainers:
105105
{{- range .statefulset.initContainers }}
106106
{{- if .containerTemplate }}
@@ -110,12 +110,12 @@ spec:
110110
{{- toYaml . | nindent 18 }}
111111
{{- end }}
112112
{{- end }}
113-
{{- range .statefulset.customInitContainers }}
114-
{{- if .containerTemplate }}
115-
{{- tpl .containerTemplate $statefulset | nindent 16 }}
113+
{{- range $k, $v := .statefulset.customInitContainers }}
114+
{{- if $v.containerTemplate }}
115+
{{- tpl $v.containerTemplate $statefulset | nindent 16 }}
116116
{{- else }}
117117
- #
118-
{{- toYaml . | nindent 18 }}
118+
{{- toYaml $v | nindent 18 }}
119119
{{- end }}
120120
{{- end }}
121121
{{- end }}
@@ -141,8 +141,8 @@ spec:
141141
{{- with .statefulset.volumes }}
142142
{{- toYaml . | nindent 16 }}
143143
{{- end }}
144-
{{- with .statefulset.customVolumes }}
145-
{{- toYaml . | nindent 16 }}
144+
{{- range $k, $v := .statefulset.customVolumes }}
145+
{{- toYaml $v | nindent 16 }}
146146
{{- end }}
147147
{{- end }}
148148
{{- with .statefulset.updateStrategy }}
@@ -154,8 +154,8 @@ spec:
154154
{{- with .statefulset.volumeClaimTemplates }}
155155
{{- toYaml . | nindent 8 }}
156156
{{- end }}
157-
{{- with .statefulset.customVolumeClaimTemplates }}
158-
{{- toYaml . | nindent 8 }}
157+
{{- range $k, $v := .statefulset.customVolumeClaimTemplates }}
158+
{{- toYaml $v | nindent 8 }}
159159
{{- end }}
160160
{{- end }}
161161
---

cloud/helm/default/templates/configmap.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ data:
1616
{{- if .Values.portalProperties }}
1717
{{- .Values.portalProperties | nindent 8 }}
1818
{{- end }}
19-
{{- range $i := .Values.dependencies }}
20-
{{- if $i.portalProperties }}
21-
{{- $i.portalProperties | nindent 8 }}
19+
{{- range $k, $v := .Values.dependencies }}
20+
{{- if $v.portalProperties }}
21+
{{- $v.portalProperties | nindent 8 }}
2222
{{- end }}
2323
{{- end }}
2424
configuration.override.com.liferay.portal.bundle.blacklist.internal.configuration.BundleBlacklistConfiguration_blacklistBundleSymbolicNames=[\
@@ -27,8 +27,8 @@ data:
2727
{{ $PREFIX }}{{ $bundle | quote }}\
2828
{{- $PREFIX = "," -}}
2929
{{- end }}
30-
{{- range $i := .Values.dependencies }}
31-
{{- range $bundle := $i.portalBundleDenyList }}
30+
{{- range $k, $v := .Values.dependencies }}
31+
{{- range $bundle := $v.portalBundleDenyList }}
3232
{{ $PREFIX }}{{ $bundle | quote }}\
3333
{{- $PREFIX = "," -}}
3434
{{- end }}
@@ -40,8 +40,8 @@ data:
4040
{{ $PREFIX }}{{ $component | quote }}\
4141
{{- $PREFIX = "," }}
4242
{{- end }}
43-
{{- range $i := .Values.dependencies }}
44-
{{- range $component := $i.portalComponentDenyList }}
43+
{{- range $k, $v := .Values.dependencies }}
44+
{{- range $component := $v.portalComponentDenyList }}
4545
{{ $PREFIX }}{{ $component | quote }}\
4646
{{- $PREFIX = "," }}
4747
{{- end }}
@@ -61,7 +61,7 @@ data:
6161
include-and-override=portal-cloud.properties
6262
{{ if or (gt (int .Values.replicaCount) 1) .Values.autoscaling.enabled }}
6363
unicast.xml: |
64-
{{- tpl (.Files.Get "resources/unicast.xml") . | nindent 8 }}
64+
{{- tpl (.Files.Get "resources/unicast.xml") $ | nindent 8 }}
6565
{{- end }}
6666
{{- end }}
6767
{{- if .Values.configmap.data }}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{{- $main := dict "name" "" "statefulset" .Values "root" $ }}
22
{{ include "liferay.statefulset" $main }}
3-
{{- range $i := .Values.dependencies }}
4-
{{- if eq $i.source "statefulset" }}
3+
{{- range $k, $v := .Values.dependencies }}
4+
{{- if eq $v.source "statefulset" }}
55
---
6-
{{- $dependence := dict "name" $i.name "statefulset" $i.statefulset "root" $ }}
6+
{{- $dependence := dict "name" $k "statefulset" $v.statefulset "root" $ }}
77
{{ include "liferay.statefulset" $dependence }}
88
{{- end }}
99
{{- end }}

cloud/helm/default/values.yaml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,17 @@ configmap:
1616
annotations: {}
1717
data: {}
1818
overrideDefaults: false
19-
customEnv: []
20-
customEnvFrom: []
21-
customInitContainers: []
19+
customEnv: {}
20+
customEnvFrom: {}
21+
customInitContainers: {}
2222
customLabels:
2323
origin: liferay-cloud
24-
customPorts: []
25-
customPullSecrets: []
26-
customVolumeClaimTemplates: []
27-
customVolumeMounts: []
28-
customVolumes: []
29-
dependencies:
30-
- name: database
31-
portalBundleDenyList: []
32-
portalComponentDenyList: []
33-
portalProperties: ""
34-
source: external
24+
customPorts: {}
25+
customPullSecrets: {}
26+
customVolumeClaimTemplates: {}
27+
customVolumeMounts: {}
28+
customVolumes: {}
29+
dependencies: {}
3530
env:
3631
- name: DNS_MEMBERSHIP_SERVICE_NAME
3732
value: liferay-default-headless
@@ -128,11 +123,12 @@ initContainers:
128123
- |
129124
trap "echo 'Received signal to terminate.'; exit 0" SIGINT SIGTERM
130125
131-
{{- range .dependencies }}
132-
{{- if eq .source "statefulset" }}
133-
until nc -vz -w 2 liferay-{{ .name }} {{ (index .statefulset.service.ports 0).port }}
126+
{{- $liferayname := .liferayname }}
127+
{{- range $k, $v := .dependencies }}
128+
{{- if eq $v.source "statefulset" }}
129+
until nc -vz -w 2 {{ $liferayname }}-{{ $k }} {{ (index $v.statefulset.service.ports 0).port }}
134130
do
135-
echo "Waiting for liferay-{{ .name }}..."
131+
echo "Waiting for {{ $liferayname }}-{{ $k }}..."
136132
137133
sleep 2
138134
done

0 commit comments

Comments
 (0)