VOL-3137 - release name best practice update
Change-Id: Iefce588d7b7383905e2d2fb43f1d1e7d6a7ce6ec
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.yaml b/freeradius/templates/freeradius-deploy.yaml
similarity index 83%
rename from freeradius/templates/freeradius.yaml
rename to freeradius/templates/freeradius-deploy.yaml
index a491f9e..5b98894 100644
--- a/freeradius/templates/freeradius.yaml
+++ b/freeradius/templates/freeradius-deploy.yaml
@@ -12,42 +12,24 @@
# 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
kind: Deployment
metadata:
- name: radius
+ name: "{{ template "fullname" . }}"
+ namespace: "{{ .Release.Namespace }}"
serviceAccountName: {{ tpl .Values.serviceaccount . }}
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..6df87e7
--- /dev/null
+++ b/freeradius/templates/freeradius-svc.yaml
@@ -0,0 +1,37 @@
+---
+# 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 }}"
+ 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
+ release: "{{ .Release.Name }}"