RBAC: Fix issue with inclusion of empty jobs or daemonsets

Currently, the rbac logic would allow for ``jobs`` or ``daemonsets``
if it is specified in the dependencies, even if they may just be empty
or null.  This patch set addresses this by checking the jobs or
daemonsets map in the value.yaml is non-empty before including it
in the Role.

This mirrors the fix in OSH-infra in [0].

[0] https://review.openstack.org/#/c/530337/1

Change-Id: I37e8d8c1a0d587410811c544e049bbafed73cba8
Signed-off-by: Tin Lam <tin@irrational.io>
This commit is contained in:
Tin Lam 2017-12-28 22:04:55 -06:00
parent 9fb2bdf839
commit 943a400b9a

View File

@ -36,9 +36,9 @@ metadata:
{{- $_ := set $allNamespace $endpointNS (printf "%s%s" "services," ((index $allNamespace $endpointNS) | default "")) }}
{{- end -}}
{{- end -}}
{{- else if eq $k "jobs" }}
{{- else if and (eq $k "jobs") $v }}
{{- $_ := set $allNamespace $saNamespace (printf "%s%s" "jobs," ((index $allNamespace $saNamespace) | default "")) }}
{{- else if eq $k "daemonset" }}
{{- else if and (eq $k "daemonset") $v }}
{{- $_ := set $allNamespace $saNamespace (printf "%s%s" "daemonsets," ((index $allNamespace $saNamespace) | default "")) }}
{{- end -}}
{{- end -}}