mirror of https://github.com/k3s-io/k3s
Merge pull request #37524 from vwfs/skip_etcd_checks_reset
Automatic merge from submit-queue (batch tested with PRs 36263, 36755, 37357, 37222, 37524) kubeadm: Skip etcd related preflight checks and reset actions for external etcd **What this PR does / why we need it**: Skip etcd related preflight checks and reset actions for external etcd **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # https://github.com/kubernetes/kubeadm/issues/69#issuecomment-262988388 **Special notes for your reviewer**: **Release note**: <!-- Steps to write your release note: 1. Use the release-note-* labels to set the release note state (if you have access) 2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. --> ```release-note kubeadm: Skip etcd related preflight checks and reset actions for external etcd ```pull/6/head
commit
51458a0ef0
|
@ -136,9 +136,16 @@ func (r *Reset) Run(out io.Writer) error {
|
|||
fmt.Printf("failed to unmount directories in /var/lib/kubelet, %s", string(umountOutputBytes))
|
||||
}
|
||||
|
||||
dirsToClean := []string{"/var/lib/kubelet"}
|
||||
|
||||
// Only clear etcd data when the etcd manifest is found. In case it is not found, we must assume that the user
|
||||
// provided external etcd endpoints. In that case, it is his own responsibility to reset etcd
|
||||
if _, err := os.Stat("/etc/kubernetes/manifests/etcd.json"); os.IsNotExist(err) {
|
||||
dirsToClean = append(dirsToClean, "/var/lib/etcd")
|
||||
}
|
||||
|
||||
resetConfigDir("/etc/kubernetes/")
|
||||
|
||||
dirsToClean := []string{"/var/lib/kubelet", "/var/lib/etcd"}
|
||||
fmt.Printf("Deleting contents of stateful directories: %v\n", dirsToClean)
|
||||
for _, dir := range dirsToClean {
|
||||
cleanDir(dir)
|
||||
|
|
|
@ -240,7 +240,6 @@ func RunInitMasterChecks(cfg *kubeadmapi.MasterConfiguration) error {
|
|||
ServiceCheck{Service: "kubelet"},
|
||||
ServiceCheck{Service: "docker"},
|
||||
PortOpenCheck{port: int(cfg.API.BindPort)},
|
||||
PortOpenCheck{port: 2379},
|
||||
PortOpenCheck{port: 8080},
|
||||
PortOpenCheck{port: int(cfg.Discovery.BindPort)},
|
||||
PortOpenCheck{port: 10250},
|
||||
|
@ -249,7 +248,6 @@ func RunInitMasterChecks(cfg *kubeadmapi.MasterConfiguration) error {
|
|||
HttpProxyCheck{Proto: "https", Host: cfg.API.AdvertiseAddresses[0], Port: int(cfg.API.BindPort)},
|
||||
DirAvailableCheck{Path: "/etc/kubernetes/manifests"},
|
||||
DirAvailableCheck{Path: "/etc/kubernetes/pki"},
|
||||
DirAvailableCheck{Path: "/var/lib/etcd"},
|
||||
DirAvailableCheck{Path: "/var/lib/kubelet"},
|
||||
FileAvailableCheck{Path: "/etc/kubernetes/admin.conf"},
|
||||
FileAvailableCheck{Path: "/etc/kubernetes/kubelet.conf"},
|
||||
|
@ -264,6 +262,14 @@ func RunInitMasterChecks(cfg *kubeadmapi.MasterConfiguration) error {
|
|||
InPathCheck{executable: "touch", mandatory: false},
|
||||
}
|
||||
|
||||
if len(cfg.Etcd.Endpoints) == 0 {
|
||||
// Only do etcd related checks when no external endpoints were specified
|
||||
checks = append(checks,
|
||||
PortOpenCheck{port: 2379},
|
||||
DirAvailableCheck{Path: "/var/lib/etcd"},
|
||||
)
|
||||
}
|
||||
|
||||
return runChecks(checks, os.Stderr)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue