kubernetes-retired / cluster-api-provider-nested

Cluster API Provider for Nested Clusters
Apache License 2.0
301 stars 67 forks source link

✨ Add LeaderElectionResourceLock flag and generalize leaderElectionID flag name #345

Closed m-messiah closed 1 year ago

m-messiah commented 1 year ago

What this PR does / why we need it: The PR adds a new flag --leader-elect-resource-lock to define the type of leader election resource lock (configmapleases, configmaps or leases). Current default behaviour of controller-runtime sets it to configmapleases, so the controller creates and updates two objects now - ConfigMap and Lease. Adding the flag would help operators to switch controller to use leases only to reduce load to the API and network.

The PR also deprecates the flag --le-cm-name because it was using cm in it, that could be confusing after the switch to leases; so it introduces the new flag --leader-elect-resource-name with the fallback to --le-cm-name if it is set explicitly.

k8s-ci-robot commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christopherhein, m-messiah

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[virtualcluster/OWNERS](https://github.com/kubernetes-sigs/cluster-api-provider-nested/blob/main/virtualcluster/OWNERS)~~ [christopherhein] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment