pdbs

package
v0.7.9 Latest Latest
Warning

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

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

Documentation

Overview

pkg/resources/pdbs/pdb.go

pkg/resources/pdbs/types.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 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

	// MaxUnavailable — maximum pods that may be unavailable.
	// 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

Resolve builds a ResolvedPDBSpec from a PDBTemplateSource. All template expressions must be evaluated before calling here.

Jump to

Keyboard shortcuts

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