Skip to content

Commit

Permalink
Use networking.k8s.io/v1 for Ingress in k8s >=1.19 (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia authored Dec 16, 2021
1 parent 9983b6f commit 36cab6e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion charts/centrifugo/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: centrifugo
description: Centrifugo is a scalable real-time messaging server in language-agnostic way
version: 7.2.4
version: 7.3.0
appVersion: 3.1.1
home: https://centrifugal.dev
icon: https://centrifugal.dev/img/favicon.png
Expand Down
21 changes: 17 additions & 4 deletions charts/centrifugo/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
{{- $fullName := include "centrifugo.fullname" . -}}
{{- $namespace := include "centrifugo.namespace" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "19" ) }}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion }}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
Expand All @@ -18,6 +18,9 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.ingressClassName }}
ingressClassName: {{ .Values.ingress.ingressClassName }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
Expand All @@ -35,9 +38,19 @@ spec:
paths:
{{- range .paths }}
- path: {{ . }}
{{- if or ( gt $.Capabilities.KubeVersion.Major "1" ) ( ge $.Capabilities.KubeVersion.Minor "19" ) }}
pathType: {{ $.Values.ingress.pathType }}
{{- end }}
backend:
{{- if or ( gt $.Capabilities.KubeVersion.Major "1" ) ( ge $.Capabilities.KubeVersion.Minor "19" ) }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
7 changes: 7 additions & 0 deletions charts/centrifugo/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ uniGrpcService:

ingress:
enabled: false

# Optionally set the ingressClassName. k8s >= 1.18
ingressClassName: ""

# pathType override - see: https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types
pathType: Prefix

annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
Expand Down

0 comments on commit 36cab6e

Please sign in to comment.