Wei-Yu Chen | 0f12b9c | 2019-04-18 11:12:59 -0700 | [diff] [blame] | 1 | {{- /* |
| 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 Chen | 0f12b9c | 2019-04-18 11:12:59 -0700 | [diff] [blame] | 18 | {{/* |
Hyunsun Moon | 7a007bb | 2019-08-19 16:41:36 -0600 | [diff] [blame] | 19 | Renders a set of standardised labels |
Wei-Yu Chen | 0f12b9c | 2019-04-18 11:12:59 -0700 | [diff] [blame] | 20 | */}} |
Hyunsun Moon | 7a007bb | 2019-08-19 16:41:36 -0600 | [diff] [blame] | 21 | {{- define "omec-control-plane.metadata_labels" -}} |
Hyunsun Moon | 06f9855 | 2019-08-15 13:44:47 -0600 | [diff] [blame] | 22 | {{- $application := index . 0 -}} |
| 23 | {{- $context := index . 1 -}} |
| 24 | release: {{ $context.Release.Name }} |
| 25 | app: {{ $application }} |
Wei-Yu Chen | 0f12b9c | 2019-04-18 11:12:59 -0700 | [diff] [blame] | 26 | {{- end -}} |
Hyunsun Moon | a24d3f9 | 2019-06-19 03:04:58 -0500 | [diff] [blame] | 27 | |
| 28 | {{/* |
| 29 | Render the given template. |
| 30 | */}} |
Hyunsun Moon | 7a007bb | 2019-08-19 16:41:36 -0600 | [diff] [blame] | 31 | {{- define "omec-control-plane.template" -}} |
Hyunsun Moon | a24d3f9 | 2019-06-19 03:04:58 -0500 | [diff] [blame] | 32 | {{- $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 Moon | 636e17d | 2019-07-03 12:52:15 -0500 | [diff] [blame] | 38 | |
| 39 | {{/* |
| 40 | Return identity, realm, and hostname of the first pod of the given statefulset. |
| 41 | */}} |
Hyunsun Moon | 7a007bb | 2019-08-19 16:41:36 -0600 | [diff] [blame] | 42 | {{- define "omec-control-plane.endpoint_lookup" -}} |
Hyunsun Moon | 636e17d | 2019-07-03 12:52:15 -0500 | [diff] [blame] | 43 | {{- $service := index . 0 -}} |
| 44 | {{- $type := index . 1 -}} |
| 45 | {{- $context := index . 2 -}} |
Hyunsun Moon | 636e17d | 2019-07-03 12:52:15 -0500 | [diff] [blame] | 46 | {{- if eq $type "identity" -}} |
Hyunsun Moon | 06f9855 | 2019-08-15 13:44:47 -0600 | [diff] [blame] | 47 | {{- printf "%s-0.%s.%s.svc.%s" $service $service $context.Release.Namespace "cluster.local" -}} |
Hyunsun Moon | 636e17d | 2019-07-03 12:52:15 -0500 | [diff] [blame] | 48 | {{- else if eq $type "realm" -}} |
Hyunsun Moon | 06f9855 | 2019-08-15 13:44:47 -0600 | [diff] [blame] | 49 | {{- printf "%s.%s.svc.%s" $service $context.Release.Namespace "cluster.local" -}} |
Hyunsun Moon | 636e17d | 2019-07-03 12:52:15 -0500 | [diff] [blame] | 50 | {{- else if eq $type "host" -}} |
Hyunsun Moon | 06f9855 | 2019-08-15 13:44:47 -0600 | [diff] [blame] | 51 | {{- printf "%s-0" $service -}} |
Hyunsun Moon | 636e17d | 2019-07-03 12:52:15 -0500 | [diff] [blame] | 52 | {{- end -}} |
| 53 | {{- end -}} |