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:
Jos van Bakel 2022-01-09 19:07:37 +01:00 committed by GitHub
parent e7a27468b2
commit 9bfd353b6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 182 additions and 4 deletions

View file

@ -2,7 +2,7 @@ apiVersion: v2
name: argocd-applicationset
description: A Helm chart for installing ArgoCD ApplicationSet
type: application
version: 1.8.0
version: 1.9.0
appVersion: "v0.3.0"
home: https://github.com/argoproj/argo-helm
icon: https://argocd-applicationset.readthedocs.io/en/stable/assets/logo.png
@ -14,4 +14,4 @@ maintainers:
- name: maruina
annotations:
artifacthub.io/changes: |
- "[Changed]: Bumped argocd-applicationset to 0.3.0"
- "[Added]: Add ingress for webhook, not enabled by default."

View file

@ -57,6 +57,7 @@ kubectl apply -k https://github.com/argoproj-labs/applicationset.git/manifests/c
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | [Assign custom affinity rules to the deployment](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/) |
| apiVersionOverrides.ingress | string | `""` | String to override apiVersion of ingresses rendered by this helm chart |
| args.argocdRepoServer | string | `"argocd-repo-server:8081"` | The default Argo CD repo server address |
| args.debug | bool | `false` | Print debug logs |
| args.dryRun | bool | `false` | Enable dry run mode |
@ -73,6 +74,7 @@ kubectl apply -k https://github.com/argoproj-labs/applicationset.git/manifests/c
| image.repository | string | `"quay.io/argoproj/argocd-applicationset"` | The image repository |
| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. |
| imagePullSecrets | list | `[]` | If defined, uses a Secret to pull an image from a private Docker registry or repository. |
| kubeVersionOverride | string | `""` | Override the Kubernetes version, which is used to evaluate certain manifests |
| metrics.enabled | bool | `false` | Deploy metrics service |
| metrics.service.annotations | object | `{}` | Metrics service annotations |
| metrics.service.labels | object | `{}` | Metrics service labels |
@ -102,6 +104,15 @@ kubectl apply -k https://github.com/argoproj-labs/applicationset.git/manifests/c
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
| tolerations | list | `[]` | [Tolerations for use with node taints](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) |
| webhook.ingress.annotations | object | `{}` | Additional ingress annotations |
| webhook.ingress.enabled | bool | `false` | Enable an ingress resource for Webhooks |
| webhook.ingress.extraPaths | list | `[]` | Additional ingress paths |
| webhook.ingress.hosts | list | `[]` | List of ingress hosts |
| webhook.ingress.ingressClassName | string | `""` | Defines which ingress controller will implement the resource |
| webhook.ingress.labels | object | `{}` | Additional ingress labels |
| webhook.ingress.pathType | string | `"Prefix"` | Ingress path type. One of `Exact`, `Prefix` or `ImplementationSpecific` |
| webhook.ingress.paths | list | `["/api/webhook"]` | List of ingress paths |
| webhook.ingress.tls | list | `[]` | Ingress TLS configuration |
----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs)

View file

@ -54,4 +54,5 @@ kubectl apply -k https://github.com/argoproj-labs/applicationset.git/manifests/c
{{ template "chart.valuesSection" . }}
{{ template "helm-docs.versionFooter" . }}
----------------------------------------------
Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs)

View file

@ -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 -}}

View 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 -}}

View file

@ -146,3 +146,58 @@ extraVolumes: []
# -- List of extra cli args to add
extraArgs: []
# - --loglevel=warn
# -- Override the Kubernetes version, which is used to evaluate certain manifests
kubeVersionOverride: ""
## Override APIVersions
## If you want to template helm charts but cannot access k8s API server
## you can set api versions here
apiVersionOverrides:
# -- String to override apiVersion of ingresses rendered by this helm chart
ingress: "" # networking.k8s.io/v1beta1
## Webhook for the Git Generator
## Ref: https://argocd-applicationset.readthedocs.io/en/master/Generators-Git/#webhook-configuration)
webhook:
ingress:
# -- Enable an ingress resource for Webhooks
enabled: false
# -- Additional ingress annotations
annotations: {}
# -- Additional ingress labels
labels: {}
# -- Defines which ingress controller will implement the resource
ingressClassName: ""
# -- List of ingress hosts
## Hostnames must be provided if Ingress is enabled.
## Secrets must be manually created in the namespace
hosts: []
# - argocd-applicationset.example.com
# -- List of ingress paths
paths:
- /api/webhook
# -- Ingress path type. One of `Exact`, `Prefix` or `ImplementationSpecific`
pathType: Prefix
# -- Additional ingress paths
extraPaths: []
# - path: /*
# backend:
# serviceName: ssl-redirect
# servicePort: use-annotation
## for Kubernetes >=1.19 (when "networking.k8s.io/v1" is used)
# - path: /*
# pathType: Prefix
# backend:
# service:
# name: ssl-redirect
# port:
# name: use-annotation
# -- Ingress TLS configuration
tls: []
# - secretName: argocd-applicationset-tls
# hosts:
# - argocd-applicationset.example.com