Documentation
¶
Overview ¶
pkg/resources/rolebindings/rolebinding.go
Index ¶
- func Create(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, ...) error
- func Delete(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, ...) error
- func DeleteIfOwned(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, ...) error
- func Update(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, ...) error
- type ResolvedRoleBindingSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, spec ResolvedRoleBindingSpec) error
Create creates a RoleBinding if it does not already exist. Idempotent — skips if the RoleBinding already exists. Owner reference ensures cleanup when the CR is deleted.
func Delete ¶
func Delete(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, spec ResolvedRoleBindingSpec) error
Delete deletes the RoleBinding if it exists.
func DeleteIfOwned ¶
func DeleteIfOwned(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, name, namespace string) error
DeleteIfOwned deletes the RoleBinding only if it is owned by the CR.
func Update ¶
func Update(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, spec ResolvedRoleBindingSpec) error
Update applies the desired subjects and roleRef to an existing RoleBinding. RoleRef is immutable in Kubernetes — if it changed the binding is deleted and recreated.
Types ¶
type ResolvedRoleBindingSpec ¶
type ResolvedRoleBindingSpec struct {
Name string
Namespace string
Labels map[string]string
RoleRef rbacv1.RoleRef
Subjects []rbacv1.Subject
// Sleep injects an artificial delay into the reconcile of this resource.
// Useful for autoscale testing, latency simulation, and chaos engineering.
// Accepts extended duration units (s, m, h, d, w, mo, y).
Sleep string
}
ResolvedRoleBindingSpec is the fully resolved RoleBinding specification.
func Resolve ¶
func Resolve(src orktypes.RoleBindingTemplateSource, ownerName string) ResolvedRoleBindingSpec
Resolve builds a ResolvedRoleBindingSpec from a RoleBindingTemplateSource. Template expressions must already be evaluated by template.Resolver before calling.