Add capability for O1 mediator to list pods in xapp ns 77/2577/3
authorwrider <lji@research.att.com>
Tue, 25 Feb 2020 17:49:20 +0000 (12:49 -0500)
committerLusheng Ji <lji@research.att.com>
Thu, 27 Feb 2020 20:30:13 +0000 (20:30 +0000)
Based on the new understanding that O1 mediator needs to be able to list pods
in xapp namespace, add serviceaccount to support this.

Issue-ID: RIC-186
Change-Id: I84bea552917bdb3f3b95194cdbfecd8cb6422240
Signed-off-by: wrider <lji@research.att.com>
helm/o1mediator/templates/deployment.yaml
helm/o1mediator/templates/env.yaml
helm/o1mediator/templates/serviceaccount.yaml [new file with mode: 0644]
helm/o1mediator/values.yaml

index 3e38828..5aa02c6 100644 (file)
@@ -47,6 +47,7 @@ spec:
       hostname: {{ include "common.name.o1mediator" . }}
       imagePullSecrets:
         - name: {{ include "common.dockerregistry.credential" $imagectx }}
+      serviceAccountName: {{ include "common.serviceaccountname.o1mediator" . }}
       containers:
         - name: {{ include "common.containername.o1mediator" . }}
           image: {{ include "common.dockerregistry.url" $imagectx }}/{{ .Values.o1mediator.image.name }}:{{ .Values.o1mediator.image.tag }}
index 70f3065..5ae05b2 100644 (file)
@@ -21,5 +21,3 @@ metadata:
 data:
   DBAAS_SERVICE_HOST: {{ include "common.servicename.dbaas.tcp" . | quote }}
   DBAAS_SERVICE_PORT: {{ include "common.serviceport.dbaas.tcp" . | quote }}
-  DBAAS_PORT_6379_TCP_ADDR: {{ include "common.servicename.dbaas.tcp" . | quote }}
-  DBAAS_PORT_6379_TCP_PORT: {{ include "common.serviceport.dbaas.tcp" . | quote }}
diff --git a/helm/o1mediator/templates/serviceaccount.yaml b/helm/o1mediator/templates/serviceaccount.yaml
new file mode 100644 (file)
index 0000000..7527e46
--- /dev/null
@@ -0,0 +1,46 @@
+################################################################################
+#   Copyright (c) 2019-2020 AT&T Intellectual Property.                        #
+#                                                                              #
+#   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.                                             #
+################################################################################
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+  name: {{ include "common.serviceaccountname.o1mediator" . }}
+  namespace: {{ include "common.namespace.platform" . }}
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
+metadata:
+  name: {{ include "common.serviceaccountname.o1mediator" . }}-{{ include "common.namespace.xapp" . }}-podreader
+  namespace: {{ include "common.namespace.xapp" . }}
+rules:
+- apiGroups: [""]
+  resources: ["pods"]
+  verbs: ["get", "list", "watch"]
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+  name: {{ include "common.serviceaccountname.o1mediator" . }}-{{ include "common.namespace.xapp" . }}-podreader
+  namespace: {{ include "common.namespace.xapp" . }}
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: Role
+  name: {{ include "common.serviceaccountname.o1mediator" . }}-{{ include "common.namespace.xapp" . }}-podreader
+subjects:
+  - kind: ServiceAccount
+    name: {{ include "common.serviceaccountname.o1mediator" . }}
+    namespace: {{ include "common.namespace.platform" . }}
+
index 94b7b59..55d51ab 100644 (file)
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
-
-#################################################################
-# Application configuration defaults.
-#################################################################
-# application image
-
 o1mediator:
   replicaCount: 1
   imagePullPolicy: IfNotPresent