pub struct SpreadRule {
pub topology_key: String,
pub max_skew: Option<i32>,
pub when_unsatisfiable: Option<WhenUnsatisfiable>,
pub scope: Option<SpreadScope>,
pub min_domains: Option<i32>,
pub node_affinity_policy: Option<NodeInclusionPolicy>,
pub node_taints_policy: Option<NodeInclusionPolicy>,
}Expand description
A single topology spread rule.
Each rule becomes exactly one entry in the Pod’s
spec.topologySpreadConstraints, with the labelSelector generated from
SpreadScope rather than written by hand — users have no way to know the
operator’s internal Pod labels, and getting the selector wrong silently
produces a constraint that does nothing.
§Example
spread:
# Spread primaries across zones first — hard requirement.
- topologyKey: topology.kubernetes.io/zone
maxSkew: 1
whenUnsatisfiable: DoNotSchedule
scope: Role
# Then, within a zone, prefer separate nodes.
- topologyKey: kubernetes.io/hostname
maxSkew: 1
whenUnsatisfiable: ScheduleAnyway
scope: RoleFields§
§topology_key: StringNode label key that defines the failure domain.
Nodes sharing a value for this label are in the same domain. Any node label works, which is the point: clusters that do not use the well-known zone label can spread across whatever they do use.
Examples:
topology.kubernetes.io/zone- availability zone (the usual choice)topology.kubernetes.io/region- region, for multi-region clusterskubernetes.io/hostname- individual nodesfailure-domain.acme.io/rack- a custom, on-prem failure domainkarpenter.sh/capacity-type- spot vs. on-demand capacity
Must be a valid Kubernetes qualified name, matching what the API server
accepts for a node label key: an optional lowercase RFC 1123 subdomain
prefix of at most 253 characters, a /, and a name segment of at most
63 characters. The maximum overall length is therefore 317.
The 253-character prefix cap is enforced by an
x-kubernetes-validations rule on the parent rule rather than by the
pattern below: CRD patterns are RE2, which has no lookahead, so a
length bound on a variable-length prefix cannot be expressed in the
regex itself.
max_skew: Option<i32>Maximum permitted difference in Pod count between any two domains.
Default: 1 (the tightest useful value — every domain is filled before
any domain doubles up).
when_unsatisfiable: Option<WhenUnsatisfiable>What the scheduler does when the rule cannot be satisfied.
Default: ScheduleAnyway (soft). The operator defaults to soft
deliberately: a hard constraint turns a single-zone cluster, or a zone
outage, into Pending DNS Pods — trading an availability problem for a
total outage. Set DoNotSchedule only when you know the cluster has at
least as many domains as you have replicas.
scope: Option<SpreadScope>Which Pods this rule balances. See SpreadScope.
Default: Role for a cluster-managed instance (spread all primaries of
the cluster across zones), Instance for a standalone Bind9Instance
(spread that instance’s own replicas).
The default is almost always what you want. Override it only when you
deliberately want primaries and secondaries balanced together
(Cluster), or want to opt a multi-replica standalone instance out of
cluster-wide balancing (Instance).
min_domains: Option<i32>Minimum number of domains that must be eligible.
Only meaningful together with whenUnsatisfiable: DoNotSchedule. When
fewer than minDomains domains exist, the constraint is treated as
unsatisfiable. Use it to fail loudly rather than silently running all
your nameservers in one zone.
node_affinity_policy: Option<NodeInclusionPolicy>Whether the Pod’s node affinity / node selector is honoured when counting domains.
Default: Honor (the Kubernetes default). Ignore counts every node,
including ones this Pod could never be scheduled onto.
node_taints_policy: Option<NodeInclusionPolicy>Whether node taints are honoured when counting domains.
Default: Ignore (the Kubernetes default).
Trait Implementations§
Source§impl Clone for SpreadRule
impl Clone for SpreadRule
Source§fn clone(&self) -> SpreadRule
fn clone(&self) -> SpreadRule
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SpreadRule
impl Debug for SpreadRule
Source§impl<'de> Deserialize<'de> for SpreadRule
impl<'de> Deserialize<'de> for SpreadRule
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for SpreadRule
impl JsonSchema for SpreadRule
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for SpreadRule
impl PartialEq for SpreadRule
Source§impl Serialize for SpreadRule
impl Serialize for SpreadRule
impl Eq for SpreadRule
impl StructuralPartialEq for SpreadRule
Auto Trait Implementations§
impl Freeze for SpreadRule
impl RefUnwindSafe for SpreadRule
impl Send for SpreadRule
impl Sync for SpreadRule
impl Unpin for SpreadRule
impl UnwindSafe for SpreadRule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].