From d135aa72dd4343eac197df652d324df5add3d071 Mon Sep 17 00:00:00 2001 From: Sam Wyma Date: Mon, 23 Sep 2019 16:49:13 +0100 Subject: [PATCH] Be able to define extra configuration in argo (#100) --- charts/argo/Chart.yaml | 2 +- charts/argo/templates/ui-deployment-pdb.yaml | 25 +++++++++++++++++++ charts/argo/templates/ui-deployment.yaml | 10 ++++++++ charts/argo/templates/ui-service.yaml | 6 +++++ .../workflow-controller-deployment-pdb.yaml | 23 +++++++++++++++++ .../workflow-controller-deployment.yaml | 4 +++ .../workflow-controller-service.yaml | 7 ++++-- charts/argo/values.yaml | 22 ++++++++++++++++ 8 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 charts/argo/templates/ui-deployment-pdb.yaml create mode 100644 charts/argo/templates/workflow-controller-deployment-pdb.yaml diff --git a/charts/argo/Chart.yaml b/charts/argo/Chart.yaml index cec9cf9c..275e6561 100644 --- a/charts/argo/Chart.yaml +++ b/charts/argo/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v1 appVersion: "v2.3.0" description: A Helm chart for Argo Workflows name: argo -version: 0.5.2 +version: 0.5.3 diff --git a/charts/argo/templates/ui-deployment-pdb.yaml b/charts/argo/templates/ui-deployment-pdb.yaml new file mode 100644 index 00000000..333c7bc1 --- /dev/null +++ b/charts/argo/templates/ui-deployment-pdb.yaml @@ -0,0 +1,25 @@ +{{- if .Values.ui.enabled -}} +{{- if .Values.ui.pdb.enabled -}} +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ .Release.Name }}-{{ .Values.ui.name}} + labels: + app: {{ .Release.Name }}-{{ .Values.ui.name}} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + {{- if .Values.ui.pdb.minAvailable }} + minAvailable: {{ .Values.ui.pdb.minAvailable }} + {{- else if .Values.ui.pdb.maxUnavailable }} + maxUnavailable: {{ .Values.ui.pdb.maxUnavailable }} + {{- else }} + minAvailable: 0 + {{- end }} + selector: + matchLabels: + app: {{ .Release.Name }}-{{ .Values.ui.name}} + release: {{ .Release.Name }} +{{- end -}} +{{- end -}} diff --git a/charts/argo/templates/ui-deployment.yaml b/charts/argo/templates/ui-deployment.yaml index ec2618d6..1cd416cf 100644 --- a/charts/argo/templates/ui-deployment.yaml +++ b/charts/argo/templates/ui-deployment.yaml @@ -8,6 +8,7 @@ metadata: release: {{ .Release.Name }} heritage: {{ .Release.Service }} spec: + replicas: {{ .Values.ui.replicas }} selector: matchLabels: app: {{ .Release.Name }}-{{ .Values.ui.name}} @@ -17,6 +18,9 @@ spec: labels: app: {{ .Release.Name }}-{{ .Values.ui.name}} release: {{ .Release.Name }} + {{- if .Values.ui.podLabels }} + {{- toYaml .Values.ui.podLabels | nindent 8 }} + {{- end }} {{- if .Values.ui.podAnnotations }} annotations: {{ toYaml .Values.ui.podAnnotations | indent 8}}{{- end }} @@ -26,6 +30,12 @@ spec: - name: ui image: "{{ .Values.images.namespace }}/{{ .Values.images.ui }}:{{ default .Values.images.tag .Values.ui.image.tag }}" imagePullPolicy: {{ .Values.images.pullPolicy }} + {{- if .Values.ui.podPortName }} + ports: + - name: {{ .Values.ui.podPortName }} + containerPort: 8001 + protocol: TCP + {{- end }} env: {{- if .Values.ui.forceNamespaceIsolation }} - name: FORCE_NAMESPACE_ISOLATION diff --git a/charts/argo/templates/ui-service.yaml b/charts/argo/templates/ui-service.yaml index 5cd848cc..5f84e246 100644 --- a/charts/argo/templates/ui-service.yaml +++ b/charts/argo/templates/ui-service.yaml @@ -7,12 +7,18 @@ metadata: chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- if .Values.ui.serviceLabels }} + {{- toYaml .Values.ui.serviceLabels | nindent 4 }} + {{- end }} {{- if .Values.ui.serviceAnnotations }} annotations: {{ toYaml .Values.ui.serviceAnnotations | indent 4}}{{- end }} spec: ports: - port: {{ .Values.ui.servicePort }} + {{- if .Values.ui.servicePortName }} + name: {{ .Values.ui.servicePortName }} + {{- end }} protocol: TCP targetPort: 8001 selector: diff --git a/charts/argo/templates/workflow-controller-deployment-pdb.yaml b/charts/argo/templates/workflow-controller-deployment-pdb.yaml new file mode 100644 index 00000000..a7352a04 --- /dev/null +++ b/charts/argo/templates/workflow-controller-deployment-pdb.yaml @@ -0,0 +1,23 @@ +{{- if .Values.controller.pdb.enabled }} +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ .Release.Name }}-{{ .Values.controller.name}} + labels: + app: {{ .Release.Name }}-{{ .Values.controller.name}} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + {{- if .Values.controller.pdb.minAvailable }} + minAvailable: {{ .Values.controller.pdb.minAvailable }} + {{- else if .Values.controller.pdb.maxUnavailable }} + maxUnavailable: {{ .Values.controller.pdb.maxUnavailable }} + {{- else }} + minAvailable: 0 + {{- end }} + selector: + matchLabels: + app: {{ .Release.Name }}-{{ .Values.controller.name}} + release: {{ .Release.Name }} +{{- end }} diff --git a/charts/argo/templates/workflow-controller-deployment.yaml b/charts/argo/templates/workflow-controller-deployment.yaml index b14bff94..b32385be 100644 --- a/charts/argo/templates/workflow-controller-deployment.yaml +++ b/charts/argo/templates/workflow-controller-deployment.yaml @@ -8,6 +8,7 @@ metadata: release: {{ .Release.Name }} heritage: {{ .Release.Service }} spec: + replicas: {{ .Values.controller.replicas }} selector: matchLabels: app: {{ .Release.Name }}-{{ .Values.controller.name}} @@ -17,6 +18,9 @@ spec: labels: app: {{ .Release.Name }}-{{ .Values.controller.name}} release: {{ .Release.Name }} + {{- if .Values.controller.podLabels }} + {{ toYaml .Values.controller.podLabels | nindent 8}} + {{- end }} {{- if .Values.controller.podAnnotations }} annotations: {{ toYaml .Values.controller.podAnnotations | indent 8}}{{- end }} diff --git a/charts/argo/templates/workflow-controller-service.yaml b/charts/argo/templates/workflow-controller-service.yaml index 5d4391de..7985a54c 100644 --- a/charts/argo/templates/workflow-controller-service.yaml +++ b/charts/argo/templates/workflow-controller-service.yaml @@ -8,19 +8,22 @@ metadata: chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- if .Values.controller.serviceLabels }} + {{ toYaml .Values.controller.serviceLabels | nindent 4}} + {{- end }} {{- if .Values.controller.serviceAnnotations }} annotations: {{ toYaml .Values.controller.serviceAnnotations | indent 4}}{{- end }} spec: ports: {{- if .Values.controller.metricsConfig.enabled }} - - name: metrics + - name: {{ .Values.controller.metricsServicePortName }} port: {{ .Values.controller.metricsServicePort }} protocol: TCP targetPort: {{ .Values.controller.metricsConfig.port }} {{- end }} {{- if .Values.controller.telemetryConfig.enabled }} - - name: telemetry + - name: {{ .Values.controller.telemetryServicePortName }} port: {{ .Values.controller.telemetryServicePort }} protocol: TCP targetPort: {{ .Values.controller.telemetryConfig.port }} diff --git a/charts/argo/values.yaml b/charts/argo/values.yaml index 06ae465a..ff23183c 100644 --- a/charts/argo/values.yaml +++ b/charts/argo/values.yaml @@ -21,6 +21,9 @@ controller: tag: "" # podAnnotations is an optional map of annotations to be applied to the controller Pods podAnnotations: {} + # Optional labels to add to the controller pods + podLabels: {} + # podPortName: http metricsConfig: enabled: false path: /metrics @@ -50,13 +53,22 @@ controller: globallevel: "0" serviceType: ClusterIP metricsServicePort: 8080 + metricsServicePortName: metrics telemetryServicePort: 8081 + telemetryServicePortName: telemetry # Annotations to be applied to the controller Service serviceAnnotations: {} + # Optional labels to add to the controller Service + serviceLabels: {} # Source ranges to allow access to service from. Only applies to # service type `LoadBalancer` loadBalancerSourceRanges: [] resources: {} + replicas: 1 + pdb: + enabled: false + # minAvailable: 1 + # maxUnavailable: 1 executor: image: @@ -72,12 +84,17 @@ ui: tag: "" # optional map of annotations to be applied to the ui Pods podAnnotations: {} + # Optional labels to add to the UI pods + podLabels: {} name: ui serviceType: ClusterIP servicePort: 80 + # servicePortName: http serviceAccount: argo-ui # Annotations to be applied to the UI Service serviceAnnotations: {} + # Optional labels to add to the UI Service + serviceLabels: {} # Static IP address to assign to loadBalancer # service type `LoadBalancer` loadBalancerIP: "" @@ -85,6 +102,11 @@ ui: # service type `LoadBalancer` loadBalancerSourceRanges: [] resources: {} + replicas: 1 + pdb: + enabled: false + # minAvailable: 1 + # maxUnavailable: 1 ## Ingress configuration. ## ref: https://kubernetes.io/docs/user-guide/ingress/