roles

package
v0.7.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

pkg/resources/roles/role.go

Index

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 ResolvedRoleSpec) error

Create creates a Role if it does not already exist. Idempotent — skips if the Role 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 ResolvedRoleSpec) error

Delete deletes the Role if it exists.

func DeleteIfOwned

func DeleteIfOwned(ctx context.Context, kube kubeclient.KubeClient,
	owner domain.Object, name, namespace string) error

DeleteIfOwned deletes the Role only if it is owned by the CR.

func Update

func Update(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, spec ResolvedRoleSpec) error

Update applies the desired rules to an existing Role.

Types

type ResolvedRoleSpec

type ResolvedRoleSpec struct {
	Name      string
	Namespace string
	Labels    map[string]string
	Rules     []rbacv1.PolicyRule

	// 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
}

ResolvedRoleSpec is the fully resolved Role specification.

func Resolve

func Resolve(src orktypes.RoleTemplateSource, ownerName string) ResolvedRoleSpec

Resolve builds a ResolvedRoleSpec from a RoleTemplateSource. Template expressions must already be evaluated by template.Resolver before calling.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL