Skip to content

Commit

Permalink
Merge pull request #550 from eclipse/PR/use-ingress-v1
Browse files Browse the repository at this point in the history
Apply change from PR #314: Hawkbit: Use networking.k8s.io/v1 for Ingress if available
  • Loading branch information
calohmn authored Oct 2, 2024
2 parents f79acef + 8d5f6cd commit 8806852
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/hawkbit/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# SPDX-License-Identifier: EPL-2.0
---
apiVersion: v2
version: 1.6.0
version: 1.6.1
appVersion: "0.3.0M6-mysql"
description: |
Eclipse hawkBit™ is a domain independent back-end framework for rolling out software updates
Expand Down
11 changes: 11 additions & 0 deletions charts/hawkbit/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,14 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/*
Return the appropriate apiVersion for ingress.
*/}}
{{- define "hawkbit.ingressAPIVersion" -}}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}}
{{- print "networking.k8s.io/v1" -}}
{{- else -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- end -}}
{{- end -}}
15 changes: 14 additions & 1 deletion charts/hawkbit/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{- if .Values.ingress.enabled -}}
{{- $apiVersion := include "hawkbit.ingressAPIVersion" . -}}
{{- $fullName := include "hawkbit.fullname" . -}}
apiVersion: networking.k8s.io/v1beta1
apiVersion: {{ $apiVersion }}
kind: Ingress
metadata:
name: {{ $fullName }}
Expand All @@ -21,16 +22,28 @@ spec:
secretName: {{ .secretName }}
{{- end }}
{{- end }}
{{- if eq $apiVersion "networking.k8s.io/v1" }}
ingressClassName: {{ .Values.ingress.ingressClassName }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
{{- if eq $apiVersion "networking.k8s.io/v1" }}
pathType: Prefix
backend:
service:
name: {{ $fullName }}
port:
name: http
{{- else }}
backend:
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}
{{- end }}
{{- end }}
1 change: 1 addition & 0 deletions charts/hawkbit/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ readinessProbe:

ingress:
enabled: false
ingressClassName:
annotations: {}
# ingress.kubernetes.io/ssl-redirect: "true"
# kubernetes.io/tls-acme: "true"
Expand Down

0 comments on commit 8806852

Please sign in to comment.