// RunUpgradeNodeConfig is executed when `kubeadm upgrade node config` runs.
16946
func RunUpgradeNodeConfig(flags *nodeUpgradeFlags) error {
	if len(flags.kubeletVersionStr) == 0 {
		return errors.New("the --kubelet-version argument is required")
	}

	// Set up the kubelet directory to use. If dry-running, use a fake directory
	kubeletDir, err := upgrade.GetKubeletDir(flags.dryRun)
	if err != nil {
		return err
	}

	client, err := getClient(flags.kubeConfigPath, flags.dryRun)
	if err != nil {
		return errors.Wrapf(err, "couldn't create a Kubernetes client from file %q", flags.kubeConfigPath)
	}

	// Parse the desired kubelet version
	kubeletVersion, err := version.ParseSemantic(flags.kubeletVersionStr)
	if err != nil {
		return err
	}
	// TODO: Checkpoint the current configuration first so that if something goes wrong it can be recovered
	if err := kubeletphase.DownloadConfig(client, kubeletVersion, kubeletDir); err != nil {
		return err
	}

	// If we're dry-running, print the generated manifests, otherwise do nothing
	if err := printFilesIfDryRunning(flags.dryRun, kubeletDir); err != nil {
		return errors.Wrap(err, "error printing files on dryrun")
	}

	fmt.Println("[upgrade] The configuration for this node was successfully updated!")
	fmt.Println("[upgrade] Now you should go ahead and upgrade the kubelet package using your package manager.")
	return nil
}
1279837
func (v *KopsVersionSpec) IsUpgradeRequired(version semver.Version) (bool, error) {
	if v.RequiredVersion == "" {
		glog.V(2).Infof("VersionRecommendationSpec does not specify RequiredVersion")
		return false, nil
	}

	requiredVersion, err := semver.ParseTolerant(v.RequiredVersion)
	if err != nil {
		return false, fmt.Errorf("error parsing RequiredVersion %q from channel", v.RequiredVersion)
	}
	if requiredVersion.GT(version) {
		glog.V(2).Infof("RequiredVersion=%q, Have=%q.  Requiring upgrade", requiredVersion, version)
		return true, nil
	} else {
		glog.V(4).Infof("RequiredVersion=%q, Have=%q.  No upgrade needed.", requiredVersion, version)
	}
	return false, nil
}
1019499
func DryRunStaticPodUpgrade(internalcfg *kubeadmapi.InitConfiguration) error {

	dryRunManifestDir, err := constants.CreateTempDirForKubeadm("kubeadm-upgrade-dryrun")
	if err != nil {
		return err
	}
	defer os.RemoveAll(dryRunManifestDir)

	if err := controlplane.CreateInitStaticPodManifestFiles(dryRunManifestDir, internalcfg); err != nil {
		return err
	}

	// Print the contents of the upgraded manifests and pretend like they were in /etc/kubernetes/manifests
	files := []dryrunutil.FileToPrint{}
	for _, component := range constants.ControlPlaneComponents {
		realPath := constants.GetStaticPodFilepath(component, dryRunManifestDir)
		outputPath := constants.GetStaticPodFilepath(component, constants.GetStaticPodDirectory())
		files = append(files, dryrunutil.NewFileToPrint(realPath, outputPath))
	}

	return dryrunutil.PrintDryRunFiles(files, os.Stdout)
}
564246
func (s *UpgradeHistory) SetUpgradeName(v string) *UpgradeHistory {
	s.UpgradeName = &v
	return s
}
464849
func Convert_core_NodeConfigStatus_To_v1_NodeConfigStatus(in *core.NodeConfigStatus, out *v1.NodeConfigStatus, s conversion.Scope) error {
	return autoConvert_core_NodeConfigStatus_To_v1_NodeConfigStatus(in, out, s)
}
486549
func (cc *CCServer) SelfUpgrade(c context.Context, r *pb.SelfUpgradeMsg) (*pb.StatusMsg, error) {
	sm := &pb.StatusMsg{}
	sm.Status, sm.Msg = cc.cmdctrl.SelfUpgrade(r.Version, r.Bindiff, r.Checksum)
	return sm, nil
}
170954
func (s *CreateReplicationGroupInput) SetAutoMinorVersionUpgrade(v bool) *CreateReplicationGroupInput {
	s.AutoMinorVersionUpgrade = &v
	return s
}
350108
func (u *upgrader) PerformUpgrade() error {
	if err := u.populateAgents(); err != nil {
		return errors.Trace(err)
	}

	if err := u.ensureSystemdFiles(); err != nil {
		return errors.Trace(err)
	}

	return errors.Trace(u.ensureAgentBinaries())
}
380141
func (c *Client) ListUpgradePlansForServer(id string) (planIDs []int, err error) {
	if err := c.get(`server/upgrade_plan_list?SUBID=`+id, &planIDs); err != nil {
		return nil, err
	}
	return
}
1292964
func (mr *MockNodeAPIClientMockRecorder) NodeUpdate(ctx, nodeID, version, node interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NodeUpdate", reflect.TypeOf((*MockNodeAPIClient)(nil).NodeUpdate), ctx, nodeID, version, node)
}
503414
func (s *CreateReplicationInstanceInput) SetAutoMinorVersionUpgrade(v bool) *CreateReplicationInstanceInput {
	s.AutoMinorVersionUpgrade = &v
	return s
}
909978
func NewCmdUpgradeNodeConfig() *cobra.Command {
	flags := &nodeUpgradeFlags{
		kubeConfigPath:    constants.GetKubeletKubeConfigPath(),
		kubeletVersionStr: "",
		dryRun:            false,
	}

	cmd := &cobra.Command{
		Use:     "config",
		Short:   "Download the kubelet configuration from the cluster ConfigMap kubelet-config-1.X, where X is the minor version of the kubelet",
		Long:    upgradeNodeConfigLongDesc,
		Example: upgradeNodeConfigExample,
		Run: func(cmd *cobra.Command, args []string) {
			err := RunUpgradeNodeConfig(flags)
			kubeadmutil.CheckErr(err)
		},
	}

	options.AddKubeConfigFlag(cmd.Flags(), &flags.kubeConfigPath)
	cmd.Flags().BoolVar(&flags.dryRun, options.DryRun, flags.dryRun, "Do not change any state, just output the actions that would be performed.")
	cmd.Flags().StringVar(&flags.kubeletVersionStr, "kubelet-version", flags.kubeletVersionStr, "The *desired* version for the kubelet after the upgrade.")
	return cmd
}
137949
func (v *KubernetesVersionSpec) FindRecommendedUpgrade(version semver.Version) (*semver.Version, error) {
	if v.RecommendedVersion == "" {
		glog.V(2).Infof("VersionRecommendationSpec does not specify RecommendedVersion")
		return nil, nil
	}

	recommendedVersion, err := util.ParseKubernetesVersion(v.RecommendedVersion)
	if err != nil {
		return nil, fmt.Errorf("error parsing RecommendedVersion %q from channel", v.RecommendedVersion)
	}
	if recommendedVersion.GT(version) {
		glog.V(2).Infof("RecommendedVersion=%q, Have=%q.  Recommending upgrade", recommendedVersion, version)
		return recommendedVersion, nil
	} else {
		glog.V(4).Infof("RecommendedVersion=%q, Have=%q.  No upgrade needed.", recommendedVersion, version)
	}
	return nil, nil
}
1072306
func (nodeStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {
	newNode := obj.(*api.Node)
	oldNode := old.(*api.Node)
	newNode.Status = oldNode.Status

	if !utilfeature.DefaultFeatureGate.Enabled(features.DynamicKubeletConfig) && !nodeConfigSourceInUse(oldNode) {
		newNode.Spec.ConfigSource = nil
	}
}
242766
func PerformUpgrade(from version.Number, targets []Target, context Context) error {
	if hasStateTarget(targets) {
		ops := newStateUpgradeOpsIterator(from)
		if err := runUpgradeSteps(ops, targets, context.StateContext()); err != nil {
			return err
		}
	}
	ops := newUpgradeOpsIterator(from)
	if err := runUpgradeSteps(ops, targets, context.APIContext()); err != nil {
		return err
	}
	logger.Infof("All upgrade steps completed successfully")
	return nil
}
139242
func (s *UpdateApplicationInput) SetRunConfigurationUpdate(v *RunConfigurationUpdate) *UpdateApplicationInput {
	s.RunConfigurationUpdate = v
	return s
}
662833
func (s *CreateDBInstanceInput) SetAutoMinorVersionUpgrade(v bool) *CreateDBInstanceInput {
	s.AutoMinorVersionUpgrade = &v
	return s
}