Skip to main content

Crate engenho_controllers

Crate engenho_controllers 

Source
Expand description

§engenho-controllers

The K8s controller suite for engenho. Hosts:

  • Controller trait — the second-site extraction of the reconcile-loop shape (first site: engenho-scheduler’s Scheduler, which implements it too). Every controller here implements it.
  • replicaset::ReplicaSetController — first concrete impl. Watches ReplicaSets, creates/deletes Pods so the observed replica count matches spec.replicas.
  • WatchDriver — the event loop that drives one controller from store events, a requeue slot and a fallback timer. The daemon runs each controller it spawns under one.
  • runtime::ControllerRuntime — runs N controllers on a shared tokio scheduler with per-controller intervals, for embedders and tests; the daemon does not use it.

§Why this is its own crate (not part of engenho-scheduler)

The scheduler is one controller. The controllers crate is the HOME for all the others. Per the prime directive, the SHARED trait + drivers live here; engenho-scheduler keeps its Scheduler and implements Controller for it.

§Owner references

K8s controllers track ownership via metadata.ownerReferences. owner::set_owner_reference is the typed helper; gc collects the dependents whose owners are gone.

Re-exports§

pub use admission::AdmissionAction;
pub use admission::AdmissionChain;
pub use admission::AdmissionDecision;
pub use admission::AdmissionError;
pub use admission::AdmissionMode;
pub use admission::AdmissionRequest;
pub use admission::AdmissionWebhook;
pub use admission::FakeAdmissionWebhook;
pub use admission_webhook::FailurePolicy;
pub use admission_webhook::MockWebhookCaller;
pub use admission_webhook::MutatingWebhook;
pub use admission_webhook::MutatingWebhookPlugin;
pub use admission_webhook::Pluralizer;
pub use admission_webhook::ReinvocationPolicy;
pub use admission_webhook::RuleWithOperations;
pub use admission_webhook::ServiceRef;
pub use admission_webhook::StaticConfigSource;
pub use admission_webhook::WebhookCaller;
pub use admission_webhook::WebhookClientConfig;
pub use admission_webhook::WebhookConfigSource;
pub use admission_webhook::WebhookError;
pub use admission_webhook::build_admission_review;
pub use admission_webhook::parse_mutating_config;
pub use admission_webhook::read_admission_review;
pub use admission_webhook::rules_match;
pub use attestation::FakeSignatureVerifier;
pub use attestation::SignatureVerifier;
pub use attestation::TameshiAttestationWebhook;
pub use attestation::VerifierError;
pub use attestation::tameshi_attestation_webhook;
pub use build_backend_roceiro::BuildBackendRoceiro;
pub use contain::PanicMessage;
pub use contain::TickState;
pub use controller::Controller;
pub use controller::ControllerType;
pub use controller::ReconcileOutcome;
pub use controller::ReconcileReport;
pub use controller::ReconcileResult;
pub use crd::CrdController;
pub use crd::CrdEntry;
pub use crd::CrdError;
pub use crd::CrdHandlerSpec;
pub use crd::CrdNames;
pub use crd::CrdScope;
pub use crd::CrdSpec;
pub use crd::CrdVersion;
pub use crd::DynamicHandlerSink;
pub use crd::serve_stored_crds;
pub use crd_validator::CrdValidationWebhook;
pub use crd_validator::ValidationRegistry;
pub use crd_validator::crd_validation_webhook;
pub use create_stamp::CreateClock;
pub use create_stamp::stamp_create_timestamp;
pub use create_stamp::wall_clock;
pub use daemonset::DaemonSetController;
pub use deployment::DeploymentController;
pub use deployment::current_replicaset;
pub use dns::DEFAULT_CLUSTER_DOMAIN;
pub use dns::DnsBackend;
pub use dns::DnsController;
pub use dns::DnsError;
pub use dns::DnsEvent;
pub use dns::DnsRecord;
pub use dns::InMemoryDnsZone;
pub use dns::SrvRecord;
pub use dns::srv_fqdn;
pub use drv::DrvController;
pub use drv_build::BuildBackend;
pub use drv_build::BuildError;
pub use drv_build::BuildResult;
pub use drv_build::DrvBuildController;
pub use drv_build::FakeBuildBackend;
pub use effect::Effect;
pub use effect::Landed;
pub use effect::Refusal;
pub use endpoints::EndpointsController;
pub use error::ControllerError;
pub use error::ErrorScope;
pub use event_driven::EventDrivenController;
pub use gc::GcController;
pub use heartbeat::Beat;
pub use heartbeat::Heartbeat;
pub use heartbeat::TickClass;
pub use hpa::FakeMetricsProvider;
pub use hpa::HorizontalPodAutoscalerController;
pub use hpa::MetricSpec;
pub use hpa::MetricSpecError;
pub use hpa::MetricTarget;
pub use hpa::MetricsError;
pub use hpa::MetricsProvider;
pub use hpa::PANGEA_LEAF_PENDING_WORK;
pub use hpa::Recommendations;
pub use hpa::ScaleTarget;
pub use hpa::StatusMetric;
pub use hpa::StatusMetricsProvider;
pub use hpa::Windows;
pub use hpa::recommend;
pub use ingress::FakeIngressBackend;
pub use ingress::FakeIngressEvent;
pub use ingress::IngressBackend;
pub use ingress::IngressController;
pub use ingress::IngressError;
pub use ingress::IngressRoute;
pub use ingress::NginxIngressBackend;
pub use ingress::PathType;
pub use ingress::TraefikIngressBackend;
pub use job::ConcurrencyPolicy;
pub use job::CronJobController;
pub use job::JobController;
pub use job::SystemClock;
pub use job::fixed_clock;
pub use condition::ConditionStatus;
pub use condition::ConditionUpsert;
pub use condition::DesiredCondition;
pub use condition::upsert_condition;
pub use curve::Curve;
pub use curve::Streak;
pub use meta::Container;
pub use meta::DefaultedInt;
pub use meta::FieldPath;
pub use meta::JsonKind;
pub use meta::ObjectMeta;
pub use meta::REPLICAS;
pub use meta::ShapeError;
pub use meta::array_mut;
pub use meta::int_at;
pub use meta::object_mut;
pub use namespace::NamespaceController;
pub use namespace::namespaced_kinds;
pub use network_policy::CiliumNetworkPolicyAdapter;
pub use network_policy::Direction;
pub use network_policy::FakeNetworkPolicyEnforcer;
pub use network_policy::FakeNpEvent;
pub use network_policy::NetworkPolicyEnforcer;
pub use network_policy::NetworkPolicyError;
pub use network_policy::NetworkPolicyRule;
pub use network_policy::PeerSelector;
pub use network_policy::PortSpec;
pub use owned_children::OwnedChildrenReconciler;
pub use owned_children::ParentGvk;
pub use owned_children::ReconcileDelta;
pub use owner::OwnerReference;
pub use owner::controlling_owner;
pub use owner::is_owned_by;
pub use owner::owner_ref_for;
pub use owner::set_owner_reference;
pub use pdb::PodDisruptionBudgetController;
pub use pdb::counts_healthy;
pub use pdb::pdb_selects;
pub use plantio::NodeResolver;
pub use plantio::PlantioController;
pub use plantio::StaticNodeResolver;
pub use plantio_pipeline::LedgerChoice;
pub use plantio_pipeline::LedgerWrappers;
pub use plantio_pipeline::NodeResolverChoice;
pub use plantio_pipeline::PipelineConfig;
pub use plantio_pipeline::PlantioPipeline;
pub use plantio_pipeline::RoceiroChoice;
pub use pod_scheduling::BindOutcome;
pub use pod_scheduling::Binding;
pub use pod_scheduling::DEFAULT_SCHEDULER;
pub use pod_scheduling::PodSchedulingState;
pub use pod_scheduling::Schedulable;
pub use pod_scheduling::bind_cas;
pub use pod_scheduling::mark_unschedulable_cas;
pub use pod_template::NormalizedTemplate;
pub use pod_template::POD_TEMPLATE_HASH_LABEL;
pub use pod_template::TemplateHash;
pub use pv_binder::ClaimUid;
pub use pv_binder::ENGENHO_LOCAL_PATH_PROVISIONER;
pub use pv_binder::FakeProvisionerEnv;
pub use pv_binder::HostProvisionerEnv;
pub use pv_binder::LOCAL_PATH_PROVISIONER;
pub use pv_binder::LocalPathDir;
pub use pv_binder::NoVolumeIdentity;
pub use pv_binder::ProvisionerEnv;
pub use pv_binder::PvBinderController;
pub use pv_binder::PvName;
pub use pv_binder::ReclaimError;
pub use pv_binder::ReclaimPolicy;
pub use pv_binder::Unreclaimable;
pub use pvc_protection::PVC_PROTECTION_FINALIZER;
pub use pvc_protection::PvcProtectionController;
pub use reads::DeclaresReads;
pub use reads::Reads;
pub use reads::gvk;
pub use replicaset::ReplicaSetController;
pub use roceiro::FakeRoceiro;
pub use roceiro::Roceiro;
pub use roceiro::RoceiroError;
pub use runtime::ControllerRuntime;
pub use runtime::RuntimeConfig;
pub use selector::matches_labels;
pub use selector::selector_match_labels;
pub use selector::service_selector;
pub use service_router::FakeRouter;
pub use service_router::FakeRouterEvent;
pub use service_router::IptablesRouter;
pub use service_router::IpvsRouter;
pub use service_router::PortMap;
pub use service_router::RouterError;
pub use service_router::ServiceRoute;
pub use service_router::ServiceRouter;
pub use service_router::ServiceRoutingController;
pub use statefulset::StatefulSetController;
pub use status::CasEnv;
pub use status::GENERATION;
pub use status::StatusEdit;
pub use status::StatusEditOutcome;
pub use status::StatusWriteOutcome;
pub use status::StoreCasEnv;
pub use status::edit_status_cas;
pub use status::generation_of;
pub use status::pod_is_ready;
pub use status::resource_version_of;
pub use status::upsert_condition_cas;
pub use status::write_status_cas;
pub use store_ledger::DEFAULT_RECEIPT_NAMESPACE;
pub use store_ledger::StoreBackedLedger;
pub use store_resolver::StoreBackedNodeResolver;
pub use sweep::ItemFailure;
pub use sweep::ObjectOutcome;
pub use sweep::Sweep;
pub use sweep::SweepAbort;
pub use sweep::SweepReport;
pub use tiered_build::TieredBuildBackend;
pub use tiered_reconciler::PromotionScope;
pub use tiered_reconciler::StaticPromotionScope;
pub use tiered_reconciler::TieredCacheReconciler;
pub use watch_driver::ConsecutiveFailures;
pub use watch_driver::KindFilter;
pub use watch_driver::RESUBSCRIBE;
pub use watch_driver::TRANSIENT_RETRY;
pub use watch_driver::WatchDriver;
pub use watch_driver::WatchDriverConfig;
pub use watch_driver::next_wake;

Modules§

admission
R20 — Admission webhook trait.
admission_webhook
Dynamic admission webhooks — the apiserver-side call-out to MutatingWebhookConfiguration (and the ValidatingWebhookConfiguration call path) registered under admissionregistration.k8s.io/v1.
attestation
Attestation-gated admission — verify image / artifact signatures before admission.
build_backend_roceiro
BuildBackendRoceiro — production Roceiro that composes BuildBackend + DerivationCacheBackend + Verifier into one materializer surface.
closed_enum
closed_enum! — a fieldless enum, the list of its variants, and optionally their names, all written once.
cluster_ip
Service ClusterIP (VIP) allocator + the defaulting admission webhook that stamps an allocated VIP onto a Service at create time.
cni_status
CniStatusController — publishing which CNI this node actually has.
condition
T2.5 — one condition, set by its type, carried at most once.
contain
Panic containment for a driver’s tick (T2.7).
controller
The Controller trait — second-site extraction of the reconcile-loop pattern. First site: engenho-scheduler::Scheduler.
crd
R21 — CRD (CustomResourceDefinition) serving.
crd_conversion
CRD CONVERSION — reading a stored custom resource at a version other than the one it was written in.
crd_validator
CRD validation webhook — typed-shape validation of CR writes.
create_stamp
creationTimestamp boundary stamp for controller-created objects.
cron
Minimal typed 5-field cron parser — the engenho-native cron surface.
csi_provisioner
The CSI provisioning seam — dynamic CreateVolume from a StorageClass.
curve
Curve — the one shape every retry delay in the controllers takes: a floor that doubles per step up to a ceiling.
daemonset
DaemonSetController — ensures exactly ONE Pod per schedulable node, owned by the DaemonSet.
deployment
DeploymentController — reconciles Deployments into ReplicaSets.
dns
R12 — DNS controller.
drv
DrvController — reconciles DerivationCR objects through a DerivationCacheBackend (typically a TieredCache).
drv_build
DrvBuildController — the consumer that watches DerivationCR phase=Pending + drives a pluggable build backend.
effect
COUNTS COME FROM EFFECTS — a change is counted only when a write landed.
endpoints
EndpointsController — materializes Endpoints and EndpointSlice objects from Service selectors + matching Pod IPs.
error
Typed errors shared across controller impls.
event_driven
EventDrivenController — generic adapter that ticks a wrapped Controller on every received event.
event_recorder
EVENT RECORDING — how the cluster explains itself.
event_retention
gc
GcController — orphan-reference garbage collector.
heartbeat
Heartbeat — what a supervised child last did, readable from outside without a lock.
hpa
R18 — HorizontalPodAutoscaler controller.
ingress
R14 — Ingress dimension.
job
R16 — Job + R16b CronJob controllers.
meta
ObjectMeta accessor extension trait.
namespace
NamespaceController — namespace-cascade (Background) deletion.
network_policy
R17 — NetworkPolicy enforcement.
network_policy_controller
NetworkPolicyController — the PRODUCER NetworkPolicyEnforcer never had.
node_lease
NODE HEARTBEATS — the Lease a node renews to prove it is alive.
node_lifecycle
node_port
NODEPORT ALLOCATION.
node_readiness
Publishing a node’s Ready condition as a store write, WITHOUT undoing anyone else’s write to the Node (T1.3b).
owned_children
OwnedChildrenReconciler — the blanket-impl collapse of the owned-children controller family.
owner
Owner-reference helpers.
pdb
R19 — PodDisruptionBudget controller.
plantio
PlantioController — reconciles PlantioCR resources by driving a Roceiro materializer + watching a MaterializationLedger for confirmation.
plantio_pipeline
PlantioPipeline — builder that assembles the full production roça stack from a typed config.
pod_scheduling
T2.5 — how a scheduler reads a pod, and the two writes it makes to one.
pod_template
Pod-template identity — upstream’s EqualIgnoreHash.
pv_binder
PvBinderController — the PersistentVolume / PersistentVolumeClaim binder PLUS a minimal local-path dynamic provisioner.
pvc_protection
PvcProtectionController — upstream’s pvc-protection controller.
reads
What a controller reads: the one declaration its wake filter is derived from (T1.7).
replicaset
ReplicaSetController — keeps the observed pod count matching spec.replicas per ReplicaSet.
roceiro
Roceiro — the materializer trait.
rollout
Template revisions and update strategies — how a controller that keeps pods under STABLE names (DaemonSet, StatefulSet) knows a pod is out of date, and how many it may replace at once.
runtime
ControllerRuntime — runs N Controller impls on a shared tokio runtime with per-controller intervals.
selector
Label-selector typed helpers.
served_capability
ADVERTISED-BUT-INERT KINDS — making a no-op say so.
service_router
R11 — Service IP routing primitive.
statefulset
R15 — StatefulSet controller.
status
M0.1 item 8 — shared status-subresource write primitive.
store_ledger
StoreBackedLedger — MaterializationLedger impl backed by engenho-store. Receipts commit through the store’s existing Raft path; reads aggregate the committed receipts back into a QuorumTracker.
store_resolver
StoreBackedNodeResolver — NodeResolver impl that reads cluster nodes from engenho-store.
sweep
PER-OBJECT ISOLATION — one object’s failure costs only that object.
tiered_build
TieredBuildBackend — composes N BuildBackends; tries each in order, first success wins. Analog to TieredCache but for the build path.
tiered_reconciler
TieredCacheReconciler — proactive promotion across cache tiers.
volume_snapshot
VolumeSnapshotController — snapshot and restore for local-path volumes.
watch_driver
WatchDriver — event-driven controller wakeup.

Macros§

closed_enum
Declare a fieldless enum together with pub const ALL: &[Self], every variant in declaration order, generated from the enum’s own variant list.

Structs§

FrozenClock
Test clock — returns a fixed Instant; mutable via advance(). Replaces the per-site 42/100 test timestamp pattern with one typed primitive.
WallClock
Production clock backed by std::time::SystemTime::now(). Returns Instant with current ms-since-epoch + logical 0. Use HlcClock for monotonicity within a process.

Traits§

Clock
Universal clock surface. Implementers supply now(); HLC-aware implementers additionally implement tick(observed).

Functions§

creation_timestamp_is_unset

Type Aliases§

FixedClockDeprecated