{{- if .Values.ingress.grpc.enabled -}} {{- $fullName := include "defguard-proxy.fullname" . -}} {{- if and .Values.ingress.grpc.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} {{- if not (hasKey .Values.ingress.grpc.annotations "kubernetes.io/ingress.class") }} {{- $_ := set .Values.ingress.grpc.annotations "kubernetes.io/ingress.class" .Values.ingress.grpc.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 {{- end }} kind: Ingress metadata: name: {{ $fullName }}-grpc labels: {{- include "defguard-proxy.labels" . | nindent 4 }} {{- with .Values.ingress.grpc.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} spec: {{- if and .Values.ingress.grpc.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} ingressClassName: {{ .Values.ingress.grpc.className }} {{- end }} {{- if .Values.ingress.grpc.tls }} tls: - hosts: - {{ .Values.ingress.grpc.host | quote }} secretName: {{ printf "%s-grpc-tls" .Values.ingress.grpc.host }} {{- end }} rules: - host: {{ .Values.ingress.grpc.host | quote }} http: paths: - path: / {{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }} pathType: ImplementationSpecific {{- end }} backend: {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} service: name: {{ $fullName }}-grpc port: number: {{ .Values.service.ports.grpc }} {{- else }} serviceName: {{ $fullName }}-grpc servicePort: {{ .Values.service.ports.grpc }} {{- end }} {{- end }}