Skip to content

Commit 441fd05

Browse files
authored
chore: gate role-probe by engine-authoritative version (#10303)
1 parent 0e69ee6 commit 441fd05

7 files changed

Lines changed: 853 additions & 39 deletions

File tree

apis/apps/v1/componentdefinition_types.go

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,9 +1558,30 @@ type ComponentLifecycleActions struct {
15581558
// Without this, services that rely on roleSelectors might improperly direct traffic to wrong replicas.
15591559
//
15601560
// Expected output of this action:
1561-
// - On Success: The determined role of the replica, which must align with one of the roles specified
1562-
// in the component definition.
1563-
// - On Failure: An error message, if applicable, indicating why the action failed.
1561+
// - On Success: The determined role of the replica, which must align with one of the roles
1562+
// specified in the component definition. Stdout MUST be one of the two forms below:
1563+
//
1564+
// <role> // single-token form
1565+
// <role> <roleVersion> // versioned form
1566+
//
1567+
// The two tokens are separated by whitespace (spaces, tabs, or newlines).
1568+
// <roleVersion> is an optional unsigned 64-bit decimal integer that
1569+
// carries the component's authoritative role version for stale-role
1570+
// handling, especially stale exclusive-role claims. A versioned
1571+
// result is accepted only when its <roleVersion> is newer than the
1572+
// versioned result the controller has already accepted for this Pod.
1573+
// The version should represent the complete role fact. For an
1574+
// exclusive primary role, identical versions reported by different
1575+
// replicas must not describe contradictory primary ownership.
1576+
// <role> remains a valid single-token form. Stdout that looks
1577+
// versioned but whose second token is not an unsigned 64-bit decimal
1578+
// integer, or stdout with three or more whitespace-separated tokens,
1579+
// is rejected as malformed and the Pod's role label is not updated.
1580+
// A component may migrate a Pod from the single-token form to the
1581+
// versioned form. After a Pod has reported the versioned form,
1582+
// later single-token results from that Pod are ignored to avoid
1583+
// downgrading from authoritative role-version ordering.
1584+
// - On Failure: An error message, if applicable, indicating why the action failed.
15641585
//
15651586
// Note: This field is immutable once it has been set.
15661587
//

config/crd/bases/apps.kubeblocks.io_componentdefinitions.yaml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8478,9 +8478,30 @@ spec:
84788478
Without this, services that rely on roleSelectors might improperly direct traffic to wrong replicas.
84798479

84808480
Expected output of this action:
8481-
- On Success: The determined role of the replica, which must align with one of the roles specified
8482-
in the component definition.
8483-
- On Failure: An error message, if applicable, indicating why the action failed.
8481+
- On Success: The determined role of the replica, which must align with one of the roles
8482+
specified in the component definition. Stdout MUST be one of the two forms below:
8483+
8484+
<role> // single-token form
8485+
<role> <roleVersion> // versioned form
8486+
8487+
The two tokens are separated by whitespace (spaces, tabs, or newlines).
8488+
<roleVersion> is an optional unsigned 64-bit decimal integer that
8489+
carries the component's authoritative role version for stale-role
8490+
handling, especially stale exclusive-role claims. A versioned
8491+
result is accepted only when its <roleVersion> is newer than the
8492+
versioned result the controller has already accepted for this Pod.
8493+
The version should represent the complete role fact. For an
8494+
exclusive primary role, identical versions reported by different
8495+
replicas must not describe contradictory primary ownership.
8496+
<role> remains a valid single-token form. Stdout that looks
8497+
versioned but whose second token is not an unsigned 64-bit decimal
8498+
integer, or stdout with three or more whitespace-separated tokens,
8499+
is rejected as malformed and the Pod's role label is not updated.
8500+
A component may migrate a Pod from the single-token form to the
8501+
versioned form. After a Pod has reported the versioned form,
8502+
later single-token results from that Pod are ignored to avoid
8503+
downgrading from authoritative role-version ordering.
8504+
- On Failure: An error message, if applicable, indicating why the action failed.
84848505

84858506
Note: This field is immutable once it has been set.
84868507
properties:

0 commit comments

Comments
 (0)