blob: dde3e3d198bc0d121fbf585f528e29627dc62ca8 [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 Moon06f98552019-08-15 13:44:47 -060019abstract: |
20 Renders a set of standardised labels
21usage: |
22 {{ tuple "mme" . | include "mcord-services.metadata_labels" }}
23return: |
24 release: mcord-services
25 app: mme
Wei-Yu Chen0f12b9c2019-04-18 11:12:59 -070026*/}}
Hyunsun Moon06f98552019-08-15 13:44:47 -060027{{- define "mcord-services.metadata_labels" -}}
28{{- $application := index . 0 -}}
29{{- $context := index . 1 -}}
30release: {{ $context.Release.Name }}
31app: {{ $application }}
Wei-Yu Chen0f12b9c2019-04-18 11:12:59 -070032{{- end -}}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050033
34{{/*
35Render the given template.
36*/}}
37{{- define "mcord-services.template" -}}
38{{- $name := index . 0 -}}
39{{- $context := index . 1 -}}
40{{- $last := base $context.Template.Name }}
41{{- $wtf := $context.Template.Name | replace $last $name -}}
42{{ include $wtf $context }}
43{{- end -}}
Hyunsun Moon636e17d2019-07-03 12:52:15 -050044
45{{/*
46Return identity, realm, and hostname of the first pod of the given statefulset.
47*/}}
48{{- define "mcord-services.endpoint_lookup" -}}
49{{- $service := index . 0 -}}
50{{- $type := index . 1 -}}
51{{- $context := index . 2 -}}
Hyunsun Moon636e17d2019-07-03 12:52:15 -050052{{- if eq $type "identity" -}}
Hyunsun Moon06f98552019-08-15 13:44:47 -060053{{- printf "%s-0.%s.%s.svc.%s" $service $service $context.Release.Namespace "cluster.local" -}}
Hyunsun Moon636e17d2019-07-03 12:52:15 -050054{{- else if eq $type "realm" -}}
Hyunsun Moon06f98552019-08-15 13:44:47 -060055{{- printf "%s.%s.svc.%s" $service $context.Release.Namespace "cluster.local" -}}
Hyunsun Moon636e17d2019-07-03 12:52:15 -050056{{- else if eq $type "host" -}}
Hyunsun Moon06f98552019-08-15 13:44:47 -060057{{- printf "%s-0" $service -}}
Hyunsun Moon636e17d2019-07-03 12:52:15 -050058{{- end -}}
59{{- end -}}