COMAC-167,COMAC-169,COMAC-126 Refactor SPGWC and MME
- Split SPGWC manifest to multiple files by resource type
- Reconfigure and restart SPGWC when MME pod IP changes
- Add ability to enable node port for S1U and S11 interfaces
- Remove hard-coded configurations
- Reorganize values
Change-Id: Id890d351873922fccd51282825fd35794cfdd917
diff --git a/omec/omec-control-plane/templates/_helpers.tpl b/omec/omec-control-plane/templates/_helpers.tpl
index 91aa5b6..a6630f1 100644
--- a/omec/omec-control-plane/templates/_helpers.tpl
+++ b/omec/omec-control-plane/templates/_helpers.tpl
@@ -51,3 +51,62 @@
{{- printf "%s-0" $service -}}
{{- end -}}
{{- end -}}
+
+{{/*
+Render ServiceAccount, Role, and RoleBinding required for kubernetes-entrypoint.
+*/}}
+{{- define "omec-control-plane.service_account" -}}
+{{- $context := index . 1 -}}
+{{- $saName := index . 0 -}}
+{{- $saNamespace := $context.Release.Namespace }}
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+ labels:
+{{ tuple $saName $context | include "omec-control-plane.metadata_labels" | indent 4 }}
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: RoleBinding
+metadata:
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+ labels:
+{{ tuple $saName $context | include "omec-control-plane.metadata_labels" | indent 4 }}
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: {{ $saName }}
+subjects:
+ - kind: ServiceAccount
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: Role
+metadata:
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+ labels:
+{{ tuple $saName $context | include "omec-control-plane.metadata_labels" | indent 4 }}
+rules:
+ - apiGroups:
+ - ""
+ - extensions
+ - batch
+ - apps
+ verbs:
+ - get
+ - list
+ - patch
+ resources:
+ - statefulsets
+ - daemonsets
+ - jobs
+ - pods
+ - services
+ - endpoints
+ - configmaps
+{{- end -}}