Skip to content

Commit

Permalink
feat(mgr) deprecate --leader-elect flag
Browse files Browse the repository at this point in the history
Deprecate the --leader-elect flag. It is no longer used. Leader election
is enabled or disabled based on whether the instance is running in
DB-less mode or not.
  • Loading branch information
Travis Raines committed Dec 17, 2021
1 parent 7411d11 commit a71c15d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ the `configuration.konghq.com` API group.

#### Breaking changes

- The `--leader-elect` flag has been removed. Leader election is now enabled or
disabled automatically based on the database mode.
- The `--leader-elect` flag has been deprectated and will be removed in a
future release. Leader election is now enabled or disabled automatically
based on the database mode. The flag is no longer honored.
[#2053](https://github.com/Kong/kubernetes-ingress-controller/issues/2053)
- You must upgrade to 2.0.x before upgrading to 2.1.x to properly handle the
transition from apiextensions.k8s.io/v1beta1 CRDs to apiextensions.k8s.io/v1
Expand Down
2 changes: 1 addition & 1 deletion internal/manager/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (c *Config) FlagSet() *pflag.FlagSet {
// Kubernetes configurations
flagSet.StringVar(&c.KubeconfigPath, "kubeconfig", "", "Path to the kubeconfig file.")
flagSet.StringVar(&c.IngressClassName, "ingress-class", annotations.DefaultIngressClass, `Name of the ingress class to route through this controller.`)
flagSet.BoolVar(&c.EnableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.")
flagSet.BoolVar(&c.EnableLeaderElection, "leader-elect", false, "DEPRECATED as of 2.1.0 leader election behavior is determined automatically and this flag has no effect")
flagSet.StringVar(&c.LeaderElectionID, "election-id", "5b374a9e.konghq.com", `Election id to use for status update.`)
flagSet.StringVar(&c.LeaderElectionNamespace, "election-namespace", "", `Leader election namespace to use when running outside a cluster`)
flagSet.StringSliceVar(&c.FilterTags, "kong-admin-filter-tag", []string{"managed-by-ingress-controller"}, "The tag used to manage and filter entities in Kong. This flag can be specified multiple times to specify multiple tags. This setting will be silently ignored if the Kong instance has no tags support.")
Expand Down
4 changes: 4 additions & 0 deletions internal/manager/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func Run(ctx context.Context, c *Config, diagnostic util.ConfigDumpDiagnostic) e
utilruntime.Must(knativev1alpha1.AddToScheme(scheme))
utilruntime.Must(gatewayv1alpha2.AddToScheme(scheme))

if c.EnableLeaderElection {
setupLog.V(0).Info("the --leader-elect flag is deprecated and no longer has any effect: leader election is set based on the Kong database setting")
}

setupLog.Info("getting enabled options and features")
featureGates, err := setupFeatureGates(setupLog, c)
if err != nil {
Expand Down

0 comments on commit a71c15d

Please sign in to comment.