Repository navigation
fix(common): inject STATEFUL_REPLICA_COUNT for ordinal election - #4124
shashankxrm wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
|
|
@shashankxrm Thanks for the PR. please confirm human ownership of the change:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4124 +/- ##
==========================================
+ Coverage 27.66% 27.72% +0.05%
==========================================
Files 477 477
Lines 25469 25518 +49
==========================================
+ Hits 7046 7074 +28
- Misses 17699 17714 +15
- Partials 724 730 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
|
/hold |
You're right that the current The reason I added the sync after additional options is because the env is set before those options are applied. For example, if the initial values are The two requested tests pass: The current I didn't add separate before/after output since the requested tests don't print the rendered StatefulSet, but the test does verify the final replica count and env value. |
Changes
When StatefulSet ordinal leader election is enabled, inject
STATEFUL_REPLICA_COUNTfrom the final renderedStatefulSet.spec.replicas.STATEFUL_REPLICA_COUNTinAddStatefulEnvVarsfrom the current StatefulSet replica count (nilis treated as1).ExecuteAdditionalOptionsTransformer, so additional options that override replicas are reflected on the pod.STATEFUL_CONTROLLER_ORDINAL.AddStatefulEnvVarsalone is not enough: it runs before additional options, which can changespec.replicas(for example performance replicas4overridden to8). The pod must receive8, not the earlier value.This does not change 1:1 ordinal-to-bucket ownership or redistribute buckets. It supplies the replica-count information required by the knative/pkg StatefulSet ordinal validation from knative/pkg#3384.
Related to knative/pkg#3384.
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
make test lintbefore submitting a PRRelease Notes