Merge "(calico) Add network policy safety valve"

This commit is contained in:
Zuul 2018-12-21 08:06:29 +00:00 committed by Gerrit Code Review
commit 0513c779bd

View File

@ -75,10 +75,15 @@ EOF
# Priority: {{ $n }} objects # Priority: {{ $n }} objects
{{- range $section, $data := $envAll.Values.networking.policy }} {{- range $section, $data := $envAll.Values.networking.policy }}
{{- if eq (toString $data.priority) (toString $n) }} {{- if eq (toString $data.priority) (toString $n) }}
{{/* add a safety check so we don't attempt to run calicoctl with an empty resource set */}}
{{- if gt (len $data.rules) 0 }}
# Section: {{ $section }} Priority: {{ $data.priority }} {{ $n }} # Section: {{ $section }} Priority: {{ $data.priority }} {{ $n }}
$CTL apply -f - <<EOF $CTL apply -f - <<EOF
{{ $data.rules | toYaml }} {{ $data.rules | toYaml }}
EOF EOF
{{- else }}
echo "Skipping empty rules list."
{{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}