Skip to content

Commit

Permalink
chore(helm): Enables updated k8 apis for ingress and batch
Browse files Browse the repository at this point in the history
  • Loading branch information
vchendrix committed Jan 26, 2024
1 parent 2c8e8a9 commit 19bb30f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/
version: 2.0.1
version: 2.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
23 changes: 20 additions & 3 deletions helm/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "ngt-archive.fullname" . -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
Expand All @@ -16,17 +23,27 @@ metadata:
namespace: {{ .Release.Namespace }}
name: web
spec:
ingressClassName: nginx
ingressClassName: {{ .Values.ingress.className }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ tpl .host $ | quote }}
http:
paths:
{{- range .paths }}
- path: {{ tpl .path $ }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
serviceName: web
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: web
port:
number: 8000
{{- else }}
serviceName: {{ $fullName }}
servicePort: 8000
{{- end }}
{{- end }}
{{- end }}

Expand Down
2 changes: 1 addition & 1 deletion helm/templates/pgdump-cronjob.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: batch/v1beta1
apiVersion: batch/v1
kind: CronJob
metadata:
annotations:
Expand Down
2 changes: 2 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ volume:
ingress:
# ingress.name - Name of the ingres. (Defaults to fullname)
name: ""
# ingress.className
className: "nginx"
# ingress.enabled - enable the ingress
enabled: false
# ingress.annotations - annotations for this ingress
Expand Down

0 comments on commit 19bb30f

Please sign in to comment.