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
131 mountPath: /robot/log
134 mountPath: /robot/bin
136 {{- $secrets := dict }}
137 {{- range $index, $container := .Values.images.ric.robot.job }}
138 {{- if index $container "repositoryCred" }}
139 {{- $_ := set $secrets $container.repositoryCred (dict "name" $container.repositoryCred) }}
142 {{- if keys $secrets }}
144 {{- values $secrets | toYaml |nindent 8 }}
147 - name: {{ $jobName }}-ric-robot
148 {{ with .Values.images.ric.robot.job.run -}}
149 image: {{ if .repository }}{{- .repository -}} / {{- end -}}{{- .name -}}{{- if .tag -}} : {{- .tag -}} {{- end }}
150 imagePullPolicy: {{ default "IfNotPresent" .pullPolicy }}
153 - name: RICPLT_NAMESPACE
154 value: {{ $platformNamespace }}
155 - name: RICPLT_RELEASE_NAME
156 value: {{ $releaseName }}
157 - name: RICPLT_COMPONENTS
158 value: {{ keys .Values.ric.platform.components | join " " }}
159 - name: RICXAPP_NAMESPACE
160 value: {{ $xappNamespace }}
162 value: /robot/etc/ric-robot-kubeconfig.conf
166 {{- if not .Values.ric.robot.job.failOnTestFail }}
175 {{- if .Values.ric.robot.tags.enabled }}
176 {{- range .Values.ric.robot.tags.enabled }}
181 {{- if .Values.ric.robot.tags.disabled }}
182 {{- range .Values.ric.robot.tags.disabled }}
187 {{- if .Values.ric.robot.testsuites }}
188 {{- range .Values.ric.robot.testsuites }}
189 - "/robot/testsuites/{{.}}.robot"
192 - "/robot/testsuites"
195 - name: robot-testsuites
196 mountPath: /robot/testsuites
199 mountPath: /robot/etc
202 mountPath: /robot/log
204 # for compatability with the ric robot, we mount
205 # both properties files and interface libraries
207 {{- range $map, $ignore := $.Files.Glob "configmap-src/*/properties/*.robot" }}
208 - name: robot-properties
209 mountPath: /robot/resources/{{ base $map }}
210 subPath: {{ base $map }}
213 {{- range $map, $ignore := $.Files.Glob "configmap-src/*/resources/*.robot" }}
214 - name: robot-resources
215 mountPath: /robot/resources/{{ base $map }}
216 subPath: {{ base $map }}
224 path: {{ default "/opt/ric/robot/log" .Values.ric.robot.log }}
225 type: DirectoryOrCreate
230 - name: robot-testsuites
232 name: robot-testsuites
234 - name: robot-properties
236 name: robot-properties
238 - name: robot-resources
240 name: robot-resources