-
Notifications
You must be signed in to change notification settings - Fork 494
Open
Labels
Description
Kube-OVN Version
v1.14.4+
Kubernetes Version
N/A
Operation-system/Kernel Version
N/A
Description
#5504 changed the chart to panic if the kubeovn.nodeIPs did not return an IP. The problem with this is that I can't use helm template or helm install with client-side dry-run as in these scenarios the lookup function always returns nil and the template or install will always panic.
Steps To Reproduce
Simply run helm template on the chart:
$ helm template charts/kube-ovn-v2/
Error: execution error at (kube-ovn-v2/templates/ovs-ovn/ovs-ovn-daemonset.yaml:131:68): No nodes found with label 'map[kube-ovn/role:master]'. Please check your masterNodesLabels configuration or ensure master nodes are properly labeled.
Use --debug flag to render out invalid YAMLCurrent Behavior
helm template command fails with:
Error: execution error at (kube-ovn-v2/templates/ovs-ovn/ovs-ovn-daemonset.yaml:131:68): No nodes found with label 'map[kube-ovn/role:master]'. Please check your masterNodesLabels configuration or ensure master nodes are properly labeled.Expected Behavior
The charts should allow to be validated using helm template or a dry-run install.
One way to fix this can be to check if the length of the nodes is 0, and return nothing which would be a valid thing for a template/dry-run and not be something that will ever happen during an actual install.
---
charts/kube-ovn-v2/templates/_helpers.tpl | 3 +++
1 file changed, 3 insertions(+)
diff --git a/charts/kube-ovn-v2/templates/_helpers.tpl b/charts/kube-ovn-v2/templates/_helpers.tpl
index 21876f2f7..fbb2eaa1a 100644
--- a/charts/kube-ovn-v2/templates/_helpers.tpl
+++ b/charts/kube-ovn-v2/templates/_helpers.tpl
@@ -59,6 +59,8 @@ Get IP-addresses of master nodes
*/}}
{{- define "kubeovn.nodeIPs" -}}
{{- $nodes := lookup "v1" "Node" "" "" -}}
+{{- if eq (len $nodes) 0 -}}
+{{- else -}}
{{- $ips := list -}}
{{- range $node := $nodes.items -}}
{{- range $label, $value := $.Values.masterNodesLabels }}
@@ -77,6 +79,7 @@ Get IP-addresses of master nodes
{{- end -}}
{{ join "," $ips }}
{{- end -}}
+{{- end -}}
{{/*
Number of master nodes
--
2.34.1