X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ric_robot_suite%2Fhelm%2Fnanobot%2Ftemplates%2Fjob-ric-robot-run.yaml;h=700bc2a29f412bac0e1c8d7081f6b7a45ce55e31;hb=6948ee0b6b98e048e9cbea56abd76bc4dfe9ee0a;hp=b1be7c747685942956d50c91c7c3231505f35f58;hpb=c5fa07bcd8cbd614bcd813cac698385b789bcfcb;p=it%2Ftest.git diff --git a/ric_robot_suite/helm/nanobot/templates/job-ric-robot-run.yaml b/ric_robot_suite/helm/nanobot/templates/job-ric-robot-run.yaml index b1be7c7..700bc2a 100644 --- a/ric_robot_suite/helm/nanobot/templates/job-ric-robot-run.yaml +++ b/ric_robot_suite/helm/nanobot/templates/job-ric-robot-run.yaml @@ -1,21 +1,23 @@ {{/* Copyright (c) 2019 AT&T Intellectual Property. Copyright (c) 2019 Nokia. - + Copyright (c) 2020 HCL Technologies Limited. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */}} -{{- $platformNamespace := default .Release.Namespace .Values.ric.platform.namespace }} -{{- $xappNamespace := default $platformNamespace .Values.ric.xapp.namespace }} +{{- $platformNamespace := include "common.namespace.platform" . }} +{{- $e2simNamespace := default "test"}} +{{- $xappNamespace := include "common.namespace.xapp" . }} {{- $releaseName := default "ric-full" .Values.ric.platform.releaseName }} {{- $jobName := printf "%s-%s" .Release.Name $releaseName }} {{- $acctName := randAlpha 6 | lower | printf "%s-%s" $jobName }} @@ -35,7 +37,7 @@ metadata: namespace: {{ $platformNamespace }} rules: - apiGroups: [""] - resources: ["pods", "services"] + resources: ["pods", "pods/log", "pods/exec", "services"] verbs: ["get", "list"] - apiGroups: ["apps"] resources: ["daemonsets", "replicasets", "statefulsets"] @@ -72,7 +74,7 @@ metadata: namespace: {{ $xappNamespace }} rules: - apiGroups: [""] - resources: ["pods", "services"] + resources: ["pods", "pods/log", "pods/exec", "services"] verbs: ["get", "list"] - apiGroups: ["apps"] resources: ["deployments", "daemonsets", "replicasets", "statefulsets"] @@ -94,7 +96,44 @@ subjects: - kind: ServiceAccount name: {{ $serviceAccountName }} namespace: {{ .Release.Namespace }} + {{- end }} +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: Role +metadata: + name: {{ $serviceAccountName }}-{{ $releaseName }}-e2sim-access + namespace: {{ $e2simNamespace }} +rules: +- apiGroups: [""] + resources: ["pods", "pods/log", "pods/exec", "services"] + verbs: ["get", "list"] +- apiGroups: ["apps"] + resources: ["daemonsets", "replicasets", "statefulsets"] + verbs: ["get", "list"] +- apiGroups: ["extensions"] + resources: ["daemonsets", "replicasets"] + verbs: ["get", "list"] +- apiGroups: ["apps"] + resources: ["deployments"] + verbs: ["get", "list", "patch"] +- apiGroups: ["extensions"] + resources: ["deployments"] + verbs: ["get", "list", "patch"] +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: RoleBinding +metadata: + name: {{ $serviceAccountName }}-{{ $releaseName }}-e2sim-access + namespace: {{ $e2simNamespace }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: {{ $serviceAccountName }}-{{ $releaseName }}-e2sim-access +subjects: + - kind: ServiceAccount + name: {{ $serviceAccountName }} + namespace: {{ .Release.Namespace }} {{- end }} --- apiVersion: batch/v1 @@ -103,10 +142,11 @@ metadata: name: {{ $jobName }}-ric-robot-run namespace: {{ .Release.Namespace }} spec: + backoffLimit: {{ default 0 .Values.ric.robot.job.backoffLimit }} template: spec: serviceAccountName: {{ $serviceAccountName }} - restartPolicy: Never + restartPolicy: {{ default "Never" .Values.ric.robot.job.restartPolicy }} initContainers: - name: {{ $jobName }}-generate-robot-kubeconfig {{ with .Values.images.ric.robot.job.init }} @@ -127,13 +167,15 @@ spec: - name: robot-etc mountPath: /robot/etc readOnly: false + {{- if .Values.ric.robot.log }} - name: robot-log mountPath: /robot/log readOnly: false + {{- end }} - name: robot-bin mountPath: /robot/bin readOnly: true - {{- $secrets := dict }} + {{- $secrets := dict }} {{- range $index, $container := .Values.images.ric.robot.job }} {{- if index $container "repositoryCred" }} {{- $_ := set $secrets $container.repositoryCred (dict "name" $container.repositoryCred) }} @@ -150,6 +192,10 @@ spec: imagePullPolicy: {{ default "IfNotPresent" .pullPolicy }} {{- end }} env: + - name: DBAAS_SERVICE_HOST + value: "service-ricplt-dbaas-tcp.ricplt.svc.cluster.local" + - name: DBAAS_SERVICE_PORT + value: "6379" - name: RICPLT_NAMESPACE value: {{ $platformNamespace }} - name: RICPLT_RELEASE_NAME @@ -158,6 +204,8 @@ spec: value: {{ keys .Values.ric.platform.components | join " " }} - name: RICXAPP_NAMESPACE value: {{ $xappNamespace }} + - name: E2SIM_NAMESPACE + value: {{ $e2simNamespace }} - name: KUBECONFIG value: /robot/etc/ric-robot-kubeconfig.conf command: ["robot"] @@ -166,18 +214,35 @@ spec: {{- if not .Values.ric.robot.job.failOnTestFail }} - "--NoStatusRC" {{- end }} + {{- if .Values.ric.robot.log }} - "-d" - "/robot/log" + {{- else }} + - "-o" + - "NONE" + - "-l" + - "NONE" + - "-r" + - "NONE" + - "-L" + - "NONE" + {{- end }} - "--console" - "verbose" - "-C" - "off" - {{- if .Values.ric.robot.tags }} - {{- range .Values.ric.robot.tags }} + {{- if .Values.ric.robot.tags.enabled }} + {{- range .Values.ric.robot.tags.enabled }} - "-i" - "{{.}}" {{- end }} {{- end }} + {{- if .Values.ric.robot.tags.disabled }} + {{- range .Values.ric.robot.tags.disabled }} + - "-e" + - "{{.}}" + {{- end }} + {{- end }} {{- if .Values.ric.robot.testsuites }} {{- range .Values.ric.robot.testsuites }} - "/robot/testsuites/{{.}}.robot" @@ -192,20 +257,35 @@ spec: - name: robot-etc mountPath: /robot/etc readOnly: true + {{- if .Values.ric.robot.log }} - name: robot-log mountPath: /robot/log readOnly: false + {{- end }} + # for compatability with the ric robot, we mount + # both properties files and interface libraries + # under resources/. +{{- range $map, $ignore := $.Files.Glob "configmap-src/*/properties/*.robot" }} - name: robot-properties - mountPath: /robot/resources/global_properties.robot - subPath: global_properties.robot + mountPath: /robot/resources/{{ base $map }} + subPath: {{ base $map }} readOnly: true +{{- end }} +{{- range $map, $ignore := $.Files.Glob "configmap-src/*/resources/*" }} + - name: robot-resources + mountPath: /robot/resources/{{ base $map }} + subPath: {{ base $map }} + readOnly: true +{{- end }} volumes: - name: robot-etc emptyDir: {} - name: robot-log + {{- if .Values.ric.robot.log }} hostPath: path: {{ default "/opt/ric/robot/log" .Values.ric.robot.log }} type: DirectoryOrCreate + {{- end }} - name: robot-bin configMap: name: robot-bin @@ -218,3 +298,8 @@ spec: configMap: name: robot-properties defaultMode: 0644 + - name: robot-resources + configMap: + name: robot-resources + defaultMode: 0644 +