1
0
mirror of https://github.com/rancher/rke.git synced 2025-08-31 14:36:32 +00:00

1. enable cri-dockerd when the cluster version >= 1.24 AND the option enable_cri_dockerd is not configured; 2. drop the flag --address when the cluster version >= 1.24 in the DinD case

This commit is contained in:
Jiaqi Luo
2022-06-28 17:17:27 -07:00
parent 1ad5292ae9
commit 9f5ecdb801
3 changed files with 59 additions and 6 deletions

View File

@@ -249,6 +249,12 @@ func (c *Cluster) setClusterDefaults(ctx context.Context, flags ExternalFlags) e
c.ForceDeployCerts = true
}
// enable cri-dockerd for k8s >= 1.24
err = c.setCRIDockerd()
if err != nil {
return err
}
err = c.setClusterDNSDefaults()
if err != nil {
return err
@@ -288,6 +294,22 @@ func (c *Cluster) setNodeUpgradeStrategy() {
}
}
// setCRIDockerd set enable_cri_dockerd = true when the following two conditions are met:
//the cluster's version is at least 1.24 and the option enable_cri_dockerd is not configured
func (c *Cluster) setCRIDockerd() error {
parsedVersion, err := getClusterVersion(c.Version)
if err != nil {
return err
}
if parsedRangeAtLeast124(parsedVersion) {
if c.EnableCRIDockerd == nil {
enable := true
c.EnableCRIDockerd = &enable
}
}
return nil
}
func (c *Cluster) setClusterServicesDefaults() {
// We don't accept per service images anymore.
c.Services.KubeAPI.Image = c.SystemImages.Kubernetes