-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vector): Add optional Ingress resource (#53)
* feat(vector): Add optional Ingress resource Signed-off-by: Spencer Gilbert <[email protected]> * fix(vector): Ensure we don't create a backend with both name and number for port Signed-off-by: Spencer Gilbert <[email protected]> * chore(vector): Include ci file and disable ingress by default Signed-off-by: Spencer Gilbert <[email protected]> * chore(vector): Run helm-docs Signed-off-by: Spencer Gilbert <[email protected]> * Switch to comparing versions Signed-off-by: Spencer Gilbert <[email protected]>
- Loading branch information
1 parent
c8d8ff0
commit 2b87bf0
Showing
4 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Ingress usage | ||
## Values file for testing Ingress parameters. | ||
ingress: | ||
enabled: true | ||
className: "nginx" | ||
annotations: | ||
nginx.ingress.kubernetes.io/rewrite-target: / | ||
kubernetes.io/tls-acme: "true" | ||
hosts: | ||
- host: chart-example.local | ||
paths: | ||
- path: /api/v1 | ||
pathType: Prefix | ||
port: | ||
name: "http" | ||
number: "8080" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
{{- 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 | ||
{{- end }} | ||
kind: Ingress | ||
metadata: | ||
name: {{ include "vector.fullname" . }} | ||
labels: | ||
{{- include "vector.labels" . | nindent 4 }} | ||
{{- with .Values.ingress.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} | ||
ingressClassName: {{ .Values.ingress.className }} | ||
{{- end }} | ||
{{- 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 .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: {{ if $.Values.haproxy.enabled }}{{ include "haproxy.fullname" $ }}{{ else }}{{ include "vector.fullname" $ }}{{ end }} | ||
port: | ||
{{- if .port.name }} | ||
name: {{ .port.name }} | ||
{{- else }} | ||
number: {{ .port.number }} | ||
{{- end }} | ||
{{- else }} | ||
serviceName: {{ if $.Values.haproxy.enabled }}{{ include "haproxy.fullname" $ }}{{ else }}{{ include "vector.fullname" $ }}{{ end }} | ||
servicePort: {{ .port.number }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters