From 4e9298cd99fcf151e8a798a9970edd90c8791351 Mon Sep 17 00:00:00 2001 From: Yifan Gu Date: Thu, 16 Jun 2016 15:36:24 -0700 Subject: [PATCH] rkt: Map kubelet's `--stage1-image` flag to rkt's `--stage1-name` flag. This enables rkt to use cached stage1 image instead of unpacking the stage1 image every time for every pod. After this change, users need to preload the stage1 images in order to enable rkt to find the stage1 image with the name specified by this flag. --- cluster/gce/coreos/master-docker.yaml | 2 -- pkg/kubelet/rkt/rkt.go | 2 +- pkg/kubelet/rkt/rkt_test.go | 6 +++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cluster/gce/coreos/master-docker.yaml b/cluster/gce/coreos/master-docker.yaml index 67240950185..27f9a35366e 100644 --- a/cluster/gce/coreos/master-docker.yaml +++ b/cluster/gce/coreos/master-docker.yaml @@ -122,8 +122,6 @@ coreos: --cluster-domain=${DNS_DOMAIN} \ --logtostderr=true \ --container-runtime=docker \ - --rkt-path=/opt/rkt/rkt \ - --rkt-stage1-image=/opt/rkt/stage1-coreos.aci \ --configure-cbr0=${KUBERNETES_CONFIGURE_CBR0} \ --pod-cidr=${MASTER_IP_RANGE} \ --register-schedulable=false \ diff --git a/pkg/kubelet/rkt/rkt.go b/pkg/kubelet/rkt/rkt.go index e41f091710c..31350127a32 100644 --- a/pkg/kubelet/rkt/rkt.go +++ b/pkg/kubelet/rkt/rkt.go @@ -1028,7 +1028,7 @@ func (r *Runtime) preparePodArgs(manifest *appcschema.PodManifest, manifestFileN // 3) empty; whatever rkt's compiled to default to stage1ImageCmd := "" if r.config.Stage1Image != "" { - stage1ImageCmd = "--stage1-path=" + r.config.Stage1Image + stage1ImageCmd = "--stage1-name=" + r.config.Stage1Image } if stage1Name, ok := manifest.Annotations.Get(k8sRktStage1NameAnno); ok { stage1ImageCmd = "--stage1-name=" + stage1Name diff --git a/pkg/kubelet/rkt/rkt_test.go b/pkg/kubelet/rkt/rkt_test.go index c814029c94f..cdc90c0ba10 100644 --- a/pkg/kubelet/rkt/rkt_test.go +++ b/pkg/kubelet/rkt/rkt_test.go @@ -1832,15 +1832,15 @@ func TestPreparePodArgs(t *testing.T) { }, }, }, - "stage1-path", + "stage1-image0", []string{"prepare", "--quiet", "--pod-manifest", "file", "--stage1-name=stage1-image"}, }, { appcschema.PodManifest{ Annotations: appctypes.Annotations{}, }, - "stage1-path", - []string{"prepare", "--quiet", "--pod-manifest", "file", "--stage1-path=stage1-path"}, + "stage1-image0", + []string{"prepare", "--quiet", "--pod-manifest", "file", "--stage1-name=stage1-image0"}, }, { appcschema.PodManifest{