Skip to content

Commit

Permalink
nesis: add api ingress
Browse files Browse the repository at this point in the history
  • Loading branch information
mawandm committed Jun 6, 2024
1 parent 6856475 commit 3a0a970
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
1 change: 1 addition & 0 deletions charts/nesis/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
*.tmproj
.vscode/
tests
.secrets.yml
2 changes: 1 addition & 1 deletion charts/nesis/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: nesis
description: A Helm chart for Nesis, Your Enterprise Knowledge Partner
type: application
version: "0.1.4"
version: "0.1.5"
appVersion: "0.1.1"

dependencies:
Expand Down
62 changes: 62 additions & 0 deletions charts/nesis/templates/api/ingress-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{- if .Values.api.ingress.enabled -}}
{{- $fullName := include "nesis.fullname" . -}}
{{- $svcPort := .Values.api.service.port -}}
{{- if and .Values.api.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.api.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.api.ingress.annotations "kubernetes.io/ingress.class" .Values.api.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
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-api
labels:
{{- include "nesis.labels" . | nindent 4 }}
app.kubernetes.io/component: api
{{- with .Values.api.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.api.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.api.ingress.className }}
{{- end }}
{{- if .Values.api.ingress.tls }}
tls:
{{- range .Values.api.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.api.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}-api
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}-api
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

0 comments on commit 3a0a970

Please sign in to comment.