This commit allows us to add DANM network definitions in the recipe.
Corresponding RIC component helm charts that support DANM networks will
automatically pick up the network configuration.
Signed-off-by: Zhe Huang <zhehuang@research.att.com>
Change-Id: I0a8ab930e0790afe8226683cd932d3bf90a0ccf5
release: {{ $topCtx.Release.Name }}
template:
metadata:
- {{- if .annotations }}
+ {{- if $.Values.global }}
+ {{- if $.Values.global.danm_networks }}
+ {{- $networklist := list }}
+ {{- range $network := $.Values.global.danm_networks }}
+ {{- if $network.tenants }}
+ {{- if $network.tenants.e2term }}
+ {{- if (hasKey $network.tenants.e2term $key) }}
+ {{- $networklist = append $networklist $network }}
+ {{- end }}
+ {{- end }}
+ {{- end }}
+ {{- end }}
+ {{- if $networklist }}
annotations:
- {{- .annotations | nindent 8 -}}
- {{ end }}
+ danm.k8s.io/interfaces: |
+ [
+ {{- range $network := $networklist }}
+ {{- printf "\n {\"clusterNetwork\": \"%s\"" $network.name }}
+ {{- with index $network.tenants.e2term $key }}
+ {{- if .ip }}
+ {{- printf ", \"ip\": \"%s\"" .ip }}
+ {{- else }}
+ {{- printf ", \"ip\": \"dynamic\"" }}
+ {{- end }}
+ {{- if .ip6 }}
+ {{- printf ", \"ip6\": \"%s\"" .ip6 }}
+ {{- end }}
+ {{- if .proutes }}
+ {{- printf ", \"proutes\": {" }}
+ {{- range $subnet, $gw := .proutes }}
+ {{- if eq $subnet ( first ( keys .proutes ))}}
+ {{- printf "\"%s\": \"%s\"" $subnet $gw }}
+ {{- else }}
+ {{- printf ", \"%s\": \"%s\"" $subnet $gw }}
+ {{- end }}
+ {{- end }}
+ {{- printf "}" }}
+ {{- end }}
+ {{- end }}
+ {{- if ne $network.name (last $networklist).name }}
+ {{- printf "}," }}
+ {{- else }}
+ {{- printf "}" }}
+ {{- end }}
+ {{- end }}
+ ]
+ {{- end }}
+ {{- end }}
+ {{- end }}
labels:
app: {{ include "common.namespace.platform" $topCtx }}-{{ include "common.name.e2term" $topCtx }}
release: {{ $topCtx.Release.Name }}
version: 0.1.0
repository: "file://./subcharts/certificate-manager"
condition: certificate-manager.enabled
+ - name: danm-networks
+ version: 1.0.0
+ repository: "file://./subcharts/danm-networks"
+ condition: danm-networks.enabled
--- /dev/null
+################################################################################
+# Copyright (c) 2019 AT&T Intellectual Property. #
+# Copyright (c) 2019 Nokia. #
+# #
+# 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
+appVersion: "1.0"
+description: A Helm chart for setting up danm networks
+name: danm-networks
+version: 1.0.0
+
--- /dev/null
+# Copyright (c) 2019 AT&T Intellectual Property. #
+# #
+# 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. #
+################################################################################
+{{- if $.Values.global }}
+{{- if $.Values.global.danm_networks }}
+{{- range keys $.Values.global.danm_networks }}
+{{- with index $.Values.global.danm_networks . }}
+{{- if ne .name "default" }}
+---
+apiVersion: danm.k8s.io/v1
+kind: ClusterNetwork
+metadata:
+ name: {{.name}}
+spec:
+ NetworkID: {{.network_id}}
+ NetworkType: {{.network_type}}
+ Options:
+ cidr: {{.cidr}}
+ allocation_pool:
+ start: {{.allocation_pool.start}}
+ end: {{.allocation_pool.end}}
+{{- if .routes }}
+ routes:
+{{- range $subnet, $route := .routes }}
+ {{ $subnet | quote }}: {{ $route | quote }}
+{{- end }}
+{{- end }}
+{{- if .net6 }}
+ net6: {{ .net6 }}
+{{- end }}
+{{- if .routes }}
+ routes6:
+{{- range $subnet, $route := .routes6 }}
+ {{ $subnet | quote }}: {{ $route | quote }}
+{{- end }}
+{{- end }}
+ host_device: {{ .host_device }}
+ rt_tables: {{ .rt_tables }}
+ vlan: {{ .vlan }}
+{{- end }}
+{{- end }}
+{{- end }}
+{{- end }}
+{{- end }}
--- /dev/null
+# Copyright (c) 2019 AT&T Intellectual Property. #
+# #
+# 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. #
+################################################################################
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
+ {{- if $.Values.global }}
+ {{- if $.Values.global.danm_networks }}
+ {{- $networklist := list }}
+ {{- range $network := $.Values.global.danm_networks }}
+ {{- if $network.tenants }}
+ {{- if $network.tenants.kong }}
+ {{- $networklist = append $networklist $network }}
+ {{- end }}
+ {{- end }}
+ {{- end }}
+ {{- if $networklist }}
+ danm.k8s.io/interfaces: |
+ [
+ {{- range $network := $networklist }}
+ {{- printf "\n {\"clusterNetwork\": \"%s\"" $network.name }}
+ {{- if $network.tenants.kong.ip }}
+ {{- printf ", \"ip\": \"%s\"" $network.tenants.kong.ip }}
+ {{- else }}
+ {{- printf ", \"ip\": \"dynamic\"" }}
+ {{- end }}
+ {{- if $network.tenants.kong.ip6 }}
+ {{- printf ", \"ip6\": \"%s\"" $network.tenants.kong.ip6 }}
+ {{- end }}
+ {{- if $network.tenants.kong.proutes }}
+ {{- printf ", \"proutes\": {" }}
+ {{- range $subnet, $gw := $network.tenants.kong.proutes }}
+ {{- if eq $subnet ( first ( keys $network.tenants.kong.proutes ))}}
+ {{- printf "\"%s\": \"%s\"" $subnet $gw }}
+ {{- else }}
+ {{- printf ", \"%s\": \"%s\"" $subnet $gw }}
+ {{- end }}
+ {{- end }}
+ {{- printf "}" }}
+ {{- end }}
+ {{- if ne $network.name (last $networklist).name }}
+ {{- printf "}," }}
+ {{- else }}
+ {{- printf "}" }}
+ {{- end }}
+ {{- end }}
+ ]
+ {{- end }}
+ {{- end }}
+ {{- end }}
labels:
{{- include "kong.metaLabels" . | nindent 8 }}
app.kubernetes.io/component: app
certificate-manager:
enabled: true
-
+
+
+danm-network:
+ enabled: true
+
kong:
enabled: true