Documentation
¶
Overview ¶
pkg/resources/pdbs/pdb.go
pkg/resources/pdbs/types.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 ResolvedPDBSpec
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 ResolvedPDBSpec) error
Create creates a PDB owned by the CR if it does not already exist. Idempotent — if the PDB exists, does nothing and returns nil.
func Delete ¶
func Delete(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, spec ResolvedPDBSpec) error
Delete deletes the PDB if it exists.
func DeleteIfOwned ¶
func DeleteIfOwned(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, name, namespace string) error
DeleteIfOwned deletes the PDB if it exists and is owned by the CR.
func Update ¶
func Update(ctx context.Context, kube kubeclient.KubeClient, owner domain.Object, spec ResolvedPDBSpec) error
Update reconciles an existing PDB to match the resolved spec. PDB spec is largely immutable after creation — drift is handled by delete-and-recreate. If the PDB does not exist, creates it.
Types ¶
type ResolvedPDBSpec ¶
type ResolvedPDBSpec struct {
// Name — PDB resource name. Required.
Name string
// Namespace — target namespace.
Namespace string
// Selector — label selector identifying the pods this PDB protects.
Selector map[string]string
// MinAvailable — minimum pods that must remain available.
// Accepts integer string ("1") or percentage string ("50%").
// Empty means not set; MaxUnavailable is used instead.
MinAvailable string
// Accepts integer string ("1") or percentage string ("25%").
// Empty means not set; MinAvailable is used instead.
MaxUnavailable string
// Labels applied to PDB metadata.
// Orkestra always adds: managed-by=orkestra, orkestra-owner=<cr-name>
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
}
ResolvedPDBSpec is the fully resolved PodDisruptionBudget specification. All template expressions have been evaluated before this struct is populated. Passed directly to Create, Update, and Delete.
func Resolve ¶
func Resolve(src orktypes.PDBTemplateSource, ownerName string, reg orktypes.ProfileRegistry) ResolvedPDBSpec
Resolve builds a ResolvedPDBSpec from a PDBTemplateSource. All template expressions must be evaluated before calling here.