Skip to content

Commit 598dcb3

Browse files
Merge pull request #8874 from smarterclayton/release-1.2
Release v1.2.0 branch
2 parents 061e6d4 + 15d78cb commit 598dcb3

File tree

9 files changed

+220
-25
lines changed

9 files changed

+220
-25
lines changed

Godeps/_workspace/src/k8s.io/kubernetes/pkg/registry/horizontalpodautoscaler/strategy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Godeps/_workspace/src/k8s.io/kubernetes/pkg/registry/persistentvolume/strategy.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Godeps/_workspace/src/k8s.io/kubernetes/pkg/registry/persistentvolumeclaim/strategy.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Godeps/_workspace/src/k8s.io/kubernetes/pkg/storage/cacher.go

Lines changed: 47 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Godeps/_workspace/src/k8s.io/kubernetes/pkg/storage/cacher_test.go

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/image/importer/importer.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func importImages(ctx gocontext.Context, retriever RepositoryRetriever, isi *api
173173
}
174174
for _, index := range tags[j] {
175175
if tag.Err != nil {
176-
setImageImportStatus(isi, index, tag.Err)
176+
setImageImportStatus(isi, index, tag.Name, tag.Err)
177177
continue
178178
}
179179
copied := *tag.Image
@@ -194,7 +194,7 @@ func importImages(ctx gocontext.Context, retriever RepositoryRetriever, isi *api
194194
}
195195
for _, index := range ids[j] {
196196
if digest.Err != nil {
197-
setImageImportStatus(isi, index, digest.Err)
197+
setImageImportStatus(isi, index, "", digest.Err)
198198
continue
199199
}
200200
image := &isi.Status.Images[index]
@@ -267,6 +267,7 @@ func importFromRepository(ctx gocontext.Context, retriever RepositoryRetriever,
267267
status.Status.Status = unversioned.StatusSuccess
268268
status.Images = make([]api.ImageImportStatus, len(repo.Tags))
269269
for i, tag := range repo.Tags {
270+
status.Images[i].Tag = tag.Name
270271
if tag.Err != nil {
271272
failures++
272273
status.Images[i].Status = imageImportStatus(tag.Err, "", "repository")
@@ -277,7 +278,6 @@ func importFromRepository(ctx gocontext.Context, retriever RepositoryRetriever,
277278
copied := *tag.Image
278279
ref.Tag, ref.ID = tag.Name, copied.Name
279280
copied.DockerImageReference = ref.MostSpecific().Exact()
280-
status.Images[i].Tag = tag.Name
281281
status.Images[i].Image = &copied
282282
}
283283
if failures > 0 {
@@ -598,7 +598,8 @@ func imageImportStatus(err error, kind, position string) unversioned.Status {
598598
}
599599
}
600600

601-
func setImageImportStatus(images *api.ImageStreamImport, i int, err error) {
601+
func setImageImportStatus(images *api.ImageStreamImport, i int, tag string, err error) {
602+
images.Status.Images[i].Tag = tag
602603
images.Status.Images[i].Status = imageImportStatus(err, "", "")
603604
}
604605

pkg/image/importer/importer_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ func TestImport(t *testing.T) {
149149
if status := isi.Status.Images[3].Status; status.Status != "" {
150150
t.Errorf("unexpected status: %#v", isi.Status.Images[3].Status)
151151
}
152+
expectedTags := []string{"latest", "", "", ""}
153+
for i, image := range isi.Status.Images {
154+
if image.Tag != expectedTags[i] {
155+
t.Errorf("unexpected tag of status %d (%s != %s)", i, image.Tag, expectedTags[i])
156+
}
157+
}
152158
},
153159
},
154160
{
@@ -186,6 +192,7 @@ func TestImport(t *testing.T) {
186192
if len(isi.Status.Images) != 2 {
187193
t.Errorf("unexpected number of images: %#v", isi.Status.Repository.Images)
188194
}
195+
expectedTags := []string{"", "tag"}
189196
for i, image := range isi.Status.Images {
190197
if image.Status.Status != unversioned.StatusSuccess {
191198
t.Errorf("unexpected status %d: %#v", i, image.Status)
@@ -198,6 +205,9 @@ func TestImport(t *testing.T) {
198205
if image.Image.DockerImageReference != "test@sha256:958608f8ecc1dc62c93b6c610f3a834dae4220c9642e6e8b4e0f2b3ad7cbd238" {
199206
t.Errorf("unexpected ref %d: %#v", i, image.Image.DockerImageReference)
200207
}
208+
if image.Tag != expectedTags[i] {
209+
t.Errorf("unexpected tag of status %d (%s != %s)", i, image.Tag, expectedTags[i])
210+
}
201211
}
202212
},
203213
},
@@ -222,10 +232,14 @@ func TestImport(t *testing.T) {
222232
if len(isi.Status.Repository.Images) != 5 {
223233
t.Errorf("unexpected number of images: %#v", isi.Status.Repository.Images)
224234
}
235+
expectedTags := []string{"3", "v2", "v1", "3.1", "abc"}
225236
for i, image := range isi.Status.Repository.Images {
226237
if image.Status.Status != unversioned.StatusFailure || image.Status.Message != "Internal error occurred: no such tag" {
227238
t.Errorf("unexpected status %d: %#v", i, isi.Status.Repository.Images)
228239
}
240+
if image.Tag != expectedTags[i] {
241+
t.Errorf("unexpected tag of status %d (%s != %s)", i, image.Tag, expectedTags[i])
242+
}
229243
}
230244
},
231245
},

pkg/image/registry/imagestreamimport/rest.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ func (r *REST) Create(ctx kapi.Context, obj runtime.Object) (runtime.Object, err
177177

178178
if spec := isi.Spec.Repository; spec != nil {
179179
for i, status := range isi.Status.Repository.Images {
180+
if checkImportFailure(status, stream, status.Tag, nextGeneration, now) {
181+
continue
182+
}
183+
180184
image := status.Image
181185
ref, err := api.ParseDockerImageReference(image.DockerImageReference)
182186
if err != nil {
@@ -196,10 +200,6 @@ func (r *REST) Create(ctx kapi.Context, obj runtime.Object) (runtime.Object, err
196200
// we've imported a set of tags, ensure spec tag will point to this for later imports
197201
from.ID, from.Tag = "", tag
198202

199-
if checkImportFailure(status, stream, tag, nextGeneration, now) {
200-
continue
201-
}
202-
203203
if updated, ok := r.importSuccessful(ctx, image, stream, tag, from.Exact(), nextGeneration, now, spec.ImportPolicy, importedImages, updatedImages); ok {
204204
isi.Status.Repository.Images[i].Image = updated
205205
}
@@ -278,6 +278,17 @@ func checkImportFailure(status api.ImageImportStatus, stream *api.ImageStream, t
278278

279279
LastTransitionTime: now,
280280
}
281+
282+
if tag == "" {
283+
if len(status.Tag) > 0 {
284+
tag = status.Tag
285+
} else if status.Image != nil {
286+
if ref, err := api.ParseDockerImageReference(status.Image.DockerImageReference); err == nil {
287+
tag = ref.Tag
288+
}
289+
}
290+
}
291+
281292
if !api.HasTagCondition(stream, tag, condition) {
282293
api.SetTagConditions(stream, tag, condition)
283294
if tagRef, ok := stream.Spec.Tags[tag]; ok {

0 commit comments

Comments
 (0)