Skip to content

Commit

Permalink
Fixing Service Name References When Using fullnameOverride For Maste…
Browse files Browse the repository at this point in the history
…rs (#185)

Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon authored Dec 24, 2021
1 parent e45a917 commit fc6bda1
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 13 deletions.
14 changes: 14 additions & 0 deletions charts/opensearch/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
---
## [Unreleased]
### Added
### Changed
### Deprecated
### Removed
### Fixed
### Security
---
## [1.5.6]
### Added
**BREAKING CHANGE**
This version introduces a change in the service name definitions that will break Helm upgrades due to changes in the `StatefulSet`.

To resolve: Simply delete the existing statefulset in the cluster and ensure the PVC is retained (by default, this should be the case). `kubectl delete sts opensearch-cluster-master`
After deleting the statefulset and upgrading the helm chart again, the new replacement statefulset will be created and should consume the same PVC as before.

### Changed
### Deprecated
### Removed
Expand Down
2 changes: 1 addition & 1 deletion charts/opensearch/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.5.5
version: 1.5.6

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
8 changes: 8 additions & 0 deletions charts/opensearch/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{- end -}}

{{- define "opensearch.serviceName" -}}
{{- if eq .Values.nodeGroup "master" }}
{{- include "opensearch.masterService" . }}
{{- else }}
{{- include "opensearch.uname" . }}
{{- end }}
{{- end -}}

{{- define "opensearch.endpoints" -}}
{{- $replicas := int (toString (.Values.replicas)) }}
{{- $uname := (include "opensearch.uname" .) }}
Expand Down
2 changes: 1 addition & 1 deletion charts/opensearch/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "opensearch.uname" . -}}
{{- $fullName := include "opensearch.serviceName" . -}}
{{- $servicePort := .Values.httpPort -}}
{{- $ingressPath := .Values.ingress.path -}}
{{- $ingressApiIsStable := eq (include "opensearch.ingress.isStable" .) "true" -}}
Expand Down
12 changes: 2 additions & 10 deletions charts/opensearch/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
kind: Service
apiVersion: v1
metadata:
{{- if eq .Values.nodeGroup "master" }}
name: {{ template "opensearch.masterService" . }}
{{- else }}
name: {{ template "opensearch.uname" . }}
{{- end }}
name: {{ template "opensearch.serviceName" . }}
labels:
{{- include "opensearch.labels" . | nindent 4 }}
{{- if .Values.service.labels }}
Expand Down Expand Up @@ -42,11 +38,7 @@ spec:
kind: Service
apiVersion: v1
metadata:
{{- if eq .Values.nodeGroup "master" }}
name: {{ template "opensearch.masterService" . }}-headless
{{- else }}
name: {{ template "opensearch.uname" . }}-headless
{{- end }}
name: {{ template "opensearch.serviceName" . }}-headless
labels:
{{- include "opensearch.labels" . | nindent 4 }}
{{- if .Values.service.labelsHeadless }}
Expand Down
2 changes: 1 addition & 1 deletion charts/opensearch/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
annotations:
majorVersion: "{{ include "opensearch.majorVersion" . }}"
spec:
serviceName: {{ template "opensearch.uname" . }}-headless
serviceName: {{ template "opensearch.serviceName" . }}-headless
selector:
matchLabels:
{{- include "opensearch.selectorLabels" . | nindent 6 }}
Expand Down

0 comments on commit fc6bda1

Please sign in to comment.