mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
kubeadm: skip disabled addons in clusterconfig on upgrade
If an addon is disabled in the ClusterConfiguration skip it on upgrade in the repsective subphase of 'addons'.
This commit is contained in:
parent
826f0910e4
commit
6fba589914
@ -83,13 +83,20 @@ func getInitData(c workflow.RunData) (*kubeadmapi.InitConfiguration, clientset.I
|
|||||||
|
|
||||||
// runCoreDNSAddon upgrades the CoreDNS addon.
|
// runCoreDNSAddon upgrades the CoreDNS addon.
|
||||||
func runCoreDNSAddon(c workflow.RunData) error {
|
func runCoreDNSAddon(c workflow.RunData) error {
|
||||||
|
const skipMessagePrefix = "[upgrade/addon] Skipping the addon/coredns phase."
|
||||||
|
|
||||||
cfg, client, patchesDir, out, dryRun, isControlPlaneNode, err := getInitData(c)
|
cfg, client, patchesDir, out, dryRun, isControlPlaneNode, err := getInitData(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isControlPlaneNode {
|
if !isControlPlaneNode {
|
||||||
fmt.Println("[upgrade/addon] Skipping addon/coredns phase. Not a control plane node.")
|
fmt.Fprintf(out, "%s Not a control plane node.\n", skipMessagePrefix)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if cfg.ClusterConfiguration.DNS.Disabled {
|
||||||
|
fmt.Fprintf(out, "%s The addon is disabled.\n", skipMessagePrefix)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,13 +117,20 @@ func runCoreDNSAddon(c workflow.RunData) error {
|
|||||||
|
|
||||||
// runKubeProxyAddon upgrades the kube-proxy addon.
|
// runKubeProxyAddon upgrades the kube-proxy addon.
|
||||||
func runKubeProxyAddon(c workflow.RunData) error {
|
func runKubeProxyAddon(c workflow.RunData) error {
|
||||||
|
const skipMessagePrefix = "[upgrade/addon] Skipping the addon/kube-proxy phase."
|
||||||
|
|
||||||
cfg, client, _, out, dryRun, isControlPlaneNode, err := getInitData(c)
|
cfg, client, _, out, dryRun, isControlPlaneNode, err := getInitData(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isControlPlaneNode {
|
if !isControlPlaneNode {
|
||||||
fmt.Println("[upgrade/addon] Skipping addon/kube-proxy phase. Not a control plane node.")
|
fmt.Fprintf(out, "%s Not a control plane node.\n", skipMessagePrefix)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if cfg.ClusterConfiguration.Proxy.Disabled {
|
||||||
|
fmt.Fprintf(out, "%s The addon is disabled.\n", skipMessagePrefix)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user