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", "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 }}
108 serviceAccountName: {{ $serviceAccountName }}
111 - name: {{ $jobName }}-generate-robot-kubeconfig
112 {{ with .Values.images.ric.robot.job.init }}
113 image: {{ if .repository }}{{- .repository -}} / {{- end -}}{{- .name -}}{{- if .tag -}} : {{- .tag -}} {{- end }}
114 imagePullPolicy: {{ default "IfNotPresent" .pullPolicy }}
118 value: {{ $serviceAccountName }}
120 value: {{ default "kubernetes" .Values.ric.cluster.name }}
122 value: /robot/etc/ric-robot-kubeconfig.conf
124 value: "kubernetes.default.svc.{{ default "cluster.local" .Values.ric.cluster.domain }}"
125 command: ["/robot/bin/svcacct-to-kubeconfig.sh"]
128 mountPath: /robot/etc
130 {{- if .Values.ric.robot.log }}
132 mountPath: /robot/log
136 mountPath: /robot/bin
138 {{- $secrets := dict }}
139 {{- range $index, $container := .Values.images.ric.robot.job }}
140 {{- if index $container "repositoryCred" }}
141 {{- $_ := set $secrets $container.repositoryCred (dict "name" $container.repositoryCred) }}
144 {{- if keys $secrets }}
146 {{- values $secrets | toYaml |nindent 8 }}
149 - name: {{ $jobName }}-ric-robot
150 {{ with .Values.images.ric.robot.job.run -}}
151 image: {{ if .repository }}{{- .repository -}} / {{- end -}}{{- .name -}}{{- if .tag -}} : {{- .tag -}} {{- end }}
152 imagePullPolicy: {{ default "IfNotPresent" .pullPolicy }}
155 - name: RICPLT_NAMESPACE
156 value: {{ $platformNamespace }}
157 - name: RICPLT_RELEASE_NAME
158 value: {{ $releaseName }}
159 - name: RICPLT_COMPONENTS
160 value: {{ keys .Values.ric.platform.components | join " " }}
161 - name: RICXAPP_NAMESPACE
162 value: {{ $xappNamespace }}
164 value: /robot/etc/ric-robot-kubeconfig.conf
168 {{- if not .Values.ric.robot.job.failOnTestFail }}
171 {{- if .Values.ric.robot.log }}
188 {{- if .Values.ric.robot.tags.enabled }}
189 {{- range .Values.ric.robot.tags.enabled }}
194 {{- if .Values.ric.robot.tags.disabled }}
195 {{- range .Values.ric.robot.tags.disabled }}
200 {{- if .Values.ric.robot.testsuites }}
201 {{- range .Values.ric.robot.testsuites }}
202 - "/robot/testsuites/{{.}}.robot"
205 - "/robot/testsuites"
208 - name: robot-testsuites
209 mountPath: /robot/testsuites
212 mountPath: /robot/etc
214 {{- if .Values.ric.robot.log }}
216 mountPath: /robot/log
219 # for compatability with the ric robot, we mount
220 # both properties files and interface libraries
222 {{- range $map, $ignore := $.Files.Glob "configmap-src/*/properties/*.robot" }}
223 - name: robot-properties
224 mountPath: /robot/resources/{{ base $map }}
225 subPath: {{ base $map }}
228 {{- range $map, $ignore := $.Files.Glob "configmap-src/*/resources/*.robot" }}
229 - name: robot-resources
230 mountPath: /robot/resources/{{ base $map }}
231 subPath: {{ base $map }}
238 {{- if .Values.ric.robot.log }}
240 path: {{ default "/opt/ric/robot/log" .Values.ric.robot.log }}
241 type: DirectoryOrCreate
247 - name: robot-testsuites
249 name: robot-testsuites
251 - name: robot-properties
253 name: robot-properties
255 - name: robot-resources
257 name: robot-resources