Repository navigation
Enable use of StatefulSet in sharedmain. - #1451
Conversation
This change allows for (just webhook for now) controllers going through sharedmain to opt into Yanwei's logic by setting several environment variables. I was able to pull this change in downstream and change the webhook to use a StatefulSet with the following environment: ``` + # These settings are used for statefulset-based + # leader selection. + - name: CONTROLLER_ORDINAL + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: STATEFUL_SERVICE_NAME + value: "webhook" ``` Running the above with 10 replicas and 10 buckets worked as intended (keys were evenly distributed across the replicas).
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mattmoor The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
The following is the coverage report on the affected files.
|
|
|
||
| func NewStatefulSetConfig() (*StatefulSetConfig, error) { | ||
| var ssc StatefulSetConfig | ||
| ssn, _, err := ParseControllerOrdinal() |
There was a problem hiding this comment.
This seems strange we parse the value manually and delegate the rest to the envconfig.
It seems envconfig has methods for fancier parsing, which we might use, but this can be done later.
There was a problem hiding this comment.
I wonder whether we still need StatefulSetName in StatefulSetConfig. It's only used in statefulSetBuilder. BuildElector, where ControllerOrdinal is called. However ControllerOrdinal calls ParseControllerOrdinal which returns stateful set name as well. I think we can just use ParseControllerOrdinal.
This change allows for (just webhook for now) controllers going through sharedmain to opt into Yanwei's logic by setting several environment variables.
I was able to pull this change in downstream and change the webhook to use a StatefulSet with the following environment:
Running the above with 10 replicas and 10 buckets worked as intended (keys were evenly distributed across the replicas).