mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-10-31 13:50:01 +00:00 
			
		
		
		
	kubeadm: Add local copy of LeaseEndpointReconcilerType
kubeadm uses LeaseEndpointReconcilerType as import from k8s.io/kubernetes/pkg/master/reconcilers. However, this pull a huge load of extra dependencies (among which pkg/client/clientset_generated/internalclientset). The solution is to copy this string constant locally in kubeadm. Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
This commit is contained in:
		| @@ -255,6 +255,11 @@ const ( | ||||
| 	KubeAuditPolicyLogVolumeName = "audit-log" | ||||
| 	// StaticPodAuditPolicyLogDir is the name of the directory in the static pod that will have the audit logs | ||||
| 	StaticPodAuditPolicyLogDir = "/var/log/kubernetes/audit" | ||||
|  | ||||
| 	// LeaseEndpointReconcilerType will select a storage based reconciler | ||||
| 	// Copied from pkg/master/reconcilers to avoid pulling extra dependencies | ||||
| 	// TODO: Import this constant from a consts only package, that does not pull any further dependencies. | ||||
| 	LeaseEndpointReconcilerType = "lease" | ||||
| ) | ||||
|  | ||||
| var ( | ||||
|   | ||||
| @@ -19,7 +19,6 @@ go_test( | ||||
|         "//cmd/kubeadm/app/features:go_default_library", | ||||
|         "//cmd/kubeadm/app/phases/certs:go_default_library", | ||||
|         "//cmd/kubeadm/test:go_default_library", | ||||
|         "//pkg/master/reconcilers:go_default_library", | ||||
|         "//pkg/util/pointer:go_default_library", | ||||
|         "//pkg/util/version:go_default_library", | ||||
|         "//vendor/k8s.io/api/core/v1:go_default_library", | ||||
| @@ -43,7 +42,6 @@ go_library( | ||||
|         "//cmd/kubeadm/app/util:go_default_library", | ||||
|         "//cmd/kubeadm/app/util/staticpod:go_default_library", | ||||
|         "//pkg/kubeapiserver/authorizer/modes:go_default_library", | ||||
|         "//pkg/master/reconcilers:go_default_library", | ||||
|         "//pkg/util/version:go_default_library", | ||||
|         "//vendor/github.com/golang/glog:go_default_library", | ||||
|         "//vendor/k8s.io/api/core/v1:go_default_library", | ||||
|   | ||||
| @@ -37,7 +37,6 @@ import ( | ||||
| 	kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util" | ||||
| 	staticpodutil "k8s.io/kubernetes/cmd/kubeadm/app/util/staticpod" | ||||
| 	authzmodes "k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes" | ||||
| 	"k8s.io/kubernetes/pkg/master/reconcilers" | ||||
| 	"k8s.io/kubernetes/pkg/util/version" | ||||
| ) | ||||
|  | ||||
| @@ -202,7 +201,7 @@ func getAPIServerCommand(cfg *kubeadmapi.MasterConfiguration) []string { | ||||
| 	} | ||||
|  | ||||
| 	if features.Enabled(cfg.FeatureGates, features.HighAvailability) { | ||||
| 		defaultArguments["endpoint-reconciler-type"] = reconcilers.LeaseEndpointReconcilerType | ||||
| 		defaultArguments["endpoint-reconciler-type"] = kubeadmconstants.LeaseEndpointReconcilerType | ||||
| 	} | ||||
|  | ||||
| 	if features.Enabled(cfg.FeatureGates, features.DynamicKubeletConfig) { | ||||
|   | ||||
| @@ -28,7 +28,6 @@ import ( | ||||
| 	kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants" | ||||
| 	"k8s.io/kubernetes/cmd/kubeadm/app/features" | ||||
| 	"k8s.io/kubernetes/cmd/kubeadm/app/phases/certs" | ||||
| 	"k8s.io/kubernetes/pkg/master/reconcilers" | ||||
| 	"k8s.io/kubernetes/pkg/util/version" | ||||
|  | ||||
| 	testutil "k8s.io/kubernetes/cmd/kubeadm/test" | ||||
| @@ -335,7 +334,7 @@ func TestGetAPIServerCommand(t *testing.T) { | ||||
| 				"--etcd-cafile=fuz", | ||||
| 				"--etcd-certfile=fiz", | ||||
| 				"--etcd-keyfile=faz", | ||||
| 				fmt.Sprintf("--endpoint-reconciler-type=%s", reconcilers.LeaseEndpointReconcilerType), | ||||
| 				fmt.Sprintf("--endpoint-reconciler-type=%s", kubeadmconstants.LeaseEndpointReconcilerType), | ||||
| 			}, | ||||
| 		}, | ||||
| 		{ | ||||
| @@ -412,7 +411,7 @@ func TestGetAPIServerCommand(t *testing.T) { | ||||
| 				"--etcd-cafile=" + testCertsDir + "/etcd/ca.crt", | ||||
| 				"--etcd-certfile=" + testCertsDir + "/apiserver-etcd-client.crt", | ||||
| 				"--etcd-keyfile=" + testCertsDir + "/apiserver-etcd-client.key", | ||||
| 				fmt.Sprintf("--endpoint-reconciler-type=%s", reconcilers.LeaseEndpointReconcilerType), | ||||
| 				fmt.Sprintf("--endpoint-reconciler-type=%s", kubeadmconstants.LeaseEndpointReconcilerType), | ||||
| 				"--audit-policy-file=/etc/kubernetes/audit/audit.yaml", | ||||
| 				"--audit-log-path=/var/log/kubernetes/audit/audit.log", | ||||
| 				"--audit-log-maxage=0", | ||||
|   | ||||
		Reference in New Issue
	
	Block a user