pacoxu / kubeadm-operator

Test work on the design of kubeadm operator. Also you can try https://github.com/chendave/kubeadm-operator
Apache License 2.0
10 stars 2 forks source link

stop kubelet and replace it #61

Closed github-actions[bot] closed 2 years ago

github-actions[bot] commented 2 years ago

stop kubelet and replace it

https://github.com/pacoxu/kubeadm-operator/blob/d3fd73b1ef67fd14c457572a28d690c19f86e4bd/commands/upgrade_kubectlkubelet.go#L67

    log.Info(fmt.Sprintf("%s", strings.Join(start, "\n")))

    err = wait.Poll(100*time.Millisecond, 300*time.Second, func() (bool, error) {
        if err := DownloadFromOfficialWebsite(spec.KubernetesVersion, "kubelet", "/usr/bin/kubelet-"+spec.KubernetesVersion, log); err != nil {
            log.Error(err, "Failed to download kubectl and kubelet")
            return false, nil
        }
        return true, nil
    })
    if err != nil {
        return err
    }

    // TODO stop kubelet and replace it
    cmd = newCmd("/usr/bin/cp", "-f", "/usr/bin/kubelet-"+spec.KubernetesVersion, "/usr/bin/kubelet")
    start, err = cmd.RunAndCapture()
    if err != nil {
        // skip kubelet replacement
        cmd = newCmd("/usr/bin/cp", "-f", "/usr/bin/kubelet-"+spec.KubernetesVersion, "/usr/bin/kubelet-new")
        start, err = cmd.RunAndCapture()
        if err != nil {
        }
        // return errors.WithStack(errors.WithMessage(err, strings.Join(start, "\n")))
    } else {
        log.Info(fmt.Sprintf("%s", strings.Join(start, "\n")))
    }

    return nil
}
ndex b8b2857..d318a17 100644
++ b/controllers/util.go

f4083d2bd92078351a43cadc9cd230c9af8d5497

github-actions[bot] commented 2 years ago

Closed in 4357f8f10c8a37f4ab286abb32248ddc00da156a