Skip to content

Commit

Permalink
add service.labels and fix ingress service reference
Browse files Browse the repository at this point in the history
The ingress was mistakenly pointed to the headless service required for maintaining the statefulset. This means that `service.annotations`, etc. were not useful for controlling ingress behavior.

It might be desirable to change service names at some point to indicate which is headless / internal. However, that could be a disruptive action to any existing environments.
  • Loading branch information
colearendt committed Sep 19, 2022
1 parent 78eff8c commit bcd6db7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
5 changes: 5 additions & 0 deletions couchdb/NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# development

- Add `service.labels` value to pass along labels to the client-facing service
- Update `ingress` to use the service created by `service.enabled=true`, instead of the headless service
- This allows setting `service.annotations`, `service.labels`, etc. in a way that will be picked up by the ingress
2 changes: 1 addition & 1 deletion couchdb/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.ingress.enabled -}}
{{- $serviceName := include "couchdb.fullname" . -}}
{{- $serviceName := include "couchdb.svcname" . -}}
{{- $servicePort := .Values.service.externalPort -}}
{{- $path := .Values.ingress.path | quote -}}
apiVersion: networking.k8s.io/v1
Expand Down
9 changes: 6 additions & 3 deletions couchdb/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ metadata:
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.service.annotations }}
{{- with .Values.service.labels }}
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- with .Values.service.annotations }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
{{- . | toYaml | nindent 4 }}
{{- end }}
spec:
ports:
- port: {{ .Values.service.externalPort }}
Expand Down
3 changes: 2 additions & 1 deletion couchdb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,11 @@ tolerations: []
## chart without any additional configuration. The Service block below refers
## to a second Service that governs how clients connect to the CouchDB cluster.
service:
# annotations:
annotations: {}
enabled: true
type: ClusterIP
externalPort: 5984
labels: {}

## An Ingress resource can provide name-based virtual hosting and TLS
## termination among other things for CouchDB deployments which are accessed
Expand Down

0 comments on commit bcd6db7

Please sign in to comment.