Skip to content

Commit

Permalink
feat: make it possible to use ingress and service-type "LoadBalancer"…
Browse files Browse the repository at this point in the history
… at the same time

When service type is "LoadBalancer" and ingress is enabled, a second service is deployed. There are two services at that point. One for the ingress and one for the LoadBalancer.
  • Loading branch information
pmoscode committed May 25, 2023
1 parent 1b800e6 commit a494fdf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spec:
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
name: {{ $fullName }}-headless
port:
number: {{ $svcPort }}
{{- else }}
Expand Down
19 changes: 19 additions & 0 deletions templates/service-headless.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "gotify.fullname" . }}-headless
labels:
{{- include "gotify.labels" . | nindent 4 }}
spec:
{{- if eq .Values.service.type "LoadBalancer" }}
type: ClusterIP
{{- else }}
type: {{ .Values.service.type }}
{{- end }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "gotify.selectorLabels" . | nindent 4 }}
4 changes: 3 additions & 1 deletion templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{{- if and (eq .Values.service.type "LoadBalancer") (.Values.ingress.enabled) }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "gotify.fullname" . }}
labels:
{{- include "gotify.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
type: LoadBalancer
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "gotify.selectorLabels" . | nindent 4 }}
{{- end }}

0 comments on commit a494fdf

Please sign in to comment.