Kubernetes v1 Authorization resources, primarily using Role-Based Access Control (RBAC), are components that regulate access to the Kubernetes API and cluster resources through the rbac.authorization.k8s.io API group. These resources include Roles, ClusterRoles, RoleBindings, and ClusterRoleBindings, which work together to define and enforce fine-grained access policies for users, groups, and service accounts within a Kubernetes cluster
Authentication
Add API authentication details
Readme
User instructions for this resource
The ClusterRole template is designed to provide flexibility in creating Kubernetes ClusterRole resources. It uses a combination of facets and variables to allow for different configurations.
Variables
The template uses variables to allow for dynamic content:
: This is a global variable that represents the identifier for the ClusterRole. It's used to access specific fields in a collection of multiple clusterrole values. You can see real examples in Cert Manager and to know more about globalvariables, check Core Concepts__CR_ID__
Collection Breakdown
- Base
{
"kind": "ClusterRole",
"facets": ["master"],
"metadata": "{{ __CR_ID__.metadata }}",
"apiVersion": "rbac.authorization.k8s.io/v1"
}
- This section is always included (due to the master facet).
- It sets the
andkind
.apiVersion
- The
is populated from the request values.metadata
- Rules
{
"rules": "{{ __CR_ID__.rules }}",
"facets": ["addon:rules"]
}
- This section is optional and included when the
facet is specified.addon:rules
- It populates the
field from the request values.rules
- AggregationRule
{
"facets": ["addon:aggregationrule"],
"aggregationRule": "{{ __CR_ID__.aggregationRule }}"
}
- This section is optional and included when the addon:aggregationrule facet is specified.
- It populates the
field from the request values.aggregationRule
Design Decisions
Separation of Concerns: By using different facets for rules and aggregationRule, the template allows for creating ClusterRoles with either or both of these sections.
Flexibility: The use of variables (like
) allows for dynamic content population, making the template reusable for different ClusterRole configurations.__CR_ID__
Base: The master facet ensures that the core ClusterRole fields are always included, maintaining the basic structure of the resource.
Optional Additions: The addon:rules and addon:aggregationrule facets allow for optional inclusion of these sections, catering to different use cases of ClusterRoles.
Examples
Check Request Body tab section to play around with interactive examples.
Install(
)Example
The Curl tab in the request section below provides the curl command for your resource.
curl -s -X POST "https://configfacets.com/apis/repos/kubernetes/authorization-resources/v1/resources/collections/clusterrole/exec?format=json" -d '{"facets":["addon:rules"],"values":{"labeled_cr":{"rules":[{"verbs":["get","list","watch"],"apiGroups":["custom.example.com"],"resources":["widgets"]}],"metadata":{"name":"custom-view","labels":{"rbac.authorization.k8s.io/aggregate-to-view":"true"}}}},"globalvars":{"__CR_ID__":"labeled_cr"}}' | kubectl apply -f -