blob: 91aa5b66f04423799f181e0bf03e68ac01b8b28e [file] [log] [blame]
Wei-Yu Chen0f12b9c2019-04-18 11:12:59 -07001{{- /*
2# Copyright 2018-present Open Networking Foundation
3# Copyright 2018 Intel Corporation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16*/ -}}
17
Wei-Yu Chen0f12b9c2019-04-18 11:12:59 -070018{{/*
Hyunsun Moon7a007bb2019-08-19 16:41:36 -060019Renders a set of standardised labels
Wei-Yu Chen0f12b9c2019-04-18 11:12:59 -070020*/}}
Hyunsun Moon7a007bb2019-08-19 16:41:36 -060021{{- define "omec-control-plane.metadata_labels" -}}
Hyunsun Moon06f98552019-08-15 13:44:47 -060022{{- $application := index . 0 -}}
23{{- $context := index . 1 -}}
24release: {{ $context.Release.Name }}
25app: {{ $application }}
Wei-Yu Chen0f12b9c2019-04-18 11:12:59 -070026{{- end -}}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050027
28{{/*
29Render the given template.
30*/}}
Hyunsun Moon7a007bb2019-08-19 16:41:36 -060031{{- define "omec-control-plane.template" -}}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050032{{- $name := index . 0 -}}
33{{- $context := index . 1 -}}
34{{- $last := base $context.Template.Name }}
35{{- $wtf := $context.Template.Name | replace $last $name -}}
36{{ include $wtf $context }}
37{{- end -}}
Hyunsun Moon636e17d2019-07-03 12:52:15 -050038
39{{/*
40Return identity, realm, and hostname of the first pod of the given statefulset.
41*/}}
Hyunsun Moon7a007bb2019-08-19 16:41:36 -060042{{- define "omec-control-plane.endpoint_lookup" -}}
Hyunsun Moon636e17d2019-07-03 12:52:15 -050043{{- $service := index . 0 -}}
44{{- $type := index . 1 -}}
45{{- $context := index . 2 -}}
Hyunsun Moon636e17d2019-07-03 12:52:15 -050046{{- if eq $type "identity" -}}
Hyunsun Moon06f98552019-08-15 13:44:47 -060047{{- printf "%s-0.%s.%s.svc.%s" $service $service $context.Release.Namespace "cluster.local" -}}
Hyunsun Moon636e17d2019-07-03 12:52:15 -050048{{- else if eq $type "realm" -}}
Hyunsun Moon06f98552019-08-15 13:44:47 -060049{{- printf "%s.%s.svc.%s" $service $context.Release.Namespace "cluster.local" -}}
Hyunsun Moon636e17d2019-07-03 12:52:15 -050050{{- else if eq $type "host" -}}
Hyunsun Moon06f98552019-08-15 13:44:47 -060051{{- printf "%s-0" $service -}}
Hyunsun Moon636e17d2019-07-03 12:52:15 -050052{{- end -}}
53{{- end -}}