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

Chart compatibility kubernetes 1.22 #3002

Merged
merged 5 commits into from
Jan 19, 2023
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
1 change: 1 addition & 0 deletions changelog.d/0-release-notes/chart-compatibility
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wire-server helm charts using Ingress resources are now compatible with kubernetes versions 1.22, 1.23 and 1.24 (but keep being compatible with older versions of kubernetes).
10 changes: 0 additions & 10 deletions charts/elasticsearch-ephemeral/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,3 @@ We truncate at 53 chars (63 - len("-discovery")) because some Kubernetes name fi
{{- printf "%s" $name | trunc 53 | trimSuffix "-" -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for Curactor cron job.
*/}}
{{- define "curator.cronJob.apiVersion" -}}
{{- if ge .Capabilities.KubeVersion.Minor "8" -}}
"batch/v1beta1"
{{- else -}}
"batch/v2alpha1"
{{- end -}}
{{- end -}}
26 changes: 26 additions & 0 deletions charts/inbucket/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{/* Allow KubeVersion to be overridden. */}}
{{- define "kubeVersion" -}}
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride -}}
{{- end -}}

{{/* Get Ingress API Version */}}
{{- define "ingress.apiVersion" -}}
{{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19-0" (include "kubeVersion" .)) -}}
{{- print "networking.k8s.io/v1" -}}
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- print "extensions/v1beta1" -}}
{{- end -}}
{{- end -}}

{{/* Check Ingress stability */}}
{{- define "ingress.isStable" -}}
{{- eq (include "ingress.apiVersion" .) "networking.k8s.io/v1" -}}
{{- end -}}

{{/* Check Ingress supports pathType */}}
{{/* pathType was added to networking.k8s.io/v1beta1 in Kubernetes 1.18 */}}
{{- define "ingress.supportsPathType" -}}
{{- or (eq (include "ingress.isStable" .) "true") (and (eq (include "ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" (include "kubeVersion" .))) -}}
{{- end -}}
14 changes: 13 additions & 1 deletion charts/inbucket/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apiVersion: extensions/v1beta1
{{- $apiIsStable := eq (include "ingress.isStable" .) "true" -}}
{{- $ingressSupportsPathType := eq (include "ingress.supportsPathType" .) "true" -}}
apiVersion: {{ include "ingress.apiVersion" . }}
kind: Ingress
metadata:
name: "inbucket"
Expand All @@ -14,6 +16,16 @@ spec:
http:
paths:
- path: /
{{- if $ingressSupportsPathType }}
pathType: Prefix
{{- end }}
backend:
{{- if $apiIsStable }}
service:
name: {{ include "inbucket.fullname" . }}
port:
name: http
{{- else }}
serviceName: {{ include "inbucket.fullname" . }}
servicePort: http
{{- end }}
13 changes: 13 additions & 0 deletions charts/ldap-scim-bridge/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{/* Allow KubeVersion to be overridden. */}}
{{- define "kubeVersion" -}}
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride -}}
{{- end -}}

{{/* Get Batch API Version */}}
{{- define "batch.apiVersion" -}}
{{- if and (.Capabilities.APIVersions.Has "batch/v1") (semverCompare ">= 1.21-0" (include "kubeVersion" .)) -}}
{{- print "batch/v1" -}}
{{- else -}}
{{- print "batch/v1beta1" -}}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/ldap-scim-bridge/templates/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: batch/v1beta1
apiVersion: {{ include "batch.apiVersion" . }}
kind: CronJob
metadata:
name: {{ .Release.Name }}
Expand Down
26 changes: 26 additions & 0 deletions charts/legalhold/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{/* Allow KubeVersion to be overridden. */}}
{{- define "kubeVersion" -}}
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride -}}
{{- end -}}

{{/* Get Ingress API Version */}}
{{- define "ingress.apiVersion" -}}
{{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19-0" (include "kubeVersion" .)) -}}
{{- print "networking.k8s.io/v1" -}}
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- print "extensions/v1beta1" -}}
{{- end -}}
{{- end -}}

{{/* Check Ingress stability */}}
{{- define "ingress.isStable" -}}
{{- eq (include "ingress.apiVersion" .) "networking.k8s.io/v1" -}}
{{- end -}}

{{/* Check Ingress supports pathType */}}
{{/* pathType was added to networking.k8s.io/v1beta1 in Kubernetes 1.18 */}}
{{- define "ingress.supportsPathType" -}}
{{- or (eq (include "ingress.isStable" .) "true") (and (eq (include "ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" (include "kubeVersion" .))) -}}
{{- end -}}
14 changes: 13 additions & 1 deletion charts/legalhold/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apiVersion: extensions/v1beta1
{{- $apiIsStable := eq (include "ingress.isStable" .) "true" -}}
{{- $ingressSupportsPathType := eq (include "ingress.supportsPathType" .) "true" -}}
apiVersion: {{ include "ingress.apiVersion" . }}
kind: Ingress
metadata:
name: hold
Expand All @@ -16,6 +18,16 @@ spec:
http:
paths:
- path: /
{{- if $ingressSupportsPathType }}
pathType: Prefix
{{- end }}
backend:
{{- if $apiIsStable }}
service:
name: "{{ .Release.Name }}-hold"
port:
number: 8080
{{- else }}
serviceName: "{{ .Release.Name }}-hold"
servicePort: 8080
{{- end }}
27 changes: 27 additions & 0 deletions charts/nginx-ingress-services/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,30 @@ Returns the Letsencrypt API server URL based on whether testMode is enabled or d
{{- $hostnameParts = append $hostnameParts "v02" -}}
{{- join "-" $hostnameParts | printf "https://%s.api.letsencrypt.org/directory" -}}
{{- end -}}

{{/* Allow KubeVersion to be overridden. */}}
{{- define "kubeVersion" -}}
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride -}}
{{- end -}}

{{/* Get Ingress API Version */}}
{{- define "ingress.apiVersion" -}}
{{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19-0" (include "kubeVersion" .)) -}}
{{- print "networking.k8s.io/v1" -}}
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- print "extensions/v1beta1" -}}
{{- end -}}
{{- end -}}

{{/* Check Ingress stability */}}
{{- define "ingress.isStable" -}}
{{- eq (include "ingress.apiVersion" .) "networking.k8s.io/v1" -}}
{{- end -}}

{{/* Check Ingress supports pathType */}}
{{/* pathType was added to networking.k8s.io/v1beta1 in Kubernetes 1.18 */}}
{{- define "ingress.supportsPathType" -}}
{{- or (eq (include "ingress.isStable" .) "true") (and (eq (include "ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" (include "kubeVersion" .))) -}}
{{- end -}}
64 changes: 63 additions & 1 deletion charts/nginx-ingress-services/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apiVersion: extensions/v1beta1
{{- $apiIsStable := eq (include "ingress.isStable" .) "true" -}}
{{- $ingressSupportsPathType := eq (include "ingress.supportsPathType" .) "true" -}}
apiVersion: {{ include "ingress.apiVersion" . }}
kind: Ingress
metadata:
name: nginx-ingress
Expand Down Expand Up @@ -31,51 +33,111 @@ spec:
http:
paths:
- path: /
{{- if $ingressSupportsPathType }}
pathType: Prefix
{{- end }}
backend:
{{- if $apiIsStable }}
service:
name: nginz
port:
name: http
{{- else }}
serviceName: nginz
servicePort: http
{{- end }}
{{- if .Values.websockets.enabled }}
- host: {{ .Values.config.dns.ssl }}
http:
paths:
- path: /
{{- if $ingressSupportsPathType }}
pathType: Prefix
{{- end }}
backend:
{{- if $apiIsStable }}
service:
name: nginz
port:
name: ws
{{- else }}
serviceName: nginz
servicePort: ws
{{- end }}
{{- end }}
{{- if .Values.webapp.enabled }}
- host: {{ .Values.config.dns.webapp }}
http:
paths:
- path: /
{{- if $ingressSupportsPathType }}
pathType: Prefix
{{- end }}
backend:
{{- if $apiIsStable }}
service:
name: webapp-http
port:
number: {{ .Values.service.webapp.externalPort }}
{{- else }}
serviceName: webapp-http
servicePort: {{ .Values.service.webapp.externalPort }}
{{- end }}
{{- end }}
{{- if .Values.fakeS3.enabled }}
- host: {{ .Values.config.dns.fakeS3 }}
http:
paths:
- path: /
{{- if $ingressSupportsPathType }}
pathType: Prefix
{{- end }}
backend:
{{- if $apiIsStable }}
service:
name: {{ .Values.service.s3.serviceName }}
port:
number: {{ .Values.service.s3.externalPort }}
{{- else }}
serviceName: {{ .Values.service.s3.serviceName }}
servicePort: {{ .Values.service.s3.externalPort }}
{{- end }}
{{- end }}
{{- if .Values.teamSettings.enabled }}
- host: {{ .Values.config.dns.teamSettings }}
http:
paths:
- path: /
{{- if $ingressSupportsPathType }}
pathType: Prefix
{{- end }}
backend:
{{- if $apiIsStable }}
service:
name: team-settings-http
port:
number: {{ .Values.service.teamSettings.externalPort }}
{{- else }}
serviceName: team-settings-http
servicePort: {{ .Values.service.teamSettings.externalPort }}
{{- end }}
{{- end }}
{{- if .Values.accountPages.enabled }}
- host: {{ .Values.config.dns.accountPages }}
http:
paths:
- path: /
{{- if $ingressSupportsPathType }}
pathType: Prefix
{{- end }}
backend:
{{- if $apiIsStable }}
service:
name: account-pages-http
port:
number: {{ .Values.service.accountPages.externalPort }}
{{- else }}
serviceName: account-pages-http
servicePort: {{ .Values.service.accountPages.externalPort }}
{{- end }}
{{- end }}
11 changes: 10 additions & 1 deletion charts/nginx-ingress-services/templates/ingress_federator.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{{- $apiIsStable := eq (include "ingress.isStable" .) "true" -}}
{{- $ingressSupportsPathType := eq (include "ingress.supportsPathType" .) "true" -}}
{{- if .Values.federator.enabled }}
# We use a separate ingress for federator so that we can require client
# certificates only for federation requests
apiVersion: extensions/v1beta1
apiVersion: {{ include "ingress.apiVersion" . }}
kind: Ingress
metadata:
name: federator-ingress
Expand All @@ -24,6 +26,13 @@ spec:
http:
paths:
- backend:
{{- if $apiIsStable }}
service:
name: federator
port:
name: federator-ext
{{- else }}
serviceName: federator
servicePort: federator-ext # name must be below 15 chars
{{- end }}
{{- end }}
27 changes: 27 additions & 0 deletions charts/sftd/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,30 @@ app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: join-call
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/* Allow KubeVersion to be overridden. */}}
{{- define "kubeVersion" -}}
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride -}}
{{- end -}}

{{/* Get Ingress API Version */}}
{{- define "ingress.apiVersion" -}}
{{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19-0" (include "kubeVersion" .)) -}}
{{- print "networking.k8s.io/v1" -}}
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- print "extensions/v1beta1" -}}
{{- end -}}
{{- end -}}

{{/* Check Ingress stability */}}
{{- define "ingress.isStable" -}}
{{- eq (include "ingress.apiVersion" .) "networking.k8s.io/v1" -}}
{{- end -}}

{{/* Check Ingress supports pathType */}}
{{/* pathType was added to networking.k8s.io/v1beta1 in Kubernetes 1.18 */}}
{{- define "ingress.supportsPathType" -}}
{{- or (eq (include "ingress.isStable" .) "true") (and (eq (include "ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" (include "kubeVersion" .))) -}}
{{- end -}}
34 changes: 33 additions & 1 deletion charts/sftd/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apiVersion: extensions/v1beta1
{{- $apiIsStable := eq (include "ingress.isStable" .) "true" -}}
{{- $ingressSupportsPathType := eq (include "ingress.supportsPathType" .) "true" -}}
apiVersion: {{ include "ingress.apiVersion" . }}
kind: Ingress
metadata:
name: "{{ include "sftd.fullname" . }}"
Expand All @@ -18,14 +20,44 @@ spec:
http:
paths:
- path: /sft/
{{- if $ingressSupportsPathType }}
pathType: Prefix
{{- end }}
backend:
{{- if $apiIsStable }}
service:
name: {{ include "sftd.fullname" . }}
port:
name: sft
{{- else }}
serviceName: "{{ include "sftd.fullname" . }}"
servicePort: sft
{{- end }}
- path: /sfts/
{{- if $ingressSupportsPathType }}
pathType: Prefix
{{- end }}
backend:
{{- if $apiIsStable }}
service:
name: "{{ include "sftd.fullname" . }}-join-call"
port:
name: http
{{- else }}
serviceName: "{{ include "sftd.fullname" . }}-join-call"
servicePort: http
{{- end }}
- path: /sft_servers_all.json
{{- if $ingressSupportsPathType }}
pathType: Exact
{{- end }}
backend:
{{- if $apiIsStable }}
service:
name: "{{ include "sftd.fullname" . }}-join-call"
port:
name: http
{{- else }}
serviceName: "{{ include "sftd.fullname" . }}-join-call"
servicePort: http
{{- end }}