Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

runKubeadmUpgradeNode: add real dry run support #46

Open
github-actions bot opened this issue May 24, 2022 · 0 comments
Open

runKubeadmUpgradeNode: add real dry run support #46

github-actions bot opened this issue May 24, 2022 · 0 comments
Labels

Comments

@github-actions
Copy link

add real dry run support

// TODO: add real dry run support

import (
	"fmt"
	"strings"

	"github.com/go-logr/logr"
	"github.com/pkg/errors"

	operatorv1 "k8s.io/kubeadm/operator/api/v1alpha1"
)

// "kubeadm upgrade node" on current node
func runKubeadmUpgradeNode(spec *operatorv1.KubeadmUpgradeNodeCommandSpec, log logr.Logger) error {
	var cmd *cmd

	// TODO: add real dry run support
	cmd = newCmd("kubeadm", "upgrade", "node", "--v=4")
	if spec.DryRun {
		cmd = newCmd("kubeadm", "upgrade", "node", "--dry-run", "--v=4")
	}

	lines, err := cmd.RunAndCapture()
	if err != nil {
		return errors.WithStack(errors.WithMessage(err, strings.Join(lines, "\n")))
	}

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

	return nil
}
ndex 4905de7..970466c 100644
++ b/commands/kubectl_drain.go

6fba2b34bb8f7decd1f9180da9619d2d9c241a87

@github-actions github-actions bot added the todo label May 24, 2022
@pacoxu pacoxu changed the title add real dry run support runKubeadmUpgradeNode: add real dry run support May 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

0 participants