* do not record for empty metric config
* Revert "do not record for empty metric config"
This reverts commit 539a5e4dbb.
* redo
* use local
* typo
* Update leaderelection/context.go
Co-authored-by: Matt Moore <mattmoor@vmware.com>
* merge another pr
* update dep
* Update hash/bucketer_test.go
Co-authored-by: Victor Agababov <vagababov@gmail.com>
* Update hash/bucketer_test.go
Co-authored-by: Victor Agababov <vagababov@gmail.com>
* output diff
* output diff
Co-authored-by: Matt Moore <mattmoor@vmware.com>
Co-authored-by: Victor Agababov <vagababov@gmail.com>
* do not record for empty metric config
* Revert "do not record for empty metric config"
This reverts commit 539a5e4dbb.
* for standard
* delete bucket
* add s
* do not record for empty metric config
* Revert "do not record for empty metric config"
This reverts commit 539a5e4dbb.
* use hash bucektset for statefulset mode
* add test
* address comments from victor
* use make
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
* 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>
* update go-cmpt to work with 1.14.
Mostly to fix https://github.com/google/go-cmp/issues/167, but we also pinned at some
random commit, rather than at a release version.
* add new pkg
* Make sure we use same versions in pkg and serving
* Fix the defaulting for the leader election cm
This was missing, but now we can provide the default values.
* Fix the defaulting for the leader election cm
This was missing, but now we can provide the default values.
* Add leader election config and to sharedmain
* Add new dependencies
* Extract method for RunLeaderElected
* Make leader election config constructor validate
* Rename leader election files
* Always start profiling server whether component has LE lock or not
* Fix entering unreachable section when leader election is disabled
* Address PR feedback