This was part of the review feedback, but it inadvertently introduced a dependency that redefined a flag causing the duck to crash loop.
This copies the function instead of pulling in the dependency.
* Add a new "chaosduck" e2e test tool for leaderelection.
This adds a new main package under knative.dev/pkg/leaderelection/chaosduck, which
decodes the leases in the system namespace to establish the set of components and
their leader pod names and kills a leader pod for each component on a certain period.
* Incorporate feedback from vagababov
* super nit
* Enable HA by default.
This consolidates the core of sharedmain around the new leaderelection logic, which will now be **enabled by default**.
This can now be disabled with `--disable-ha` or by passing `sharedmain.WithHADisabled(ctx)` to `sharedmain.MainWithConfig`.
* vagababov comments, build failure
* Open an issue for enabledComponents removal.
* Move the configmap watcher startup.
This race was uncovered by the chaos duck on knative/serving! When we have enabled a feature flag, e.g. multi-container, and the webhook pods are restarted, there is a brief window where the webhook is up and healthy before the configmaps have synchronized and the new webhook pod realizes the feature is enabled.
* Drop the import alias
* Add BucketSet type which implements consistent bucketing
BucketSet permits mapping keys to buckets in a consistent manner, permitting us to use this type
in the HA applications. BucketSet implements the Bucket interface so it can be used in reconciler/leaderelection
pieces and has an additional method which returns the owner for the key. This is necessary in autoscaler
where requests need to be forwarded to an appropriate autoscaler.
* git mod stuff
* fixes
* nit
* two types for two thigns
* more tests
* Make HA test helpers deal with sets.
The previous helpers dealt with singleton leaders, change them to accomodate bucketing.
* vagababov feedback
* Add logging that was useful downstream debugging.
* Update release instruction.
* Update RELEASING.md
Co-authored-by: Matt Moore <mattmoor@vmware.com>
* Add new step to update doc.
* Update RELEASING.md
Co-authored-by: Matt Moore <mattmoor@vmware.com>
* Update RELEASING.md
Co-authored-by: Matt Moore <mattmoor@vmware.com>
Co-authored-by: Matt Moore <mattmoor@vmware.com>
* Add an option to skip automated status updates in a reconciler.
This option is necessary to be able to create reconcilers like Serving's labeler, that is purely adding labels to resources. If that fails, the new automated observed generation handling changes the status and that gets written to the API currently, which is not desired.
* Flip the bool.
* Some cleanups around LE
- make funcs and types not expected to be used outside private (we can always make them public, should the need arise)
- add some more checks in tests
- fix some strings
* streamline
* hide new
* review
* more
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).
* do not record for empty metric config
* Revert "do not record for empty metric config"
This reverts commit 539a5e4dbb.
* introduce statefulset builder
* change comment
* address victors comment and capsulation
* make exported func
* Update leaderelection/ordinal_test.go
Co-authored-by: Victor Agababov <vagababov@gmail.com>
* Update leaderelection/ordinal_test.go
Co-authored-by: Victor Agababov <vagababov@gmail.com>
* address comment
* format
* address comment from matt
Co-authored-by: Victor Agababov <vagababov@gmail.com>
* Add a b3tracecontext.HTTPFormat.
It will utilize either B3 or TraceContext propagation formats coming in (preferring TraceContext) and while sending both.
* hack/update-deps.sh
* PR comments.
* Move to HTTPFormatSequence.
* Remove the struct.
* Allow distinct ingress and egress formats.
* Fix gcs ListChildrenFiles and ListDirectChildren
Previous right trim and "/" addition prevented the discovery of
top-level directories under the bucket.
* Resolve review comments