role resource¶
Description¶
RoleResource manages a namespaced rbac.authorization.k8s.io/v1 Role. Permission changes replace the complete ordered rule list with JSON Patch. Writes return planned mutable values; reads return remote values. Existing objects use saved server and UID identity with current credentials. Delete completes when the API accepts one request, without waiting for disappearance.
Source: internal/api/rbac/v1/role_rsrc.go:27
Example usage:
imports: {
kubernetes-rbac-v1: 'github.com/cloudboss/unobin-library-kubernetes//api/rbac/v1'
}
resources: {
example: kubernetes-rbac-v1.role {
# Set input fields here.
}
}
Inputs¶
metadata
object
object({
name: optional(string)
generate-name: optional(string)
namespace: optional(string)
annotations: optional(map(string))
labels: optional(map(string))
})
rule
list(object)
list(
object({
api-groups: list(string)
resources: list(string)
verbs: list(string)
resource-names: optional(list(string))
})
)
Rule requires at least one rule. Rule order and duplicate rules are retained.
ignore-annotations
optional(list(string))
IgnoreAnnotations filters untracked keys during read, without changing requests.
ignore-labels
optional(list(string))
IgnoreLabels filters untracked keys during read, without changing requests.
Input Constraints¶
Metadata rules
Exactly one of metadata.name or metadata.generate-name.
metadata.name must not be empty.
Rule logic
- When
input.metadata.name != null- Require
@core.length(input.metadata.name) >= 1
metadata.generate-name must not be empty.
Rule logic
- When
input.metadata.generate-name != null- Require
@core.length(input.metadata.generate-name) >= 1
metadata.name must be an RBAC path segment.
Rule logic
- Require
@core.is-match(input.metadata.name, '^[^/%]*$')
&& !(input.metadata.name == '.' || input.metadata.name == '..')
metadata.generate-name must be an RBAC path segment.
Rule logic
- Require
@core.is-match(input.metadata.generate-name, '^[^/%]*$')
&& !(input.metadata.generate-name == '.' || input.metadata.generate-name == '..')
metadata.labels keys must be Kubernetes qualified names.
Rule logic
- For each
input.metadata.labels ?? {}- Require
@core.is-match(@each.key, '^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?[A-Za-z0-9]([-A-Za-z0-9_.]{0,61}[A-Za-z0-9])?$')
&& @core.is-match(@each.key, '^([^/]{1,253}/)?[^/]+$')
metadata.labels values must be valid Kubernetes label values.
Rule logic
- For each
input.metadata.labels ?? {}- Require
@core.is-match(@each.value, '^([A-Za-z0-9]([-A-Za-z0-9_.]{0,61}[A-Za-z0-9])?)?$')
metadata.annotations keys must be qualified names after lowercasing.
Rule logic
- For each
input.metadata.annotations ?? {}- Require
@core.is-match(@each.key, '^([A-Za-z0-9İK]([-A-Za-z0-9İK]*[A-Za-z0-9İK])?(\\.[A-Za-z0-9İK]([-A-Za-z0-9İK]*[A-Za-z0-9İK])?)*/)?[A-Za-z0-9İK]([-A-Za-z0-9İK_.]{0,61}[A-Za-z0-9İK])?$')
&& @core.is-match(@each.key, '^([^/]{1,253}/)?[^/]+$')
Ignore annotations rules
ignore-annotations entries must be valid regular expressions.
Rule logic
- For each
input.ignore-annotations ?? []- Require
@core.is-format(@each.value, 'regex')
Ignore labels rules
ignore-labels entries must be valid regular expressions.
Rule logic
- For each
input.ignore-labels ?? []- Require
@core.is-format(@each.value, 'regex')
Rule rules
Requirement.
Rule logic
- Require
@core.length(input.rule) >= 1
Outputs¶
server
string
api-version
string
kind
string
name
string
namespace
string
uid
string
metadata
object
object({
name: string
generate-name: string
namespace: string
annotations: map(string)
labels: map(string)
})
rule
list(object)
list(
object({
api-groups: list(string)
resources: list(string)
verbs: list(string)
resource-names: list(string)
})
)