From 5a20c425f2ebdf4fb72def3d9330f98f60ce1e0a Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Fri, 4 Feb 2022 16:17:15 +0100 Subject: [PATCH] apiserver: use endpoint lease reconciler as default The apiserver owns and manages the kubernetes.default service. It has 3 different options to reconcile the endpoints that belong to that service: - None: endpoints are handled by an external party. - MasterCount: legacy, it reconciles based on the endpoints generated and a flag specifying the number of master on the cluster. - Lease: default since 1.11, each apiserver writes a lease in etcd and renews periodically, the endpoints are generated based on the existing leases. It seems that when the default was set for the lease reconciler, the controlplane code wasn't updated and kept using the master count reconciler. This also starts the deprecation of the master count reconciler in favor of the lease reconciler. --- cmd/kube-apiserver/app/options/options.go | 3 ++- pkg/controlplane/instance.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/kube-apiserver/app/options/options.go b/cmd/kube-apiserver/app/options/options.go index a3bf7ccdcf9..9672b18766a 100644 --- a/cmd/kube-apiserver/app/options/options.go +++ b/cmd/kube-apiserver/app/options/options.go @@ -177,9 +177,10 @@ func (s *ServerRunOptions) Flags() (fss cliflag.NamedFlagSets) { fs.IntVar(&s.MasterCount, "apiserver-count", s.MasterCount, "The number of apiservers running in the cluster, must be a positive number. (In use when --endpoint-reconciler-type=master-count is enabled.)") + fs.MarkDeprecated("apiserver-count", "apiserver-count is deprecated and will be removed in a future version.") fs.StringVar(&s.EndpointReconcilerType, "endpoint-reconciler-type", string(s.EndpointReconcilerType), - "Use an endpoint reconciler ("+strings.Join(reconcilers.AllTypes.Names(), ", ")+")") + "Use an endpoint reconciler ("+strings.Join(reconcilers.AllTypes.Names(), ", ")+") master-count is deprecated, and will be removed in a future version.") fs.IntVar(&s.IdentityLeaseDurationSeconds, "identity-lease-duration-seconds", s.IdentityLeaseDurationSeconds, "The duration of kube-apiserver lease in seconds, must be a positive number. (In use when the APIServerIdentity feature gate is enabled.)") diff --git a/pkg/controlplane/instance.go b/pkg/controlplane/instance.go index 424cd0ce54b..6426038e3b2 100644 --- a/pkg/controlplane/instance.go +++ b/pkg/controlplane/instance.go @@ -274,9 +274,9 @@ func (c *Config) createEndpointReconciler() reconcilers.EndpointReconciler { klog.Infof("Using reconciler: %v", c.ExtraConfig.EndpointReconcilerType) switch c.ExtraConfig.EndpointReconcilerType { // there are numerous test dependencies that depend on a default controller - case "", reconcilers.MasterCountReconcilerType: + case reconcilers.MasterCountReconcilerType: return c.createMasterCountReconciler() - case reconcilers.LeaseEndpointReconcilerType: + case "", reconcilers.LeaseEndpointReconcilerType: return c.createLeaseReconciler() case reconcilers.NoneEndpointReconcilerType: return c.createNoneReconciler()