mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 18:28:13 +00:00 
			
		
		
		
	Merge pull request #109074 from neolit123/1.24-kubeadm-etcd-add-corruption-check
kubeadm: add etcd flag for member data consistency
This commit is contained in:
		| @@ -220,22 +220,25 @@ func getEtcdCommand(cfg *kubeadmapi.ClusterConfiguration, endpoint *kubeadmapi.A | ||||
| 		etcdLocalhostAddress = "::1" | ||||
| 	} | ||||
| 	defaultArguments := map[string]string{ | ||||
| 		"name":                        nodeName, | ||||
| 		"listen-client-urls":          fmt.Sprintf("%s,%s", etcdutil.GetClientURLByIP(etcdLocalhostAddress), etcdutil.GetClientURL(endpoint)), | ||||
| 		"advertise-client-urls":       etcdutil.GetClientURL(endpoint), | ||||
| 		"listen-peer-urls":            etcdutil.GetPeerURL(endpoint), | ||||
| 		"initial-advertise-peer-urls": etcdutil.GetPeerURL(endpoint), | ||||
| 		"data-dir":                    cfg.Etcd.Local.DataDir, | ||||
| 		"cert-file":                   filepath.Join(cfg.CertificatesDir, kubeadmconstants.EtcdServerCertName), | ||||
| 		"key-file":                    filepath.Join(cfg.CertificatesDir, kubeadmconstants.EtcdServerKeyName), | ||||
| 		"trusted-ca-file":             filepath.Join(cfg.CertificatesDir, kubeadmconstants.EtcdCACertName), | ||||
| 		"client-cert-auth":            "true", | ||||
| 		"peer-cert-file":              filepath.Join(cfg.CertificatesDir, kubeadmconstants.EtcdPeerCertName), | ||||
| 		"peer-key-file":               filepath.Join(cfg.CertificatesDir, kubeadmconstants.EtcdPeerKeyName), | ||||
| 		"peer-trusted-ca-file":        filepath.Join(cfg.CertificatesDir, kubeadmconstants.EtcdCACertName), | ||||
| 		"peer-client-cert-auth":       "true", | ||||
| 		"snapshot-count":              "10000", | ||||
| 		"listen-metrics-urls":         fmt.Sprintf("http://%s", net.JoinHostPort(etcdLocalhostAddress, strconv.Itoa(kubeadmconstants.EtcdMetricsPort))), | ||||
| 		"name": nodeName, | ||||
| 		// TODO: start using --initial-corrupt-check once the graduated flag is available: | ||||
| 		// https://github.com/kubernetes/kubeadm/issues/2676 | ||||
| 		"experimental-initial-corrupt-check": "true", | ||||
| 		"listen-client-urls":                 fmt.Sprintf("%s,%s", etcdutil.GetClientURLByIP(etcdLocalhostAddress), etcdutil.GetClientURL(endpoint)), | ||||
| 		"advertise-client-urls":              etcdutil.GetClientURL(endpoint), | ||||
| 		"listen-peer-urls":                   etcdutil.GetPeerURL(endpoint), | ||||
| 		"initial-advertise-peer-urls":        etcdutil.GetPeerURL(endpoint), | ||||
| 		"data-dir":                           cfg.Etcd.Local.DataDir, | ||||
| 		"cert-file":                          filepath.Join(cfg.CertificatesDir, kubeadmconstants.EtcdServerCertName), | ||||
| 		"key-file":                           filepath.Join(cfg.CertificatesDir, kubeadmconstants.EtcdServerKeyName), | ||||
| 		"trusted-ca-file":                    filepath.Join(cfg.CertificatesDir, kubeadmconstants.EtcdCACertName), | ||||
| 		"client-cert-auth":                   "true", | ||||
| 		"peer-cert-file":                     filepath.Join(cfg.CertificatesDir, kubeadmconstants.EtcdPeerCertName), | ||||
| 		"peer-key-file":                      filepath.Join(cfg.CertificatesDir, kubeadmconstants.EtcdPeerKeyName), | ||||
| 		"peer-trusted-ca-file":               filepath.Join(cfg.CertificatesDir, kubeadmconstants.EtcdCACertName), | ||||
| 		"peer-client-cert-auth":              "true", | ||||
| 		"snapshot-count":                     "10000", | ||||
| 		"listen-metrics-urls":                fmt.Sprintf("http://%s", net.JoinHostPort(etcdLocalhostAddress, strconv.Itoa(kubeadmconstants.EtcdMetricsPort))), | ||||
| 	} | ||||
|  | ||||
| 	if len(initialCluster) == 0 { | ||||
|   | ||||
| @@ -176,6 +176,7 @@ func TestGetEtcdCommand(t *testing.T) { | ||||
| 			expected: []string{ | ||||
| 				"etcd", | ||||
| 				"--name=foo", | ||||
| 				"--experimental-initial-corrupt-check=true", | ||||
| 				fmt.Sprintf("--listen-client-urls=https://127.0.0.1:%d,https://1.2.3.4:%d", kubeadmconstants.EtcdListenClientPort, kubeadmconstants.EtcdListenClientPort), | ||||
| 				fmt.Sprintf("--listen-metrics-urls=http://127.0.0.1:%d", kubeadmconstants.EtcdMetricsPort), | ||||
| 				fmt.Sprintf("--advertise-client-urls=https://1.2.3.4:%d", kubeadmconstants.EtcdListenClientPort), | ||||
| @@ -205,6 +206,7 @@ func TestGetEtcdCommand(t *testing.T) { | ||||
| 			expected: []string{ | ||||
| 				"etcd", | ||||
| 				"--name=foo", | ||||
| 				"--experimental-initial-corrupt-check=true", | ||||
| 				fmt.Sprintf("--listen-client-urls=https://127.0.0.1:%d,https://1.2.3.4:%d", kubeadmconstants.EtcdListenClientPort, kubeadmconstants.EtcdListenClientPort), | ||||
| 				fmt.Sprintf("--listen-metrics-urls=http://127.0.0.1:%d", kubeadmconstants.EtcdMetricsPort), | ||||
| 				fmt.Sprintf("--advertise-client-urls=https://1.2.3.4:%d", kubeadmconstants.EtcdListenClientPort), | ||||
| @@ -235,6 +237,7 @@ func TestGetEtcdCommand(t *testing.T) { | ||||
| 			expected: []string{ | ||||
| 				"etcd", | ||||
| 				"--name=bar", | ||||
| 				"--experimental-initial-corrupt-check=true", | ||||
| 				"--listen-client-urls=https://10.0.1.10:2379", | ||||
| 				fmt.Sprintf("--listen-metrics-urls=http://127.0.0.1:%d", kubeadmconstants.EtcdMetricsPort), | ||||
| 				"--advertise-client-urls=https://10.0.1.10:2379", | ||||
| @@ -260,6 +263,7 @@ func TestGetEtcdCommand(t *testing.T) { | ||||
| 			expected: []string{ | ||||
| 				"etcd", | ||||
| 				"--name=foo", | ||||
| 				"--experimental-initial-corrupt-check=true", | ||||
| 				fmt.Sprintf("--listen-client-urls=https://[::1]:%d,https://[2001:db8::3]:%d", kubeadmconstants.EtcdListenClientPort, kubeadmconstants.EtcdListenClientPort), | ||||
| 				fmt.Sprintf("--listen-metrics-urls=http://[::1]:%d", kubeadmconstants.EtcdMetricsPort), | ||||
| 				fmt.Sprintf("--advertise-client-urls=https://[2001:db8::3]:%d", kubeadmconstants.EtcdListenClientPort), | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Prow Robot
					Kubernetes Prow Robot