Add rollouts dashboard ingress support

Signed-off-by: Sergey Shaykhullin <sergeyshaykhullin@gmail.com>
This commit is contained in:
Sergey Shaykhullin 2021-09-17 20:27:37 +03:00
parent 489443e387
commit 57e4680e72
7 changed files with 192 additions and 7 deletions

View file

@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "v1.0.2"
description: A Helm chart for Argo Rollouts
name: argo-rollouts
version: 2.1.0
version: 2.1.1
icon: https://argoproj.github.io/argo-rollouts/assets/logo.png
home: https://github.com/argoproj/argo-helm
maintainers:
@ -11,4 +11,4 @@ maintainers:
- name: jessesuen
annotations:
artifacthub.io/changes: |
- "[Added]: Keep CRDs on Helm uninstall by default, add corresponding option"
- "[Added]: Dashboard ingress support"

View file

@ -72,6 +72,20 @@ If dashboard is installed by `--set dashboard.enabled=true`, checkout the argo-r
| dashboard.serviceAccount.create | bool | `true` | Specifies whether a dashboard service account should be created |
| dashboard.serviceAccount.annotations | object | `{}` | Annotations to add to the dashboard service account |
| dashboard.serviceAccount.name | string | `""` | The name of the dashboard service account to use. If not set and create is true, a name is generated using the fullname template |
| dashboard.service.annotations | object | `{}` | Dashboard service annotations |
| dashboard.service.labels | object | `{}` | Dashboard service labels |
| dashboard.service.portName | string | `dashboard` | Dashboard service port name |
| dashboard.service.port | int | `3100` | Dashboard service port |
| dashboard.service.targetPort | int | `3100` | Dashboard service target port |
| dashboard.ingress.enabled | bool | `false` | Enable dashboard ingress support |
| dashboard.ingress.annotations | object | `{}` | Dashboard ingress annotations |
| dashboard.ingress.labels | object | `{}` | Dashboard ingress labels |
| dashboard.ingress.ingressClassName | string | `""` | Dashboard ingress class name |
| dashboard.ingress.hosts | list | `[]` | Dashboard ingress hosts |
| dashboard.ingress.paths | list | `[/]` | Dashboard ingress paths |
| dashboard.ingress.pathType | string | `Prefix` | Dashboard ingress path type |
| dashboard.ingress.extraPaths | list | `[]` | Dashboard ingress extra paths |
| dashboard.ingress.tls | list | `[]` | Dashboard ingress tls |
## Upgrading

View file

@ -62,3 +62,23 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
{{/*
Return the appropriate apiVersion for ingress
*/}}
{{- define "argo-rollouts.ingress.apiVersion" -}}
{{- if semverCompare "<1.14-0" (include "argo-rollouts.kubeVersion" $) -}}
{{- print "extensions/v1beta1" -}}
{{- else if semverCompare "<1.19-0" (include "argo-rollouts.kubeVersion" $) -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- print "networking.k8s.io/v1" -}}
{{- end -}}
{{- end -}}
{{/*
Return the target Kubernetes version
*/}}
{{- define "argo-rollouts.kubeVersion" -}}
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride }}
{{- end -}}

View file

@ -36,7 +36,7 @@ spec:
imagePullPolicy: {{ .Values.dashboard.image.pullPolicy }}
name: argo-rollouts-dashboard
ports:
- containerPort: 3100
- containerPort: {{ .Values.dashboard.service.targetPort }}
name: dashboard
securityContext:
{{- toYaml .Values.dashboard.containerSecurityContext | nindent 10 }}

View file

@ -0,0 +1,89 @@
{{- if and .Values.dashboard.enabled .Values.dashboard.ingress.enabled -}}
{{- $serviceName := include "argo-rollouts.fullname" . -}}
{{- $servicePort := .Values.dashboard.service.port -}}
{{- $paths := .Values.dashboard.ingress.paths -}}
{{- $extraPaths := .Values.dashboard.ingress.extraPaths -}}
{{- $pathType := .Values.dashboard.ingress.pathType -}}
apiVersion: {{ include "argo-rollouts.ingress.apiVersion" . }}
kind: Ingress
metadata:
{{- if .Values.dashboard.ingress.annotations }}
annotations:
{{- range $key, $value := .Values.dashboard.ingress.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
name: {{ template "argo-rollouts.fullname" . }}-dashboard
labels:
{{- include "argo-rollouts.labels" . | nindent 4 }}
{{- if .Values.dashboard.ingress.labels }}
{{- toYaml .Values.dashboard.ingress.labels | nindent 4 }}
{{- end }}
spec:
{{- if eq (include "argo-rollouts.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- with .Values.dashboard.ingress.ingressClassName }}
ingressClassName: {{ . }}
{{- end }}
{{- end }}
rules:
{{- if .Values.dashboard.ingress.hosts }}
{{- range $host := .Values.dashboard.ingress.hosts }}
- host: {{ $host }}
http:
paths:
{{- if $extraPaths }}
{{- toYaml $extraPaths | nindent 10 }}
{{- end }}
{{- range $p := $paths }}
- path: {{ $p }}
{{- if eq (include "argo-rollouts.ingress.apiVersion" $) "networking.k8s.io/v1" }}
pathType: {{ $pathType }}
{{- end }}
backend:
{{- if eq (include "argo-rollouts.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-rollouts.ingress.apiVersion" $) "networking.k8s.io/v1" }}
pathType: {{ $pathType }}
{{- end }}
backend:
{{- if eq (include "argo-rollouts.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.dashboard.ingress.tls }}
tls:
{{- toYaml .Values.dashboard.ingress.tls | nindent 4 }}
{{- end -}}
{{- end -}}

View file

@ -6,16 +6,22 @@ metadata:
labels:
app.kubernetes.io/component: {{ .Values.dashboard.component }}
{{- include "argo-rollouts.labels" . | nindent 4 }}
{{- with .Values.serviceAnnotations }}
{{- with .Values.dashboard.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- with .Values.serviceAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.dashboard.service.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
ports:
- name: dashboard
- name: {{ .Values.dashboard.service.portName }}
protocol: TCP
port: 3100
targetPort: 3100
port: {{ .Values.dashboard.service.port }}
targetPort: {{ .Values.dashboard.service.targetPort }}
selector:
app.kubernetes.io/component: {{ .Values.dashboard.component }}
{{- include "argo-rollouts.selectorLabels" . | nindent 4 }}

View file

@ -3,6 +3,18 @@ keepCRDs: true
clusterInstall: true
## String to partially override "argo-rollouts.fullname" template
##
nameOverride:
## String to fully override "argo-rollouts.fullname" template
##
fullnameOverride:
## Override the Kubernetes version, which is used to evaluate certain manifests
##
kubeVersionOverride: ""
controller:
component: rollouts-controller
## Node selectors and tolerations for server scheduling to nodes with taints
@ -120,3 +132,47 @@ dashboard:
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
service:
annotations: {}
labels: {}
portName: dashboard
port: 3100
targetPort: 3100
## Ingress configuration.
## ref: https://kubernetes.io/docs/user-guide/ingress/
##
ingress:
enabled: false
annotations: {}
labels: {}
ingressClassName: ""
## Argo Rollouts Dashboard Ingress.
## Hostnames must be provided if Ingress is enabled.
## Secrets must be manually created in the namespace
##
hosts:
[]
# - argorollouts.example.com
paths:
- /
pathType: Prefix
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
tls:
[]
# - secretName: argorollouts-example-tls
# hosts:
# - argorollouts.example.com