apiVersion: v1
kind: ClusterRole
metadata:
  name: {{obj_name}}
rules:
{% for rule in rules %}
- resources:
{% for kind in rule.resources %}
    - {{ kind }}
{% endfor %}
  apiGroups:
{% if rule.api_groups is defined %}
{% for group in rule.api_groups %}
    - {{ group }}
{% endfor %}
{% endif %}
  verbs:
{% for verb in rule.verbs %}
    - {{ verb }}
{% endfor %}
{% endfor %}
