X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=deploy%2Fcluster%2Ftemplates%2Fmetal3datatemplate.yaml;h=70301de97b215818a419151def0dc3ef018f4f6f;hb=adbd076f40c348b04e52321c3c5cdaa528915f1a;hp=b675ac823c6c90d29a9a35adbb9ace0f3badfb28;hpb=411e3f845233995696a700afc5702e3c6be1bc36;p=icn.git diff --git a/deploy/cluster/templates/metal3datatemplate.yaml b/deploy/cluster/templates/metal3datatemplate.yaml index b675ac8..70301de 100644 --- a/deploy/cluster/templates/metal3datatemplate.yaml +++ b/deploy/cluster/templates/metal3datatemplate.yaml @@ -1,4 +1,3 @@ -{{- if .Values.networks }} --- apiVersion: infrastructure.cluster.x-k8s.io/v1alpha5 kind: Metal3DataTemplate @@ -6,19 +5,97 @@ metadata: name: {{ .Values.clusterName }}-nodepool spec: clusterName: {{ .Values.clusterName }} + metaData: +{{- if .Values.networkData }} + ipAddressesFromIPPool: +{{- range $name, $network := .Values.networkData.networks.ipv4 }} +{{- $link := $network.link | default $name }} +{{- if eq $link "baremetal" }} + - key: node_ip_{{ $name }} + name: {{ $.Values.clusterName }}-{{ $network.fromIPPool }} +{{- end }} +{{- end }} +{{- range $name, $network := .Values.networkData.networks.ipv6 }} +{{- $link := $network.link | default $name }} +{{- if eq $link "baremetal" }} + - key: node_ip_{{ $name }} + name: {{ $.Values.clusterName }}-{{ $network.fromIPPool }} +{{- end }} +{{- end }} +{{- else }} + fromAnnotations: + - key: node_ip + object: baremetalhost + annotation: icn.akraino.org/node-ip +{{- end }} +{{- if .Values.networkData }} networkData: links: ethernets: -{{- range $name, $network := .Values.networks }} +{{- range $name, $link := .Values.networkData.links.ethernets }} - id: {{ $name }}_nic macAddress: - fromHostInterface: {{ $network.interface }} + fromHostInterface: {{ $link.interface }} type: phy {{- end }} networks: +{{- if .Values.networkData.networks.ipv4DHCP }} ipv4DHCP: -{{- range $name, $network := .Values.networks }} +{{- range $name, $network := .Values.networkData.networks.ipv4DHCP }} + - id: {{ $name }} + link: {{ $network.link | default $name }}_nic +{{- end }} +{{- end }} +{{- if .Values.networkData.networks.ipv4 }} + ipv4: +{{- range $name, $network := .Values.networkData.networks.ipv4 }} + - id: {{ $name }} + link: {{ $network.link | default $name }}_nic + ipAddressFromIPPool: {{ $.Values.clusterName }}-{{ $network.fromIPPool }} +{{- $pool := (get $.Values.ipPools $network.fromIPPool) }} +{{- if hasKey $pool "gateway" }} + routes: + - network: "0.0.0.0" + prefix: 0 + gateway: + fromIPPool: {{ $.Values.clusterName }}-{{ $network.fromIPPool }} +{{- end }} +{{- end }} +{{- end }} +{{- if .Values.networkData.networks.ipv6DHCP }} + ipv6DHCP: +{{- range $name, $network := .Values.networkData.networks.ipv6DHCP }} + - id: {{ $name }} + link: {{ $network.link | default $name }}_nic +{{- end }} +{{- end }} +{{- if .Values.networkData.networks.ipv6 }} + ipv6: +{{- range $name, $network := .Values.networkData.networks.ipv6 }} - id: {{ $name }} - link: {{ $name }}_nic + link: {{ $network.link | default $name }}_nic + ipAddressFromIPPool: {{ $.Values.clusterName }}-{{ $network.fromIPPool }} +{{- $pool := (get $.Values.ipPools $network.fromIPPool) }} +{{- if hasKey $pool "gateway" }} + routes: + - network: "::" + prefix: 0 + gateway: + fromIPPool: {{ $.Values.clusterName }}-{{ $network.fromIPPool }} +{{- end }} +{{- end }} +{{- end }} +{{- /* +Using routes[0].servers.dnsFromIPPool above doesn't have the desired +effect. So use separate services field here +*/}} +{{- if .Values.networkData.services }} +{{- if .Values.networkData.services.dns }} + services: + dns: +{{- range $address := .Values.networkData.services.dns }} + - {{ $address }} +{{- end }} +{{- end }} {{- end }} {{- end }}