Documentation
¶
Overview ¶
pkg/resources/serviceaccounts/serviceaccount.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
- type ResolvedServiceAccountSpec
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 ResolvedServiceAccountSpec) error
Create creates a ServiceAccount if it does not already exist. Idempotent — skips if the ServiceAccount exists. Owner reference set so ServiceAccount is garbage collected when CR is deleted.
ServiceAccounts have no meaningful spec fields that can drift after creation. There is no Update function — Create is called from both onCreate and onReconcile paths. If it exists, it stays. If it was deleted, it is recreated.
func Delete ¶
func Delete(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, spec ResolvedServiceAccountSpec) error
Delete deletes the ServiceAccount if it exists. For most cases owner references handle cleanup automatically — only use this when explicit cleanup control is needed.
func DeleteIfOwned ¶
func DeleteIfOwned(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, name, namespace string) error
DeleteIfOwned deletes the ServiceAccount if it exists and is owned by the CR.
Types ¶
type ResolvedServiceAccountSpec ¶
type ResolvedServiceAccountSpec struct {
// Name — ServiceAccount name. Required.
Name string
// Namespace — target namespace. Required.
Namespace string
// Labels — applied to ServiceAccount metadata.
Labels map[string]string
// 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
}
ResolvedServiceAccountSpec is the fully resolved ServiceAccount specification.
func Resolve ¶
func Resolve(src orktypes.ServiceAccountTemplateSource, ownerName string) ResolvedServiceAccountSpec
Resolve builds a ResolvedServiceAccountSpec from a ServiceAccountTemplateSource. Template expressions must already be evaluated by template.Resolver before calling.