blob: 4719e95020dcc8b47d13bb0bcedee6a65e902eb2 [file] [log] [blame]
Andy Bavier7a080492018-08-30 14:26:09 -07001{{- /*
2 Copyright 2017-present Open Networking Foundation
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */ -}}
16
17{{/* vim: set filetype=mustache: */}}
18{{/*
19Expand the name of the chart.
20*/}}
21{{- define "mininet.name" -}}
22{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
23{{- end -}}
24
25{{/*
26Create a default fully qualified app name.
27We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
28If release name contains chart name it will be used as a full name.
29*/}}
30{{- define "mininet.fullname" -}}
31{{- if .Values.fullnameOverride -}}
32{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
33{{- else -}}
34{{- $name := default .Chart.Name .Values.nameOverride -}}
35{{- if contains $name .Release.Name -}}
36{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
37{{- else -}}
38{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
39{{- end -}}
40{{- end -}}
41{{- end -}}
42
43{{/*
44Create chart name and version as used by the chart label.
45*/}}
46{{- define "mininet.chart" -}}
47{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
48{{- end -}}
Andy Baviere21a5f52019-05-28 15:39:52 -070049
50{{/*
51Generate the CNI annotations depending on number of OLTs
52*/}}
53{{- define "mininet.cni" -}}
54{{- printf "calico" -}}
55{{- range $i, $junk := until (.Values.numOlts|int) -}}
56{{- printf ",nni%d" $i -}}
57{{- end -}}
58{{- end -}}
59
60{{/*
61Generate the DHCP subnets depending on number of OLTs
62*/}}
63{{- define "mininet.dhcp_range" -}}
Sreeju7d7fc072019-06-13 12:03:00 -060064{{- $onucount := .Values.numOnus|int}}
Andy Baviere21a5f52019-05-28 15:39:52 -070065{{- range $i, $junk := until (.Values.numOlts|int) -}}
Sreeju7d7fc072019-06-13 12:03:00 -060066{{- range $j, $junk1 := until ($onucount) -}}
67{{- printf " --dhcp-range=172.%d.%d.50,172.%d.%d.150,12h" (add $i 18) $j (add $i 18) $j -}}
Andy Baviere21a5f52019-05-28 15:39:52 -070068{{- end -}}
Sreeju7d7fc072019-06-13 12:03:00 -060069{{- end -}}
70{{- end -}}