mirror of
https://github.com/rancher/rke.git
synced 2025-08-29 11:43:07 +00:00
Kubernetes system image takes precedence over cluster kubernetes version
This commit is contained in:
parent
14c239c598
commit
2eda9fe990
@ -3,7 +3,6 @@ package cluster
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
ref "github.com/docker/distribution/reference"
|
|
||||||
"github.com/rancher/rke/log"
|
"github.com/rancher/rke/log"
|
||||||
"github.com/rancher/rke/services"
|
"github.com/rancher/rke/services"
|
||||||
"github.com/rancher/types/apis/management.cattle.io/v3"
|
"github.com/rancher/types/apis/management.cattle.io/v3"
|
||||||
@ -85,26 +84,10 @@ func (c *Cluster) setClusterDefaults(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.setClusterImageDefaults()
|
c.setClusterImageDefaults()
|
||||||
c.setClusterKubernetesImageVersion(ctx)
|
|
||||||
c.setClusterServicesDefaults()
|
c.setClusterServicesDefaults()
|
||||||
c.setClusterNetworkDefaults()
|
c.setClusterNetworkDefaults()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cluster) setClusterKubernetesImageVersion(ctx context.Context) {
|
|
||||||
k8sImageNamed, _ := ref.ParseNormalizedNamed(c.SystemImages.Kubernetes)
|
|
||||||
// Kubernetes image is already set by c.setClusterImageDefaults(),
|
|
||||||
// I will override it here if Version is set.
|
|
||||||
var VersionedImageNamed ref.NamedTagged
|
|
||||||
if c.Version != "" {
|
|
||||||
VersionedImageNamed, _ = ref.WithTag(ref.TrimNamed(k8sImageNamed), c.Version)
|
|
||||||
c.SystemImages.Kubernetes = VersionedImageNamed.String()
|
|
||||||
}
|
|
||||||
normalizedSystemImage, _ := ref.ParseNormalizedNamed(c.SystemImages.Kubernetes)
|
|
||||||
if normalizedSystemImage.String() != k8sImageNamed.String() {
|
|
||||||
log.Infof(ctx, "Overrding Kubernetes image [%s] with tag [%s]", VersionedImageNamed.Name(), VersionedImageNamed.Tag())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Cluster) setClusterServicesDefaults() {
|
func (c *Cluster) setClusterServicesDefaults() {
|
||||||
serviceConfigDefaultsMap := map[*string]string{
|
serviceConfigDefaultsMap := map[*string]string{
|
||||||
&c.Services.KubeAPI.ServiceClusterIPRange: DefaultServiceClusterIPRange,
|
&c.Services.KubeAPI.ServiceClusterIPRange: DefaultServiceClusterIPRange,
|
||||||
|
Loading…
Reference in New Issue
Block a user