Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow loadbalancer service external IP #275

Merged
merged 6 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions application/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{- if .Values.service.loadBalancerIP }}
service.loadBalancerIP:
You have defined the value of service.loadBalancerIP for this release. Please
be mindful that this field has been deprecated as of Kubernetes v1.24 and may
be removed from the API in a later release.

Please refer to the Kubernetes documentation for more information.
{{- end }}
29 changes: 19 additions & 10 deletions application/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,29 @@ metadata:
namespace: {{ template "application.namespace" $ }}
labels:
{{- include "application.labels" . | nindent 4 }}
{{- if .Values.service.additionalLabels }}
{{ toYaml .Values.service.additionalLabels | indent 4 }}
{{- end }}
{{- if .Values.service.annotations }}
{{- if .Values.service.additionalLabels }}
{{- toYaml .Values.service.additionalLabels | nindent 4 }}
{{- end }}
{{- if .Values.service.annotations }}
annotations:
{{ include "application.tplvalues.render" ( dict "value" .Values.service.annotations "context" $ ) | indent 4 }}
{{- include "application.tplvalues.render" ( dict "value" .Values.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.service.type }}
type: "{{ .Values.service.type }}"
{{- end }}
{{- with .Values.service.clusterIP }}
clusterIP: {{ . }}
type: {{ .Values.service.type }}
clusterIP: {{ .Values.service.clusterIP }}
{{- if eq .Values.service.type "LoadBalancer" }}
{{- with .Values.service.loadBalancerIP }}
loadBalancerIP: {{ . }}
{{- end }}
d3adb5 marked this conversation as resolved.
Show resolved Hide resolved
{{- with .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- with .Values.service.externalIPs }}
externalIPs:
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
{{ include "application.selectorLabels" . | indent 4 }}
{{- if .Values.deployment.podLabels }}
Expand Down
19 changes: 19 additions & 0 deletions application/tests/notes_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
suite: NOTES.txt

templates:
- NOTES.txt

tests:
- it: warns the user of the deprecation of loadBalancerIP
set:
service.loadBalancerIP: 1.1.1.1
asserts:
- matchRegexRaw:
pattern: 'service.loadBalancerIP:'

- it: does not emit a warning for loadBalancerIP when not set
set:
service.loadBalancerIP: null
asserts:
- notMatchRegexRaw:
pattern: 'service.loadBalancerIP:'
Loading