Skip to content

Commit

Permalink
feat: split https and grpc ingresses
Browse files Browse the repository at this point in the history
  • Loading branch information
SonicGD committed Jun 27, 2024
1 parent a6ebb2a commit 8bb3cc5
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 15 deletions.
2 changes: 1 addition & 1 deletion charts/dotnet-app/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ description: SitkoRu dotnet app

type: application

version: 0.3.0
version: 0.4.0

appVersion: "1.0.0"
59 changes: 45 additions & 14 deletions charts/dotnet-app/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "dotnet-app.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- $grcpEnabled := .Values.ingress.grpcEnabled -}}
{{- $grcpPort := .Values.service.grpcPort -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "dotnet-app.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- with .Values.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
ingressClassName: {{ .Values.ingress.className }}
{{- if .Values.ingress.tls }}
Expand All @@ -30,17 +29,6 @@ spec:
- host: {{ .host | quote }}
http:
paths:
{{- if $grcpEnabled -}}
{{- range .grpcPaths }}
- path: {{ . }}
pathType: Prefix
backend:
service:
name: "{{ $fullName }}-grpc"
port:
number: {{ $grcpPort }}
{{- end }}
{{- end }}
{{- range .paths }}
- path: {{ .path }}
pathType: {{ .pathType }}
Expand All @@ -52,3 +40,46 @@ spec:
{{- end }}
{{- end }}
{{- end }}
---
{{- if and .Values.ingress.enabled .Values.ingress.grpcEnabled -}}
{{- $fullName := include "dotnet-app.fullname" . -}}
{{- $grcpPort := .Values.service.grpcPort -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: "{{ $fullName }}-grpc"
labels:
{{- include "dotnet-app.labels" . | nindent 4 }}
annotations:
{{- with .Values.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
nginx.ingress.kubernetes.io/backend-protocol: "GRPCS"
spec:
ingressClassName: {{ .Values.ingress.className }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .grpcPaths }}
- path: {{ . }}
pathType: Prefix
backend:
service:
name: "{{ $fullName }}-grpc"
port:
number: {{ $grcpPort }}
{{- end }}
{{- end }}
{{- end }}

0 comments on commit 8bb3cc5

Please sign in to comment.