Fix helm hooks doesn't work in oaisim with Helm 2.15

Also use helper for reducing duplicate code lines for service account
and resource labels.

Change-Id: I2987d1f5fc9ac961da9adf858b36fb9828154210
diff --git a/oaisim/templates/statefulset-enb.yaml b/oaisim/templates/statefulset-enb.yaml
index 173b868..b96a809 100644
--- a/oaisim/templates/statefulset-enb.yaml
+++ b/oaisim/templates/statefulset-enb.yaml
@@ -14,73 +14,29 @@
 limitations under the License.
 */}}
 
-{{- $releaseName := .Release.Name }}
-{{- $namespace := .Release.Namespace }}
-{{- $name := .Values.config.enb.name }}
----
-apiVersion: v1
-kind: ServiceAccount
-metadata:
-  name: {{ $releaseName }}-{{ $name }}
-  namespace: {{ $namespace }}
----
-kind: Role
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
-  name: {{ $releaseName }}-{{ $name }}
-  namespace: {{ $namespace }}
-rules:
-  - apiGroups:
-      - ""
-      - extensions
-      - batch
-      - apps
-    verbs:
-      - get
-      - list
-    resources:
-      - daemonsets
-      - jobs
-      - pods
-      - services
-      - endpoints
----
-kind: RoleBinding
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
-  name: {{ $releaseName }}-{{ $name }}
-  namespace: {{ $namespace }}
-roleRef:
-  apiGroup: rbac.authorization.k8s.io
-  kind: Role
-  name: {{ $releaseName }}-{{ $name }}
-subjects:
-  - kind: ServiceAccount
-    name: {{ $releaseName }}-{{ $name }}
+{{ tuple "enb" . | include "oaisim.service_account" }}
 ---
 apiVersion: apps/v1
 kind: StatefulSet
 metadata:
-  name: {{ $name }}
-  namespace: {{ $namespace }}
+  name: enb
   labels:
-    app: oai-enb
+{{ tuple "enb" . | include "oaisim.metadata_labels" | indent 4 }}
 spec:
   replicas: 1
   selector:
     matchLabels:
-      app: oai-enb
-  serviceName: {{ $name | quote }}
+{{ tuple "enb" . | include "oaisim.metadata_labels" | indent 6 }}
   template:
     metadata:
       labels:
-        app: oai-enb
+{{ tuple "enb" . | include "oaisim.metadata_labels" | indent 8 }}
     spec:
     {{- if .Values.nodeSelectors.enabled }}
       nodeSelector:
         {{ .Values.nodeSelectors.enb.label }}: {{ .Values.nodeSelectors.enb.value }}
     {{- end }}
-      serviceAccountName: {{ $releaseName }}-{{ $name }}
+      serviceAccountName: enb
       hostNetwork: true
       initContainers:
         - name: enb-dep-check
@@ -134,7 +90,7 @@
             - name: pod-share
               mountPath: /etc/oaisim/enb
       containers:
-        - name: {{ $name }}
+        - name: enb
           image: {{ .Values.images.tags.enb | quote }}
           imagePullPolicy: {{ .Values.images.pullPolicy }}
           securityContext:
@@ -162,11 +118,11 @@
       volumes:
         - name: config
           configMap:
-            name: {{ $name }}
+            name: enb
             defaultMode: 420
         - name: script
           configMap:
-            name: {{ $name }}
+            name: enb
             defaultMode: 493
         - name: pod-share
           emptyDir: {}