Apply suggestions from code review

Co-authored-by: Brandon Mayfield <563214+bmayfi3ld@users.noreply.github.com>
Co-authored-by: Oliver Bähler <oliverbaehler@hotmail.com>
Signed-off-by: chgl <chgl@users.noreply.github.com>
This commit is contained in:
chgl 2021-04-28 21:23:32 +02:00
parent 09c0cea427
commit 7f33231d34
15 changed files with 79 additions and 59 deletions

View file

@ -94,3 +94,21 @@ Return the appropriate apiVersion for ingress
{{- print "networking.k8s.io/v1" -}} {{- print "networking.k8s.io/v1" -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/*
Return the appropriate service layout for ingress
*/}}
{{- define "argo-workflows.ingress.service" -}}
{{- if semverCompare "<1.19-0" .kubeVersion -}}
- backend:
serviceName: {{ .serviceName }}
servicePort: {{ .servicePort }}
{{- else -}}
- backend:
service:
name: {{ .serviceName }}
port:
number: {{ .servicePort }}
pathType: ImplementationSpecific
{{- end -}}
{{- end -}}

View file

@ -24,9 +24,9 @@ spec:
{{- end }} {{- end }}
spec: spec:
serviceAccountName: {{ template "argo-workflows.controllerServiceAccountName" . }} serviceAccountName: {{ template "argo-workflows.controllerServiceAccountName" . }}
{{- if .Values.controller.podSecurityContext }} {{- with .Values.controller.podSecurityContext }}
securityContext: securityContext:
{{- toYaml .Values.controller.podSecurityContext | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
containers: containers:
- name: controller - name: controller

View file

@ -2,5 +2,7 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: {{ template "argo-workflows.controllerServiceAccountName" . }} name: {{ template "argo-workflows.controllerServiceAccountName" . }}
{{ with .Values.controller.serviceAccountAnnotations }}
annotations: annotations:
{{ toYaml .Values.controller.serviceAccountAnnotations | indent 4 }} {{- toYaml .| nindent 4 }}
{{- end }}

View file

@ -6,8 +6,8 @@ metadata:
labels: labels:
{{- include "argo-workflows.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }} {{- include "argo-workflows.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }}
app.kubernetes.io/version: {{ default .Chart.AppVersion .Values.controller.image.tag | quote }} app.kubernetes.io/version: {{ default .Chart.AppVersion .Values.controller.image.tag | quote }}
{{- if .Values.controller.serviceLabels }} {{- with .Values.controller.serviceLabels }}
{{ toYaml .Values.controller.serviceLabels | nindent 4}} {{ toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- with .Values.controller.serviceAnnotations }} {{- with .Values.controller.serviceAnnotations }}
annotations: annotations:
@ -33,5 +33,6 @@ spec:
type: {{ .Values.controller.serviceType }} type: {{ .Values.controller.serviceType }}
{{- if and (eq .Values.controller.serviceType "LoadBalancer") .Values.controller.loadBalancerSourceRanges }} {{- if and (eq .Values.controller.serviceType "LoadBalancer") .Values.controller.loadBalancerSourceRanges }}
loadBalancerSourceRanges: loadBalancerSourceRanges:
{{ toYaml .Values.controller.loadBalancerSourceRanges | indent 4 }}{{- end }} {{- toYaml .Values.controller.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
{{- end -}} {{- end -}}

View file

@ -5,19 +5,19 @@ metadata:
name: {{ template "argo-workflows.controller.fullname" . }} name: {{ template "argo-workflows.controller.fullname" . }}
labels: labels:
{{- include "argo-workflows.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }} {{- include "argo-workflows.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }}
{{- if .Values.controller.serviceMonitor.additionalLabels }} {{- with .Values.controller.serviceMonitor.additionalLabels }}
{{ toYaml .Values.controller.serviceMonitor.additionalLabels | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
endpoints: endpoints:
{{- if .Values.controller.metricsConfig.enabled }} {{- with .Values.controller.metricsConfig.enabled }}
- port: metrics - port: metrics
path: {{ .Values.controller.metricsConfig.path }} path: {{ . }}
interval: 30s interval: 30s
{{- end }} {{- end }}
{{- if .Values.controller.telemetryConfig.enabled }} {{- with .Values.controller.telemetryConfig.enabled }}
- port: telemetry - port: telemetry
path: {{ .Values.controller.telemetryConfig.path }} path: {{ . }}
interval: 30s interval: 30s
{{- end }} {{- end }}
namespaceSelector: namespaceSelector:

View file

@ -3,9 +3,9 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding kind: RoleBinding
metadata: metadata:
name: {{ template "argo-workflows.fullname" . }}-workflow name: {{ template "argo-workflows.fullname" . }}-workflow
{{- if .Values.workflow.namespace }} {{- with .Values.workflow.namespace }}
namespace: {{ .Values.workflow.namespace }} namespace: {{ . }}
{{- end }} {{- end }}
roleRef: roleRef:
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io
kind: Role kind: Role
@ -13,7 +13,7 @@ roleRef:
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: {{ .Values.workflow.serviceAccount.name }} name: {{ .Values.workflow.serviceAccount.name }}
{{- if .Values.workflow.namespace }} {{- with .Values.workflow.namespace }}
namespace: {{ .Values.workflow.namespace }} namespace: {{ . }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -3,8 +3,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role kind: Role
metadata: metadata:
name: {{ template "argo-workflows.fullname" . }}-workflow name: {{ template "argo-workflows.fullname" . }}-workflow
{{- if .Values.workflow.namespace }} {{- with .Values.workflow.namespace }}
namespace: {{ .Values.workflow.namespace }} namespace: {{ . }}
{{- end }} {{- end }}
rules: rules:
- apiGroups: - apiGroups:

View file

@ -3,8 +3,8 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: {{ .Values.workflow.serviceAccount.name }} name: {{ .Values.workflow.serviceAccount.name }}
{{- if .Values.workflow.namespace }} {{- with .Values.workflow.namespace }}
namespace: {{ .Values.workflow.namespace }} namespace: {{ . }}
{{- end }} {{- end }}
{{- with .Values.workflow.serviceAccount.annotations }} {{- with .Values.workflow.serviceAccount.annotations }}
annotations: annotations:

View file

@ -1,10 +1,10 @@
{{- if .Values.server.enabled }} {{- if .Values.server.enabled }}
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
{{- if .Values.singleNamespace }} {{- if .Values.singleNamespace }}
kind: Role kind: Role
{{- else }} {{- else }}
kind: ClusterRole kind: ClusterRole
{{- end }} {{- end }}
metadata: metadata:
name: {{ template "argo-workflows.server.fullname" . }} name: {{ template "argo-workflows.server.fullname" . }}
labels: labels:
@ -30,7 +30,7 @@ rules:
- list - list
- watch - watch
- delete - delete
{{- if .Values.server.sso }} {{- if .Values.server.sso }}
- apiGroups: - apiGroups:
- "" - ""
resources: resources:
@ -46,9 +46,7 @@ rules:
- secrets - secrets
verbs: verbs:
- create - create
{{- end}} {{- if .Values.server.sso.rbac }}
{{- if .Values.server.sso }}
{{- if .Values.server.sso.rbac }}
- apiGroups: - apiGroups:
- "" - ""
resources: resources:
@ -56,8 +54,8 @@ rules:
verbs: verbs:
- get - get
- list - list
{{- end }}
{{- end }} {{- end }}
{{- end }}
- apiGroups: - apiGroups:
- "" - ""
resources: resources:

View file

@ -1,5 +1,4 @@
{{- if .Values.server.enabled -}} {{- if and .Values.server.enabled .Values.server.pdb.enabled -}}
{{- if .Values.server.pdb.enabled -}}
apiVersion: policy/v1beta1 apiVersion: policy/v1beta1
kind: PodDisruptionBudget kind: PodDisruptionBudget
metadata: metadata:
@ -18,4 +17,3 @@ spec:
matchLabels: matchLabels:
{{- include "argo-workflows.selectorLabels" (dict "context" . "name" .Values.server.name) | nindent 6 }} {{- include "argo-workflows.selectorLabels" (dict "context" . "name" .Values.server.name) | nindent 6 }}
{{- end -}} {{- end -}}
{{- end -}}

View file

@ -16,17 +16,18 @@ spec:
labels: labels:
{{- include "argo-workflows.labels" (dict "context" . "component" .Values.server.name "name" .Values.server.name) | nindent 8 }} {{- include "argo-workflows.labels" (dict "context" . "component" .Values.server.name "name" .Values.server.name) | nindent 8 }}
app.kubernetes.io/version: {{ default .Chart.AppVersion .Values.server.image.tag | quote }} app.kubernetes.io/version: {{ default .Chart.AppVersion .Values.server.image.tag | quote }}
{{- if .Values.server.podLabels }} {{- with .Values.server.podLabels }}
{{- toYaml .Values.server.podLabels | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- if .Values.server.podAnnotations }} {{- with .Values.server.podAnnotations }}
annotations: annotations:
{{ toYaml .Values.server.podAnnotations | indent 8}}{{- end }} {{- toYaml .Values.server.podAnnotations | nindent 8 }}
{{- end }}
spec: spec:
serviceAccountName: {{ .Values.server.serviceAccount | quote }} serviceAccountName: {{ .Values.server.serviceAccount | quote }}
{{- if .Values.server.podSecurityContext }} {{- with .Values.server.podSecurityContext }}
securityContext: securityContext:
{{- toYaml .Values.server.podSecurityContext | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
containers: containers:
- name: argo-server - name: argo-server
@ -37,8 +38,8 @@ spec:
args: args:
- server - server
- --configmap={{ .Release.Name }}-{{ .Values.controller.name }}-configmap - --configmap={{ .Release.Name }}-{{ .Values.controller.name }}-configmap
{{- if .Values.server.extraArgs }} {{- with .Values.server.extraArgs }}
{{- toYaml .Values.server.extraArgs | nindent 10 }} {{- toYaml . | nindent 10 }}
{{- end }} {{- end }}
- "--secure={{ .Values.server.secure }}" - "--secure={{ .Values.server.secure }}"
{{- if .Values.singleNamespace }} {{- if .Values.singleNamespace }}
@ -98,7 +99,7 @@ spec:
affinity: affinity:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- if .Values.server.priorityClassName }} {{- with .Values.server.priorityClassName }}
priorityClassName: {{ .Values.server.priorityClassName }} priorityClassName: {{ . }}
{{- end }} {{- end }}
{{- end -}} {{- end -}}

View file

@ -3,10 +3,11 @@
{{- $serviceName := include "argo-workflows.server.fullname" . -}} {{- $serviceName := include "argo-workflows.server.fullname" . -}}
{{- $servicePort := .Values.server.servicePort -}} {{- $servicePort := .Values.server.servicePort -}}
apiVersion: {{ include "argo-workflows.ingress.apiVersion" . }} apiVersion: {{ include "argo-workflows.ingress.apiVersion" . }}
kind: Ingress
metadata: metadata:
name: {{ template "argo-workflows.server.fullname" . }} name: {{ template "argo-workflows.server.fullname" . }}
labels: labels:
{{- include "argo-workflows.labels" $ | nindent 4 }} {{- include "argo-workflows.labels" (dict "context" . "component" .Values.server.name "name" .Values.server.name) | nindent 4 }}
{{- range $key, $value := .Values.server.ingress.labels }} {{- range $key, $value := .Values.server.ingress.labels }}
{{ $key }}: {{ $value | quote }} {{ $key }}: {{ $value | quote }}
{{- end }} {{- end }}
@ -16,24 +17,21 @@ metadata:
{{- end }} {{- end }}
spec: spec:
rules: rules:
{{- $kubeVersion := .Capabilities.KubeVersion.GitVersion}}
{{- range .Values.server.ingress.hosts }} {{- range .Values.server.ingress.hosts }}
- host: {{ . }} - host: {{ . }}
http: http:
paths: paths:
{{- if $.Values.server.ingress.paths }} {{- if $.Values.server.ingress.paths }}
{{- range $.Values.server.ingress.paths }} {{- range $.Values.server.ingress.paths }}
- backend: {{- include "argo-workflows.ingress.service" (dict "kubeVersion" $kubeVersion "serviceName" .serviceName "servicePort" .servicePort) | nindent 10 }}
serviceName: {{ .serviceName }}
servicePort: {{ .servicePort }}
{{- end }} {{- end }}
{{- end }} {{- end }}
- backend: {{- include "argo-workflows.ingress.service" (dict "kubeVersion" $kubeVersion "serviceName" $serviceName "servicePort" $servicePort) | nindent 10 }}
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end -}} {{- end -}}
{{- if .Values.server.ingress.tls }} {{- with .Values.server.ingress.tls }}
tls: tls:
{{ toYaml .Values.server.ingress.tls | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}}

View file

@ -3,6 +3,8 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: {{ template "argo-workflows.serverServiceAccountName" . }} name: {{ template "argo-workflows.serverServiceAccountName" . }}
{{- with .Values.server.serviceAccountAnnotations }}
annotations: annotations:
{{ toYaml .Values.server.serviceAccountAnnotations | indent 4 }} {{- toYaml . | indent 4 }}
{{- end }}
{{- end -}} {{- end -}}

View file

@ -6,14 +6,15 @@ metadata:
labels: labels:
{{- include "argo-workflows.labels" (dict "context" . "component" .Values.server.name "name" .Values.server.name) | nindent 4 }} {{- include "argo-workflows.labels" (dict "context" . "component" .Values.server.name "name" .Values.server.name) | nindent 4 }}
app.kubernetes.io/version: {{ default .Chart.AppVersion .Values.server.image.tag | quote }} app.kubernetes.io/version: {{ default .Chart.AppVersion .Values.server.image.tag | quote }}
{{- if .Values.server.serviceAnnotations }} {{- with .Values.server.serviceAnnotations }}
annotations: annotations:
{{ toYaml .Values.server.serviceAnnotations | indent 4}}{{- end }} {{- toYaml . | nindent 4 }}
{{- end }}
spec: spec:
ports: ports:
- port: {{ .Values.server.servicePort }} - port: {{ .Values.server.servicePort }}
{{- if .Values.server.servicePortName }} {{- with .Values.server.servicePortName }}
name: {{ .Values.server.servicePortName }} name: {{ . }}
{{- end }} {{- end }}
targetPort: 2746 targetPort: 2746
selector: selector:
@ -25,5 +26,6 @@ spec:
{{- end }} {{- end }}
{{- if and (eq .Values.server.serviceType "LoadBalancer") .Values.server.loadBalancerSourceRanges }} {{- if and (eq .Values.server.serviceType "LoadBalancer") .Values.server.loadBalancerSourceRanges }}
loadBalancerSourceRanges: loadBalancerSourceRanges:
{{ toYaml .Values.server.loadBalancerSourceRanges | indent 4 }}{{- end }} {{- toYaml .Values.server.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
{{- end -}} {{- end -}}

View file

@ -2,7 +2,7 @@ apiVersion: v2
appVersion: v2.12.5 appVersion: v2.12.5
description: A Helm chart for Argo Workflows description: A Helm chart for Argo Workflows
name: argo name: argo
version: 0.16.11 version: 1.0.0
icon: https://raw.githubusercontent.com/argoproj/argo/master/docs/assets/argo.png icon: https://raw.githubusercontent.com/argoproj/argo/master/docs/assets/argo.png
home: https://github.com/argoproj/argo-helm home: https://github.com/argoproj/argo-helm
dependencies: dependencies: