cni:
  kubeovn:
    values: |
      # kube-ovn helm values
      global:
        registry:
          address: {{ .image_registry.dockerio_registry }}/kubeovn
      {{- $ips := list }}
      {{- range .groups.kube_control_plane | default list }}
        {{- $internalIPv4 := index $.hostvars . "internal_ipv4" | default "" }}
        {{- $internalIPv6 := index $.hostvars . "internal_ipv6" | default "" }}
        {{- if $internalIPv4| empty | not }}
          {{- $ips = append $ips $internalIPv4 }}
        {{- else if $internalIPv6 | empty | not }}
          {{- $ips = append $ips $internalIPv6 }}
        {{- end }}
      {{- end }}
      MASTER_NODES: {{ $ips | join "," }}
      networking:
        NET_STACK: {{ if and .cni.ipv4_support (not .cni.ipv6_support) }}ipv4{{ else if and .cni.ipv6_support (not .cni.ipv4_support) }}ipv6{{ else if and .cni.ipv4_support .cni.ipv6_support }}dual_stack{{ end }}
      {{- if and .cni.ipv4_support (not .cni.ipv6_support) }}
      ipv4:
        POD_CIDR: {{ .cni.ipv4_pods_cidr }}
        SVC_CIDR: {{ .cni.service_cidr }}
      {{ else if and .cni.ipv6_support (not .cni.ipv4_support) }}
      ipv6:
        POD_CIDR: {{ .cni.ipv6_pods_cidr }}
        SVC_CIDR: {{ .cni.service_cidr }}
      {{ else if and .cni.ipv4_support .cni.ipv6_support }}
      dual_stack:
        POD_CIDR: {{ .cni.ipv4_pods_cidr }},{{ .cni.ipv6_pods_cidr }}
        SVC_CIDR: {{ .cni.service_cidr }}
      {{- end }}