mirror of https://github.com/kubernetes/kops.git
Merge pull request #8196 from justinsb/dont_preload_unused_images
For dev, don't preload docker images on nodes
This commit is contained in:
commit
e4da659509
|
|
@ -55,6 +55,15 @@ func (t *ProtokubeBuilder) Build(c *fi.ModelBuilderContext) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if protokubeImage := t.NodeupConfig.ProtokubeImage; protokubeImage != nil {
|
||||||
|
c.AddTask(&nodetasks.LoadImageTask{
|
||||||
|
Name: "protokube",
|
||||||
|
Sources: protokubeImage.Sources,
|
||||||
|
Hash: protokubeImage.Hash,
|
||||||
|
Runtime: t.Cluster.Spec.ContainerRuntime,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if t.IsMaster {
|
if t.IsMaster {
|
||||||
kubeconfig, err := t.BuildPKIKubeconfig("kops")
|
kubeconfig, err := t.BuildPKIKubeconfig("kops")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -481,13 +481,6 @@ Resources.AWSAutoScalingLaunchConfigurationnodesadditionalcidrexamplecom.Propert
|
||||||
- _aws
|
- _aws
|
||||||
channels:
|
channels:
|
||||||
- memfs://clusters.example.com/additionalcidr.example.com/addons/bootstrap-channel.yaml
|
- memfs://clusters.example.com/additionalcidr.example.com/addons/bootstrap-channel.yaml
|
||||||
protokubeImage:
|
|
||||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
|
||||||
name: protokube:1.15.0
|
|
||||||
sources:
|
|
||||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
- https://github.com/kubernetes/kops/releases/download/1.15.0/images-protokube.tar.gz
|
|
||||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
|
|
||||||
__EOF_KUBE_ENV
|
__EOF_KUBE_ENV
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -510,13 +510,6 @@ Resources.AWSAutoScalingLaunchConfigurationnodesadditionaluserdataexamplecom.Pro
|
||||||
- _aws
|
- _aws
|
||||||
channels:
|
channels:
|
||||||
- memfs://clusters.example.com/additionaluserdata.example.com/addons/bootstrap-channel.yaml
|
- memfs://clusters.example.com/additionaluserdata.example.com/addons/bootstrap-channel.yaml
|
||||||
protokubeImage:
|
|
||||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
|
||||||
name: protokube:1.15.0
|
|
||||||
sources:
|
|
||||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
- https://github.com/kubernetes/kops/releases/download/1.15.0/images-protokube.tar.gz
|
|
||||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
|
|
||||||
__EOF_KUBE_ENV
|
__EOF_KUBE_ENV
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -483,13 +483,6 @@ Resources.AWSAutoScalingLaunchConfigurationnodescomplexexamplecom.Properties.Use
|
||||||
- _aws
|
- _aws
|
||||||
channels:
|
channels:
|
||||||
- memfs://clusters.example.com/complex.example.com/addons/bootstrap-channel.yaml
|
- memfs://clusters.example.com/complex.example.com/addons/bootstrap-channel.yaml
|
||||||
protokubeImage:
|
|
||||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
|
||||||
name: protokube:1.15.0
|
|
||||||
sources:
|
|
||||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
- https://github.com/kubernetes/kops/releases/download/1.15.0/images-protokube.tar.gz
|
|
||||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
|
|
||||||
__EOF_KUBE_ENV
|
__EOF_KUBE_ENV
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -469,13 +469,6 @@ Resources.AWSAutoScalingLaunchConfigurationnodescontainerdexamplecom.Properties.
|
||||||
- _aws
|
- _aws
|
||||||
channels:
|
channels:
|
||||||
- memfs://clusters.example.com/containerd.example.com/addons/bootstrap-channel.yaml
|
- memfs://clusters.example.com/containerd.example.com/addons/bootstrap-channel.yaml
|
||||||
protokubeImage:
|
|
||||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
|
||||||
name: protokube:1.15.0
|
|
||||||
sources:
|
|
||||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
- https://github.com/kubernetes/kops/releases/download/1.15.0/images-protokube.tar.gz
|
|
||||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
|
|
||||||
__EOF_KUBE_ENV
|
__EOF_KUBE_ENV
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -481,13 +481,6 @@ Resources.AWSAutoScalingLaunchConfigurationnodesminimalexamplecom.Properties.Use
|
||||||
- _aws
|
- _aws
|
||||||
channels:
|
channels:
|
||||||
- memfs://clusters.example.com/minimal.example.com/addons/bootstrap-channel.yaml
|
- memfs://clusters.example.com/minimal.example.com/addons/bootstrap-channel.yaml
|
||||||
protokubeImage:
|
|
||||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
|
||||||
name: protokube:1.15.0
|
|
||||||
sources:
|
|
||||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
- https://github.com/kubernetes/kops/releases/download/1.15.0/images-protokube.tar.gz
|
|
||||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
|
|
||||||
__EOF_KUBE_ENV
|
__EOF_KUBE_ENV
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -481,13 +481,6 @@ Resources.AWSAutoScalingLaunchConfigurationnodesexternallbexamplecom.Properties.
|
||||||
- _aws
|
- _aws
|
||||||
channels:
|
channels:
|
||||||
- memfs://clusters.example.com/externallb.example.com/addons/bootstrap-channel.yaml
|
- memfs://clusters.example.com/externallb.example.com/addons/bootstrap-channel.yaml
|
||||||
protokubeImage:
|
|
||||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
|
||||||
name: protokube:1.15.0
|
|
||||||
sources:
|
|
||||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
- https://github.com/kubernetes/kops/releases/download/1.15.0/images-protokube.tar.gz
|
|
||||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
|
|
||||||
__EOF_KUBE_ENV
|
__EOF_KUBE_ENV
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -481,13 +481,6 @@ Resources.AWSAutoScalingLaunchConfigurationnodesminimalexamplecom.Properties.Use
|
||||||
- _aws
|
- _aws
|
||||||
channels:
|
channels:
|
||||||
- memfs://clusters.example.com/minimal.example.com/addons/bootstrap-channel.yaml
|
- memfs://clusters.example.com/minimal.example.com/addons/bootstrap-channel.yaml
|
||||||
protokubeImage:
|
|
||||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
|
||||||
name: protokube:1.15.0
|
|
||||||
sources:
|
|
||||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
- https://github.com/kubernetes/kops/releases/download/1.15.0/images-protokube.tar.gz
|
|
||||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
|
|
||||||
__EOF_KUBE_ENV
|
__EOF_KUBE_ENV
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1068,13 +1068,6 @@ Resources.AWSEC2LaunchTemplatenodesmixedinstancesexamplecom.Properties.LaunchTem
|
||||||
- _aws
|
- _aws
|
||||||
channels:
|
channels:
|
||||||
- memfs://clusters.example.com/mixedinstances.example.com/addons/bootstrap-channel.yaml
|
- memfs://clusters.example.com/mixedinstances.example.com/addons/bootstrap-channel.yaml
|
||||||
protokubeImage:
|
|
||||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
|
||||||
name: protokube:1.15.0
|
|
||||||
sources:
|
|
||||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
- https://github.com/kubernetes/kops/releases/download/1.15.0/images-protokube.tar.gz
|
|
||||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
|
|
||||||
__EOF_KUBE_ENV
|
__EOF_KUBE_ENV
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1068,13 +1068,6 @@ Resources.AWSEC2LaunchTemplatenodesmixedinstancesexamplecom.Properties.LaunchTem
|
||||||
- _aws
|
- _aws
|
||||||
channels:
|
channels:
|
||||||
- memfs://clusters.example.com/mixedinstances.example.com/addons/bootstrap-channel.yaml
|
- memfs://clusters.example.com/mixedinstances.example.com/addons/bootstrap-channel.yaml
|
||||||
protokubeImage:
|
|
||||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
|
||||||
name: protokube:1.15.0
|
|
||||||
sources:
|
|
||||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
- https://github.com/kubernetes/kops/releases/download/1.15.0/images-protokube.tar.gz
|
|
||||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
|
|
||||||
__EOF_KUBE_ENV
|
__EOF_KUBE_ENV
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -478,13 +478,6 @@ Resources.AWSAutoScalingLaunchConfigurationnodesprivatecalicoexamplecom.Properti
|
||||||
- _aws
|
- _aws
|
||||||
channels:
|
channels:
|
||||||
- memfs://clusters.example.com/privatecalico.example.com/addons/bootstrap-channel.yaml
|
- memfs://clusters.example.com/privatecalico.example.com/addons/bootstrap-channel.yaml
|
||||||
protokubeImage:
|
|
||||||
hash: 42a9c4324fe26d63ce11f3dd7836371bc93fa06ca8f479807728f3746e27061b
|
|
||||||
name: protokube:1.15.0
|
|
||||||
sources:
|
|
||||||
- https://artifacts.k8s.io/binaries/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
- https://github.com/kubernetes/kops/releases/download/1.15.0/images-protokube.tar.gz
|
|
||||||
- https://kubeupv2.s3.amazonaws.com/kops/1.15.0/images/protokube.tar.gz
|
|
||||||
|
|
||||||
__EOF_KUBE_ENV
|
__EOF_KUBE_ENV
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1298,12 +1298,15 @@ func (c *ApplyClusterCmd) BuildNodeUpConfig(assetBuilder *assets.AssetBuilder, i
|
||||||
config.ConfigBase = fi.String(configBase.Path())
|
config.ConfigBase = fi.String(configBase.Path())
|
||||||
config.InstanceGroupName = ig.ObjectMeta.Name
|
config.InstanceGroupName = ig.ObjectMeta.Name
|
||||||
|
|
||||||
|
useGossip := dns.IsGossipHostname(cluster.Spec.MasterInternalName)
|
||||||
|
isMaster := role == kops.InstanceGroupRoleMaster
|
||||||
|
|
||||||
var images []*nodeup.Image
|
var images []*nodeup.Image
|
||||||
|
|
||||||
if components.IsBaseURL(cluster.Spec.KubernetesVersion) {
|
if components.IsBaseURL(cluster.Spec.KubernetesVersion) {
|
||||||
// When using a custom version, we want to preload the images over http
|
// When using a custom version, we want to preload the images over http
|
||||||
components := []string{"kube-proxy"}
|
components := []string{"kube-proxy"}
|
||||||
if role == kops.InstanceGroupRoleMaster {
|
if isMaster {
|
||||||
components = append(components, "kube-apiserver", "kube-controller-manager", "kube-scheduler")
|
components = append(components, "kube-apiserver", "kube-controller-manager", "kube-scheduler")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1330,7 +1333,7 @@ func (c *ApplyClusterCmd) BuildNodeUpConfig(assetBuilder *assets.AssetBuilder, i
|
||||||
|
|
||||||
// `docker load` our images when using a KOPS_BASE_URL, so we
|
// `docker load` our images when using a KOPS_BASE_URL, so we
|
||||||
// don't need to push/pull from a registry
|
// don't need to push/pull from a registry
|
||||||
if os.Getenv("KOPS_BASE_URL") != "" {
|
if os.Getenv("KOPS_BASE_URL") != "" && isMaster {
|
||||||
for _, name := range []string{"kops-controller", "dns-controller"} {
|
for _, name := range []string{"kops-controller", "dns-controller"} {
|
||||||
baseURL, err := url.Parse(os.Getenv("KOPS_BASE_URL"))
|
baseURL, err := url.Parse(os.Getenv("KOPS_BASE_URL"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -1352,7 +1355,7 @@ func (c *ApplyClusterCmd) BuildNodeUpConfig(assetBuilder *assets.AssetBuilder, i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
if isMaster || useGossip {
|
||||||
u, hash, err := ProtokubeImageSource(assetBuilder)
|
u, hash, err := ProtokubeImageSource(assetBuilder)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
|
|
@ -301,13 +301,7 @@ func (c *NodeUpCommand) Run(out io.Writer) error {
|
||||||
Runtime: c.cluster.Spec.ContainerRuntime,
|
Runtime: c.cluster.Spec.ContainerRuntime,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if c.config.ProtokubeImage != nil {
|
// Protokube load image task is in ProtokubeBuilder
|
||||||
taskMap["LoadImage.protokube"] = &nodetasks.LoadImageTask{
|
|
||||||
Sources: c.config.ProtokubeImage.Sources,
|
|
||||||
Hash: c.config.ProtokubeImage.Hash,
|
|
||||||
Runtime: c.cluster.Spec.ContainerRuntime,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var cloud fi.Cloud
|
var cloud fi.Cloud
|
||||||
var keyStore fi.Keystore
|
var keyStore fi.Keystore
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ const (
|
||||||
|
|
||||||
// LoadImageTask is responsible for downloading a docker image
|
// LoadImageTask is responsible for downloading a docker image
|
||||||
type LoadImageTask struct {
|
type LoadImageTask struct {
|
||||||
|
Name string
|
||||||
Sources []string
|
Sources []string
|
||||||
Hash string
|
Hash string
|
||||||
Runtime string
|
Runtime string
|
||||||
|
|
@ -64,6 +65,19 @@ func (t *LoadImageTask) GetDependencies(tasks map[string]fi.Task) []fi.Task {
|
||||||
return deps
|
return deps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ fi.HasName = &LoadImageTask{}
|
||||||
|
|
||||||
|
func (t *LoadImageTask) GetName() *string {
|
||||||
|
if t.Name == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &t.Name
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *LoadImageTask) SetName(name string) {
|
||||||
|
klog.Fatalf("SetName not supported for LoadImageTask")
|
||||||
|
}
|
||||||
|
|
||||||
func (t *LoadImageTask) String() string {
|
func (t *LoadImageTask) String() string {
|
||||||
return fmt.Sprintf("LoadImageTask: %v", t.Sources)
|
return fmt.Sprintf("LoadImageTask: %v", t.Sources)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue