Expand description
§engenho-controllers
The K8s controller suite for engenho. Hosts:
Controllertrait — the second-site extraction of the reconcile-loop shape (first site:engenho-scheduler’sScheduler, which implements it too). Every controller here implements it.replicaset::ReplicaSetController— first concrete impl. WatchesReplicaSets, creates/deletes Pods so the observed replica count matchesspec.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 theValidatingWebhookConfigurationcall path) registered underadmissionregistration.k8s.io/v1. - attestation
- Attestation-gated admission — verify image / artifact signatures before admission.
- build_
backend_ roceiro BuildBackendRoceiro— production Roceiro that composesBuildBackend+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
Controllertrait — 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 creationTimestampboundary stamp for controller-created objects.- cron
- Minimal typed 5-field cron parser — the engenho-native cron surface.
- csi_
provisioner - The CSI provisioning seam — dynamic
CreateVolumefrom aStorageClass. - 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 theDaemonSet.- deployment
DeploymentController— reconciles Deployments intoReplicaSets.- dns
- R12 — DNS controller.
- drv
DrvController— reconcilesDerivationCRobjects through aDerivationCacheBackend(typically aTieredCache).- drv_
build DrvBuildController— the consumer that watchesDerivationCRphase=Pending + drives a pluggable build backend.- effect
- COUNTS COME FROM EFFECTS — a change is counted only when a write landed.
- endpoints
EndpointsController— materializes Endpoints andEndpointSliceobjects 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 —
HorizontalPodAutoscalercontroller. - ingress
- R14 — Ingress dimension.
- job
- R16 — Job + R16b
CronJobcontrollers. - meta
ObjectMetaaccessor extension trait.- namespace
NamespaceController— namespace-cascade (Background) deletion.- network_
policy - R17 —
NetworkPolicyenforcement. - network_
policy_ controller NetworkPolicyController— the PRODUCERNetworkPolicyEnforcernever 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
Readycondition 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 —
PodDisruptionBudgetcontroller. - plantio
PlantioController— reconcilesPlantioCRresources by driving aRoceiromaterializer + watching aMaterializationLedgerfor 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— thePersistentVolume/PersistentVolumeClaimbinder 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 matchingspec.replicasperReplicaSet.- 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 NControllerimpls 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 —
StatefulSetcontroller. - status
- M0.1 item 8 — shared status-subresource write primitive.
- store_
ledger StoreBackedLedger—MaterializationLedgerimpl backed byengenho-store. Receipts commit through the store’s existing Raft path; reads aggregate the committed receipts back into aQuorumTracker.- store_
resolver StoreBackedNodeResolver—NodeResolverimpl that reads cluster nodes from engenho-store.- sweep
- PER-OBJECT ISOLATION — one object’s failure costs only that object.
- tiered_
build TieredBuildBackend— composes NBuildBackends; tries each in order, first success wins. Analog toTieredCachebut 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§
- Frozen
Clock - Test clock — returns a fixed Instant; mutable via
advance(). Replaces the per-site42/100test timestamp pattern with one typed primitive. - Wall
Clock - Production clock backed by
std::time::SystemTime::now(). Returns Instant with current ms-since-epoch + logical 0. UseHlcClockfor monotonicity within a process.
Traits§
- Clock
- Universal clock surface. Implementers supply
now(); HLC-aware implementers additionally implementtick(observed).
Functions§
Type Aliases§
- Fixed
Clock Deprecated