VOL-3137 - release name best practice update

Change-Id: Iefce588d7b7383905e2d2fb43f1d1e7d6a7ce6ec
diff --git a/freeradius/Chart.yaml b/freeradius/Chart.yaml
index 84a7ce8..c7746c5 100644
--- a/freeradius/Chart.yaml
+++ b/freeradius/Chart.yaml
@@ -11,10 +11,19 @@
 # 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.
-
-name: freeradius
-description: A Helm chart to deploy an example RADIUS server
-icon: https://guide.opencord.org/logos/cord.svg
-
-version: 1.0.0
-appVersion: 2.2.9
+---
+apiVersion: "v1"
+name: "freeradius"
+version: "1.0.1"
+description: "A Helm chart to deploy an example RADIUS server"
+keywords:
+  - "onf"
+  - "radius"
+  - "voltha"
+home: "https://www.opennetworking.org/voltha"
+icon: "https://guide.opencord.org/logos/voltha.svg"
+maintainers:
+  - name: "Open Networking Foundation"
+    email: "info@opennetworking.org"
+    url: "https://www.opennetworking.org"
+appVersion: "2.2.9"
diff --git a/freeradius/templates/_helpers.tpl b/freeradius/templates/_helpers.tpl
new file mode 100644
index 0000000..bf89b45
--- /dev/null
+++ b/freeradius/templates/_helpers.tpl
@@ -0,0 +1,23 @@
+# Copyright 2020-present Open Networking Foundation
+#
+# 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.
+{{/* Expand the name of the chart. */}}
+{{- define "name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{/* Create a default fully qualified app name. We truncate at 63 chars because . . . */}}
+{{- define "fullname" -}}
+{{- $name := default .Chart.Name .Values.nameOverride -}}
+{{- $fullname := default (printf "%s-%s" .Release.Name $name) .Values.fullNameOverride -}}
+{{- $fullname | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
diff --git a/freeradius/templates/freeradius-config.yaml b/freeradius/templates/freeradius-config.yaml
index 64d6d26..273a484 100644
--- a/freeradius/templates/freeradius-config.yaml
+++ b/freeradius/templates/freeradius-config.yaml
@@ -24,4 +24,3 @@
 kind: ConfigMap
 metadata:
   name: freeradius-config
-  serviceAccountName: {{ tpl .Values.serviceaccount . }}
diff --git a/freeradius/templates/freeradius.yaml b/freeradius/templates/freeradius-deploy.yaml
similarity index 79%
rename from freeradius/templates/freeradius.yaml
rename to freeradius/templates/freeradius-deploy.yaml
index a491f9e..5b0d07e 100644
--- a/freeradius/templates/freeradius.yaml
+++ b/freeradius/templates/freeradius-deploy.yaml
@@ -12,42 +12,23 @@
 # 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: Service
-metadata:
-  name: radius
-  serviceAccountName: {{ tpl .Values.serviceaccount . | quote }}
-spec:
-  ports:
-    - name: radius-auth
-      protocol: UDP
-      port: 1812
-      targetPort: 1812
-    - name: radius-acc
-      protocol: UDP
-      port: 1813
-      targetPort: 1813
-    - name: radius
-      port: 18120
-      targetPort: 18120
-  selector:
-    app: radius
-
 ---
-apiVersion: apps/v1beta1
+apiVersion: apps/v1
 kind: Deployment
 metadata:
-  name: radius
-  serviceAccountName: {{ tpl .Values.serviceaccount . }}
+  name: "{{ template "fullname" . }}"
+  namespace: "{{ .Release.Namespace }}"
 spec:
   replicas: 1
+  selector:
+    matchLabels:
+      app: radius
+      release: "{{ .Release.Name }}"
   template:
     metadata:
       labels:
         app: radius
-      annotations:
-        cni: "calico"
+        release: "{{ .Release.Name }}"
     spec:
       serviceAccountName: {{ tpl .Values.serviceaccount . }}
       containers:
diff --git a/freeradius/templates/freeradius-svc.yaml b/freeradius/templates/freeradius-svc.yaml
new file mode 100644
index 0000000..486cbf8
--- /dev/null
+++ b/freeradius/templates/freeradius-svc.yaml
@@ -0,0 +1,36 @@
+---
+# Copyright 2017-present Open Networking Foundation
+#
+# 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: Service
+metadata:
+  name: "{{ template "fullname" . }}"
+  namespace: "{{ .Release.Namespace }}"
+spec:
+  ports:
+    - name: radius-auth
+      protocol: UDP
+      port: 1812
+      targetPort: 1812
+    - name: radius-acc
+      protocol: UDP
+      port: 1813
+      targetPort: 1813
+    - name: radius
+      port: 18120
+      targetPort: 18120
+  selector:
+    app: radius
+    release: "{{ .Release.Name }}"
diff --git a/freeradius/values.yaml b/freeradius/values.yaml
index c8f5021..4707318 100644
--- a/freeradius/values.yaml
+++ b/freeradius/values.yaml
@@ -1,4 +1,3 @@
----
 # Copyright 2019-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,15 +11,18 @@
 # 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.
+---
+nameOverride: ~
+fullNameOverride: ~
 
-serviceaccount: ''
+serviceaccount: ""
 
 defaults:
   image_pullPolicy: "Always"
 
 images:
   radius:
-    registry: ''
-    repository: 'tpdock/freeradius'
-    tag: '{{ .Chart.AppVersion }}'
-    pullPolicy: '{{ .Values.defaults.image_pullPolicy }}'
+    registry: ""
+    repository: "tpdock/freeradius"
+    tag: "{{ .Chart.AppVersion }}"
+    pullPolicy: "{{ .Values.defaults.image_pullPolicy }}"