2 Copyright (c) 2019 AT&T Intellectual Property.
3 Copyright (c) 2019 Nokia.
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
17 {{- $platformNamespace := include "common.namespace.platform" . }}
18 {{- $xappNamespace := include "common.namespace.xapp" . }}
19 {{- $releaseName := default "ric-full" .Values.ric.platform.releaseName }}
20 {{- $jobName := printf "%s-%s" .Release.Name $releaseName }}
21 {{- $acctName := randAlpha 6 | lower | printf "%s-%s" $jobName }}
22 {{- $serviceAccountName := default $acctName .Values.ric.robot.job.serviceAccount.name }}
23 {{- if .Values.ric.robot.job.serviceAccount.create }}
28 name: {{ $serviceAccountName }}
29 namespace: {{ .Release.Namespace }}
31 apiVersion: rbac.authorization.k8s.io/v1beta1
34 name: {{ $serviceAccountName }}-{{ $releaseName }}-ricplatform-access
35 namespace: {{ $platformNamespace }}
38 resources: ["pods", "services"]
39 verbs: ["get", "list"]
41 resources: ["daemonsets", "replicasets", "statefulsets"]
42 verbs: ["get", "list"]
43 - apiGroups: ["extensions"]
44 resources: ["daemonsets", "replicasets"]
45 verbs: ["get", "list"]
47 resources: ["deployments"]
48 verbs: ["get", "list", "patch"]
49 - apiGroups: ["extensions"]
50 resources: ["deployments"]
51 verbs: ["get", "list", "patch"]
53 apiVersion: rbac.authorization.k8s.io/v1beta1
56 name: {{ $serviceAccountName }}-{{ $releaseName }}-ricplatform-access
57 namespace: {{ $platformNamespace }}
59 apiGroup: rbac.authorization.k8s.io
61 name: {{ $serviceAccountName }}-{{ $releaseName }}-ricplatform-access
63 - kind: ServiceAccount
64 name: {{ $serviceAccountName }}
65 namespace: {{ .Release.Namespace }}
66 {{- if ne $xappNamespace $platformNamespace }}
68 apiVersion: rbac.authorization.k8s.io/v1beta1
71 name: {{ $serviceAccountName }}-{{ $releaseName }}-xapp-access
72 namespace: {{ $xappNamespace }}
75 resources: ["pods", "pods/log", "services"]
76 verbs: ["get", "list"]
78 resources: ["deployments", "daemonsets", "replicasets", "statefulsets"]
79 verbs: ["get", "list"]
80 - apiGroups: ["extensions"]
81 resources: ["deployments", "daemonsets", "replicasets"]
82 verbs: ["get", "list"]
84 apiVersion: rbac.authorization.k8s.io/v1beta1
87 name: {{ $serviceAccountName }}-{{ $releaseName }}-xapp-access
88 namespace: {{ $xappNamespace }}
90 apiGroup: rbac.authorization.k8s.io
92 name: {{ $serviceAccountName }}-{{ $releaseName }}-xapp-access
94 - kind: ServiceAccount
95 name: {{ $serviceAccountName }}
96 namespace: {{ .Release.Namespace }}
103 name: {{ $jobName }}-ric-robot-run
104 namespace: {{ .Release.Namespace }}
106 backoffLimit: {{ default 0 .Values.ric.robot.job.backoffLimit }}
109 serviceAccountName: {{ $serviceAccountName }}
110 restartPolicy: {{ default "Never" .Values.ric.robot.job.restartPolicy }}
112 - name: {{ $jobName }}-generate-robot-kubeconfig
113 {{ with .Values.images.ric.robot.job.init }}
114 image: {{ if .repository }}{{- .repository -}} / {{- end -}}{{- .name -}}{{- if .tag -}} : {{- .tag -}} {{- end }}
115 imagePullPolicy: {{ default "IfNotPresent" .pullPolicy }}
119 value: {{ $serviceAccountName }}
121 value: {{ default "kubernetes" .Values.ric.cluster.name }}
123 value: /robot/etc/ric-robot-kubeconfig.conf
125 value: "kubernetes.default.svc.{{ default "cluster.local" .Values.ric.cluster.domain }}"
126 command: ["/robot/bin/svcacct-to-kubeconfig.sh"]
129 mountPath: /robot/etc
131 {{- if .Values.ric.robot.log }}
133 mountPath: /robot/log
137 mountPath: /robot/bin
139 {{- $secrets := dict }}
140 {{- range $index, $container := .Values.images.ric.robot.job }}
141 {{- if index $container "repositoryCred" }}
142 {{- $_ := set $secrets $container.repositoryCred (dict "name" $container.repositoryCred) }}
145 {{- if keys $secrets }}
147 {{- values $secrets | toYaml |nindent 8 }}
150 - name: {{ $jobName }}-ric-robot
151 {{ with .Values.images.ric.robot.job.run -}}
152 image: {{ if .repository }}{{- .repository -}} / {{- end -}}{{- .name -}}{{- if .tag -}} : {{- .tag -}} {{- end }}
153 imagePullPolicy: {{ default "IfNotPresent" .pullPolicy }}
156 - name: RICPLT_NAMESPACE
157 value: {{ $platformNamespace }}
158 - name: RICPLT_RELEASE_NAME
159 value: {{ $releaseName }}
160 - name: RICPLT_COMPONENTS
161 value: {{ keys .Values.ric.platform.components | join " " }}
162 - name: RICXAPP_NAMESPACE
163 value: {{ $xappNamespace }}
165 value: /robot/etc/ric-robot-kubeconfig.conf
169 {{- if not .Values.ric.robot.job.failOnTestFail }}
172 {{- if .Values.ric.robot.log }}
189 {{- if .Values.ric.robot.tags.enabled }}
190 {{- range .Values.ric.robot.tags.enabled }}
195 {{- if .Values.ric.robot.tags.disabled }}
196 {{- range .Values.ric.robot.tags.disabled }}
201 {{- if .Values.ric.robot.testsuites }}
202 {{- range .Values.ric.robot.testsuites }}
203 - "/robot/testsuites/{{.}}.robot"
206 - "/robot/testsuites"
209 - name: robot-testsuites
210 mountPath: /robot/testsuites
213 mountPath: /robot/etc
215 {{- if .Values.ric.robot.log }}
217 mountPath: /robot/log
220 # for compatability with the ric robot, we mount
221 # both properties files and interface libraries
223 {{- range $map, $ignore := $.Files.Glob "configmap-src/*/properties/*.robot" }}
224 - name: robot-properties
225 mountPath: /robot/resources/{{ base $map }}
226 subPath: {{ base $map }}
229 {{- range $map, $ignore := $.Files.Glob "configmap-src/*/resources/*.robot" }}
230 - name: robot-resources
231 mountPath: /robot/resources/{{ base $map }}
232 subPath: {{ base $map }}
239 {{- if .Values.ric.robot.log }}
241 path: {{ default "/opt/ric/robot/log" .Values.ric.robot.log }}
242 type: DirectoryOrCreate
248 - name: robot-testsuites
250 name: robot-testsuites
252 - name: robot-properties
254 name: robot-properties
256 - name: robot-resources
258 name: robot-resources