feat(argocd-applicationset): Add ingress for webhook (#1059)
* feat(argocd-applicationset): Add service and ingress for webhook Signed-off-by: Jos van Bakel <jos@codeaddict.org> * Bump chart version Signed-off-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com> * Cleanup README Signed-off-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com> * Cleanup values.yaml Signed-off-by: Jos van Bakel <jos@codeaddict.org> * Add missing var 'kubeVersionOverride' to values and README Signed-off-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com> * Clarify changelog Signed-off-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com> Co-authored-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com>
This commit is contained in:
parent
e7a27468b2
commit
9bfd353b6b
6 changed files with 182 additions and 4 deletions
|
|
@ -62,3 +62,25 @@ Create the name of the service account to use
|
|||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Return the target Kubernetes version
|
||||
*/}}
|
||||
{{- define "argo-applicationset.kubeVersion" -}}
|
||||
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for ingress
|
||||
*/}}
|
||||
{{- define "argo-applicationset.ingress.apiVersion" -}}
|
||||
{{- if .Values.apiVersionOverrides.ingress -}}
|
||||
{{- print .Values.apiVersionOverrides.ingress -}}
|
||||
{{- else if semverCompare "<1.14-0" (include "argo-applicationset.kubeVersion" $) -}}
|
||||
{{- print "extensions/v1beta1" -}}
|
||||
{{- else if semverCompare "<1.19-0" (include "argo-applicationset.kubeVersion" $) -}}
|
||||
{{- print "networking.k8s.io/v1beta1" -}}
|
||||
{{- else -}}
|
||||
{{- print "networking.k8s.io/v1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
|
|
|||
89
charts/argocd-applicationset/templates/webhook-ingress.yaml
Normal file
89
charts/argocd-applicationset/templates/webhook-ingress.yaml
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
{{- if .Values.webhook.ingress.enabled -}}
|
||||
{{- $serviceName := include "argo-applicationset.fullname" . -}}
|
||||
{{- $servicePort := "webhook" -}}
|
||||
{{- $paths := .Values.webhook.ingress.paths -}}
|
||||
{{- $extraPaths := .Values.webhook.ingress.extraPaths -}}
|
||||
{{- $pathType := .Values.webhook.ingress.pathType -}}
|
||||
apiVersion: {{ include "argo-applicationset.ingress.apiVersion" . }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
{{- if .Values.webhook.ingress.annotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := .Values.webhook.ingress.annotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
name: {{ include "argo-applicationset.fullname" . }}
|
||||
labels:
|
||||
{{- include "argo-applicationset.labels" . | nindent 4 }}
|
||||
{{- if .Values.webhook.ingress.labels }}
|
||||
{{- toYaml .Values.webhook.ingress.labels | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if eq (include "argo-applicationset.ingress.apiVersion" $) "networking.k8s.io/v1" }}
|
||||
{{- with .Values.webhook.ingress.ingressClassName }}
|
||||
ingressClassName: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- if .Values.webhook.ingress.hosts }}
|
||||
{{- range $host := .Values.webhook.ingress.hosts }}
|
||||
- host: {{ $host }}
|
||||
http:
|
||||
paths:
|
||||
{{- if $extraPaths }}
|
||||
{{- toYaml $extraPaths | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- range $p := $paths }}
|
||||
- path: {{ $p }}
|
||||
{{- if eq (include "argo-applicationset.ingress.apiVersion" $) "networking.k8s.io/v1" }}
|
||||
pathType: {{ $pathType }}
|
||||
{{- end }}
|
||||
backend:
|
||||
{{- if eq (include "argo-applicationset.ingress.apiVersion" $) "networking.k8s.io/v1" }}
|
||||
service:
|
||||
name: {{ $serviceName }}
|
||||
port:
|
||||
{{- if kindIs "float64" $servicePort }}
|
||||
number: {{ $servicePort }}
|
||||
{{- else }}
|
||||
name: {{ $servicePort }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
serviceName: {{ $serviceName }}
|
||||
servicePort: {{ $servicePort }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- else }}
|
||||
- http:
|
||||
paths:
|
||||
{{- if $extraPaths }}
|
||||
{{- toYaml $extraPaths | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- range $p := $paths }}
|
||||
- path: {{ $p }}
|
||||
{{- if eq (include "argo-applicationset.ingress.apiVersion" $) "networking.k8s.io/v1" }}
|
||||
pathType: {{ $pathType }}
|
||||
{{- end }}
|
||||
backend:
|
||||
{{- if eq (include "argo-applicationset.ingress.apiVersion" $) "networking.k8s.io/v1" }}
|
||||
service:
|
||||
name: {{ $serviceName }}
|
||||
port:
|
||||
{{- if kindIs "float64" $servicePort }}
|
||||
number: {{ $servicePort }}
|
||||
{{- else }}
|
||||
name: {{ $servicePort }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
serviceName: {{ $serviceName }}
|
||||
servicePort: {{ $servicePort }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if .Values.webhook.ingress.tls }}
|
||||
tls:
|
||||
{{- toYaml .Values.webhook.ingress.tls | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue