Near RT RIC Platform new-installer initial release
[ric-plt/ric-dep.git] / new-installer / helm / charts / nearrtric / appmgr / templates / serviceaccount.yaml
1 ################################################################################
2 #   Copyright (c) 2019-2020 AT&T Intellectual Property.                        #
3 #                                                                              #
4 #   Licensed under the Apache License, Version 2.0 (the "License");            #
5 #   you may not use this file except in compliance with the License.           #
6 #   You may obtain a copy of the License at                                    #
7 #                                                                              #
8 #       http://www.apache.org/licenses/LICENSE-2.0                             #
9 #                                                                              #
10 #   Unless required by applicable law or agreed to in writing, software        #
11 #   distributed under the License is distributed on an "AS IS" BASIS,          #
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
13 #   See the License for the specific language governing permissions and        #
14 #   limitations under the License.                                             #
15 ################################################################################
16
17 {{- $tillerKey := .Values.appmgr.tillerkey | default "ricxapp" }}
18 {{- $topCtx :=  . }}
19 {{- $ctx := dict "ctx" $topCtx "key" $tillerKey }}
20 {{- $certName := include "common.tillerHelmClientTLSSecret" $ctx }}
21 ---
22 apiVersion: v1
23 kind: ServiceAccount
24 metadata:
25   name: {{ include "common.serviceaccountname.appmgr" . }}
26   namespace: {{ include "common.namespace.platform" . }}
27 ---
28 apiVersion: rbac.authorization.k8s.io/v1
29 kind: ClusterRole
30 metadata:
31   name: {{ include "common.serviceaccountname.appmgr" . }}-{{ include "common.tillerNameSpace" $ctx }}-access
32 rules:
33 - apiGroups: [""]
34   resources: ["pods/portforward"]
35   verbs: ["create"]
36 - apiGroups: [""]
37   resources: ["pods", "configmaps", "deployments", "services"]
38   verbs: ["get", "list", "create", "delete"]
39 {{- if or (eq (include "common.tillerTLSVerify" $ctx) "true" )  (eq (include "common.tillerTLSAuthenticate" $ctx) "true") }}
40 - apiGroups: [""]
41   resources: ["secrets"]
42   #resourceNames: [ {{ include "common.tillerHelmClientTLSSecret" $ctx | quote }} ]
43   verbs: ["get","list"]
44 {{- end }}
45 ---
46 apiVersion: rbac.authorization.k8s.io/v1
47 kind: ClusterRoleBinding
48 metadata:
49   name: {{ include "common.serviceaccountname.appmgr" . }}-{{ include "common.tillerNameSpace" $ctx }}-access
50   namespace: {{ include "common.namespace.platform" . }}
51 roleRef:
52   apiGroup: rbac.authorization.k8s.io
53   kind: ClusterRole
54   name: {{ include "common.serviceaccountname.appmgr" . }}-{{ include "common.tillerNameSpace" $ctx }}-access
55 subjects:
56   - kind: ServiceAccount
57     name: {{ include "common.serviceaccountname.appmgr" . }}
58     namespace: {{ include "common.namespace.platform" . }}
59 ---
60 apiVersion: rbac.authorization.k8s.io/v1
61 kind: ClusterRole
62 metadata:
63   name: {{ include "common.serviceaccountname.appmgr" . }}-{{ include "common.tillerNameSpace" $ctx }}-getappconfig
64   #namespace: {{ include "common.tillerNameSpace" $ctx }}
65   #namespace: {{ include "common.namespace.platform" . }}
66 rules:
67 - apiGroups: [""]
68   resources: ["configmaps", "endpoints", "services"]
69   verbs: ["get", "list", "create", "update", "delete"]
70 ---
71 apiVersion: rbac.authorization.k8s.io/v1
72 kind: ClusterRoleBinding
73 metadata:
74   name: {{ include "common.serviceaccountname.appmgr" . }}-{{ include "common.namespace.xapp" . }}-getappconfig
75   namespace: {{ include "common.tillerNameSpace" $ctx }}
76   #namespace: {{ include "common.namespace.platform" . }}
77 roleRef:
78   apiGroup: rbac.authorization.k8s.io
79   kind: ClusterRole
80   name: {{ include "common.serviceaccountname.appmgr" . }}-{{ include "common.tillerNameSpace" $ctx }}-getappconfig
81 subjects:
82   - kind: ServiceAccount
83     name: {{ include "common.serviceaccountname.appmgr" . }}
84     namespace: {{ include "common.namespace.platform" . }}