From 6ffb7a94fc6d18dc12e158c17a517838f94fec57 Mon Sep 17 00:00:00 2001 From: Matteo Di Carlo <matteo.dicarlo@inaf.it> Date: Wed, 3 Feb 2021 12:07:27 +0100 Subject: [PATCH] ST-581 from master --- charts/ska-tango-images/Chart.yaml | 4 +-- charts/tango-base/Chart.yaml | 4 +-- charts/tango-util/Chart.yaml | 4 +-- .../tango-util/templates/_configuration.yaml | 35 ++++++++++++++++++- .../tango-util/templates/_deviceserver.yaml | 15 +++++++- 5 files changed, 54 insertions(+), 8 deletions(-) diff --git a/charts/ska-tango-images/Chart.yaml b/charts/ska-tango-images/Chart.yaml index 5364bceb..bacd8892 100644 --- a/charts/ska-tango-images/Chart.yaml +++ b/charts/ska-tango-images/Chart.yaml @@ -2,10 +2,10 @@ apiVersion: v2 appVersion: "1.0" description: A Helm chart for deploying the TANGO base system on Kubernetes name: ska-tango-images -version: 0.1.11 +version: 0.1.0 icon: https://www.skatelescope.org/wp-content/uploads/2016/07/09545_NEW_LOGO_2014.png dependencies: - name: tango-base - version: 0.2.12 + version: 0.2.13 repository: file://../tango-base condition: tango-base.enabled,global.sub-system.tango-base.enabled \ No newline at end of file diff --git a/charts/tango-base/Chart.yaml b/charts/tango-base/Chart.yaml index f17849dc..a37b8c8e 100644 --- a/charts/tango-base/Chart.yaml +++ b/charts/tango-base/Chart.yaml @@ -2,9 +2,9 @@ apiVersion: v2 appVersion: "1.0" description: A Helm chart for deploying the TANGO base system on Kubernetes name: tango-base -version: 0.2.12 +version: 0.2.13 icon: https://www.skatelescope.org/wp-content/uploads/2016/07/09545_NEW_LOGO_2014.png dependencies: - name: tango-util - version: 0.2.8 + version: 0.2.9 repository: file://../tango-util diff --git a/charts/tango-util/Chart.yaml b/charts/tango-util/Chart.yaml index fed31b98..0bdc4e07 100644 --- a/charts/tango-util/Chart.yaml +++ b/charts/tango-util/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 description: A Helm chart library of utilities for TANGO deployents name: tango-util type: library -appVersion: 0.2.8 -version: 0.2.8 +appVersion: 0.2.9 +version: 0.2.9 icon: https://www.skatelescope.org/wp-content/uploads/2016/07/09545_NEW_LOGO_2014.png maintainers: - name: Matteo Di Carlo diff --git a/charts/tango-util/templates/_configuration.yaml b/charts/tango-util/templates/_configuration.yaml index e8938ecc..cb585c86 100644 --- a/charts/tango-util/templates/_configuration.yaml +++ b/charts/tango-util/templates/_configuration.yaml @@ -5,6 +5,39 @@ {{ $default_tango_host := printf "%s-%s" "databaseds-tango-base-" .Release.Name }} {{ $tango_host := tpl (coalesce .Values.global.tango_host .Values.tango_host $default_tango_host | toString) . }} {{ $itango := coalesce .Values.global.itango .Values.itango}} +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.subsystem }}-sa-{{ .Release.Name }} + namespace: {{ .Release.Namespace }} + +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.subsystem }}-role-bind-{{ .Release.Name }} + namespace: {{ .Release.Namespace }} +subjects: +- kind: ServiceAccount + name: {{ .Values.subsystem }}-sa-{{ .Release.Name }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: Role + name: {{ .Values.subsystem }}-role-{{ .Release.Name }} + apiGroup: rbac.authorization.k8s.io +--- + +kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ .Values.subsystem }}-role-{{ .Release.Name }} + namespace: {{ .Release.Namespace }} +rules: +- apiGroups: ["", "batch", "apps"] + resources: ["jobs"] + verbs: ["list", "get", "watch"] + --- # Device Server configurations apiVersion: v1 @@ -105,4 +138,4 @@ spec: name: {{ .Values.subsystem }}-configuration-{{ .Release.Name }} restartPolicy: Never -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/charts/tango-util/templates/_deviceserver.yaml b/charts/tango-util/templates/_deviceserver.yaml index 5d46ba55..642b8757 100644 --- a/charts/tango-util/templates/_deviceserver.yaml +++ b/charts/tango-util/templates/_deviceserver.yaml @@ -62,7 +62,20 @@ spec: annotations: {{ toYaml $annotations | indent 8 }} spec: + {{ if $chart.Values.dsconfig.configuration_file }} + serviceAccountName: {{ $chart.Values.subsystem }}-sa-{{ $chart.Release.Name }} + {{ end }} initContainers: + {{ if $chart.Values.dsconfig.configuration_file }} + - name: wait-for-configuration + image: "bitnami/kubectl:latest" + imagePullPolicy: IfNotPresent + command: + - sh + - -c + args: + - kubectl wait job --for=condition=complete {{ $chart.Values.subsystem }}-configuration-{{ $chart.Release.Name }} {{ if $chart.Values.dsconfig.timeout }} --timeout={{ $chart.Values.dsconfig.timeout }} {{ end }} + {{ end }} {{ if (.deviceserver.depends_on) }} {{ range $index, $device := .deviceserver.depends_on }} {{ if ($device.host) }} @@ -151,4 +164,4 @@ spec: {{ toYaml . | indent 8 }} {{- end }} -{{ end }} \ No newline at end of file +{{ end }} -- GitLab