Skip to content

Commit 54877ff

Browse files
pengzhoumlPeng Zhou
andauthored
Bug fix for 1.1.2 release (#226)
* Bug fix for 1.1.2 release 1. make oldFullname use fullnameOverride if it is set 2. Change the TCP port to use headlessServiceName 3. keep the name of the cluster service the same * MLE-14114 support upgrade with fullnameOveride is set --------- Co-authored-by: Peng Zhou <[email protected]>
1 parent f052ee8 commit 54877ff

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

charts/templates/_helpers.tpl

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,37 @@ Expand the name of the chart.
99
newFullname is the name used after 1.1.x release, in an effort to make the release name shorter.
1010
*/}}
1111
{{- define "marklogic.newFullname" -}}
12+
{{- if .Values.fullnameOverride }}
13+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
14+
{{- else }}
1215
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
1316
{{- end }}
17+
{{- end }}
18+
1419

1520
{{/*
1621
oldFullname is the name used before 1.1.x release
1722
*/}}
1823
{{- define "marklogic.oldFullname" -}}
24+
{{- if .Values.fullnameOverride }}
25+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
26+
{{- else }}
1927
{{- $name := default .Chart.Name .Values.nameOverride }}
2028
{{- if contains $name .Release.Name }}
2129
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
2230
{{- else }}
2331
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
2432
{{- end }}
2533
{{- end }}
34+
{{- end }}
2635

2736
{{- define "marklogic.shouldUseNewName" -}}
2837
{{- if .Release.IsInstall -}}
2938
{{- true }}
3039
{{- else }}
40+
{{- if .Values.fullnameOverride -}}
41+
{{- false }}
42+
{{- else }}
3143
{{- $newCm := (lookup "apps/v1" "StatefulSet" .Release.Namespace (include "marklogic.newFullname" .)) }}
3244
{{- if $newCm }}
3345
{{- true }}
@@ -36,6 +48,7 @@ oldFullname is the name used before 1.1.x release
3648
{{- end }}
3749
{{- end }}
3850
{{- end }}
51+
{{- end }}
3952

4053
{{/*
4154
Create a default fully qualified app name.
@@ -44,16 +57,12 @@ To surrport the upgrade from 1.0.x to 1.1.x, we keep the old name when doing upg
4457
For the new install, we use the new name, which is the release name.
4558
*/}}
4659
{{- define "marklogic.fullname" -}}
47-
{{- if .Values.fullnameOverride }}
48-
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
49-
{{- else }}
5060
{{- if eq (include "marklogic.shouldUseNewName" .) "true" -}}
5161
{{- include "marklogic.newFullname" . }}
5262
{{- else }}
5363
{{- include "marklogic.oldFullname" . }}
5464
{{- end }}
5565
{{- end }}
56-
{{- end }}
5766

5867
{{/*
5968
Create chart name and version as used by the chart label.
@@ -76,6 +85,20 @@ Create headless service name for statefulset
7685
{{- end}}
7786

7887

88+
{{/*
89+
Create cluster service name for statefulset
90+
*/}}
91+
{{- define "marklogic.clusterServiceName" -}}
92+
{{- if eq (include "marklogic.shouldUseNewName" .) "true" -}}
93+
{{- include "marklogic.newFullname" . }}-cluster
94+
{{- else }}
95+
{{- include "marklogic.oldFullname" . }}
96+
{{- end }}
97+
{{- end }}
98+
{{/*
99+
{{- end}}
100+
101+
79102
{{/*
80103
Create URL for headless service
81104
*/}}

charts/templates/configmap-haproxy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ data:
8181
mode tcp
8282
balance leastconn
8383
{{- range $i := until $replicas }}
84-
server {{ printf "ml-%s-%s-%v" $releaseName $portNumber $i }} {{ $releaseName }}-{{ $i }}.{{ $releaseName }}.{{ $namespace }}.svc.{{ $clusterDomain }}:{{ $portNumber }} check resolvers dns init-addr none
84+
server {{ printf "ml-%s-%s-%v" $releaseName $portNumber $i }} {{ $releaseName }}-{{ $i }}.{{ $headlessServiceName }}.{{ $namespace }}.svc.{{ $clusterDomain }}:{{ $portNumber }} check resolvers dns init-addr none
8585
{{- end }}
8686
{{- else if eq $portType "HTTP" }}
8787

charts/templates/service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
kind: Service
33
metadata:
4-
name: {{ include "marklogic.fullname" . }}-cluster
4+
name: {{ include "marklogic.clusterServiceName" . }}
55
namespace: {{ .Values.namespace}}
66
labels:
77
{{- include "marklogic.labels" . | nindent 4 }}

0 commit comments

Comments
 (0)