@@ -102,7 +102,7 @@ func NewImagesCommand() *cobra.Command {
102102 }
103103
104104 // TODO(k8s-1.36): remove this when k8s 1.36 lands
105- injectedLines := injectNewImages (ref , ! o .Upstream )
105+ injectedLines := injectNewImages (ref , ! o .Upstream , lines )
106106 for _ , line := range injectedLines {
107107 fmt .Fprintln (os .Stdout , line )
108108 }
@@ -301,24 +301,35 @@ func setLogLevel(level string) error {
301301}
302302
303303// TODO(k8s-1.36): remove this when k8s 1.36 lands
304- func injectNewImages (ref reference.DockerImageReference , mirrored bool ) []string {
304+ func injectNewImages (ref reference.DockerImageReference , mirrored bool , existingLines [] string ) []string {
305305 target := ref .Exact ()
306306
307307 images := map [string ]string {
308- // glibc-dns-testing:2.0.0 replaces jessie-dnsutils:1.7 in k8s 1.36,
309- // but the tests binary still references the old name
310- "registry.k8s.io/e2e-test-images/glibc-dns-testing:2.0.0" : "e2e-11-registry-k8s-io-e2e-test-images-glibc-dns-testing-2-0-0-doWtNeL-8jnuqU8E" ,
308+ // jessie-dnsutils is going away, but is still used in some tests until all 1.36 merges have completed
309+ "registry.k8s.io/e2e-test-images/jessie-dnsutils:1.7" : "e2e-11-registry-k8s-io-e2e-test-images-jessie-dnsutils-1-7-bJ-yvCS2MUBlnXm1" ,
310+ // appears to have changed indices
311+ "registry.k8s.io/e2e-test-images/nginx:1.14-4" : "e2e-15-registry-k8s-io-e2e-test-images-nginx-1-14-4-20h7A1tgJp0m0c1_" ,
312+ }
313+
314+ existingTargets := sets .NewString ()
315+ for _ , line := range existingLines {
316+ parts := strings .Fields (line )
317+ if len (parts ) >= 2 {
318+ existingTargets .Insert (parts [1 ])
319+ }
311320 }
312321
313322 lines := []string {}
314323 for originalImage , mirrorTag := range images {
324+ dest := fmt .Sprintf ("%s:%s" , target , mirrorTag )
325+ if existingTargets .Has (dest ) {
326+ continue
327+ }
315328 if mirrored {
316- lines = append (lines , fmt .Sprintf ("%s:%s %s:%s" ,
317- imagesetup .DefaultTestImageMirrorLocation , mirrorTag ,
318- target , mirrorTag ))
329+ lines = append (lines , fmt .Sprintf ("%s:%s %s" ,
330+ imagesetup .DefaultTestImageMirrorLocation , mirrorTag , dest ))
319331 } else {
320- lines = append (lines , fmt .Sprintf ("%s %s:%s" ,
321- originalImage , target , mirrorTag ))
332+ lines = append (lines , fmt .Sprintf ("%s %s" , originalImage , dest ))
322333 }
323334 }
324335 sort .Strings (lines )
0 commit comments