Skip to content

Commit

Permalink
Add per replica headless svc nitro
Browse files Browse the repository at this point in the history
  • Loading branch information
a-thomas-22 committed Nov 15, 2024
1 parent d85cf16 commit dbc099c
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/nitro/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ maintainers:

type: application

version: 0.6.19
version: 0.6.20

appVersion: "v3.2.1-d81324d"
47 changes: 47 additions & 0 deletions charts/nitro/templates/headlessperreplicaservice.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{{- if .Values.perReplicaHeadlessService.enabled }}
{{- range $i := until ($.Values.replicaCount | int) }}
{{- $iStr := ($i | print)}}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "nitro.fullname" $ }}-{{ $i }}-headless
labels:
{{- include "nitro.labels" $ | nindent 4 }}
app.kubernetes.io/component: headless
annotations:
{{- if $.Values.perReplicaHeadlessService.annotations }}
{{- toYaml $.Values.perReplicaHeadlessService.annotations | nindent 4 }}
{{- end }}
spec:
clusterIP: None # This makes the service headless
ports:
{{- if and $.Values.configmap.data.http $.Values.configmap.data.http.port }}
- port: {{ index $.Values.configmap.data.http.port }}
targetPort: http-rpc
protocol: TCP
name: http-rpc
{{- end }}
{{- if and $.Values.configmap.data.ws $.Values.configmap.data.ws.port }}
- port: {{ index $.Values.configmap.data.ws.port }}
targetPort: ws
protocol: TCP
name: ws
{{- end }}
{{- if and $.Values.configmap.data.node $.Values.configmap.data.node.feed $.Values.configmap.data.node.feed.output $.Values.configmap.data.node.feed.output.port }}
- port: {{ $.Values.configmap.data.node.feed.output.port }}
targetPort: feed
protocol: TCP
name: feed
{{- end }}
{{- if $.Values.configmap.data.metrics }}
- port: {{ index $.Values "configmap" "data" "metrics-server" "port" }}
targetPort: metrics
protocol: TCP
name: metrics
{{- end }}
selector:
statefulset.kubernetes.io/pod-name: {{ include "nitro.fullname" $ }}-{{ . }}
publishNotReadyAddresses: {{ $.Values.perReplicaHeadlessService.publishNotReadyAddresses }}
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/nitro/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,19 @@ serviceMonitor:

## @param perReplicaService.enabled Enable a service for each sts replica
## @param perReplicaService.publishNotReadyAddresses Publish not ready addresses
## @param perReplicaService.annotations Annotations for the service
perReplicaService:
enabled: false
publishNotReadyAddresses: true
annotations: {}

## @param perReplicaHeadlessService.enabled Enable a headless service for each sts replica
## @param perReplicaHeadlessService.publishNotReadyAddresses Publish not ready addresses
## @param perReplicaHeadlessService.annotations Annotations for the headless service
perReplicaHeadlessService:
enabled: false
publishNotReadyAddresses: true
annotations: {}

## @param headlessservice.enabled Enable headless service
## @param headlessservice.publishNotReadyAddresses Publish not ready addresses
Expand Down

0 comments on commit dbc099c

Please sign in to comment.