From a46582bda20b225f19ef44d5c08b57c863f1bfd3 Mon Sep 17 00:00:00 2001 From: Shivam Sandbhor Date: Sat, 20 Nov 2021 11:01:56 +0530 Subject: [PATCH] Fix ImageStream tags in openshift provider mode (#1461) * Fix ImageStream tags in openshift provider mode Signed-off-by: Shivam Sandbhor --- pkg/transformer/openshift/openshift.go | 3 +-- .../change-in-volume/output-os-empty-vols-template.json | 4 ++-- .../fixtures/configmap-volume/output-os-withlabel.json | 4 ++-- script/test/fixtures/configmap-volume/output-os.json | 4 ++-- .../fixtures/deploy/placement/output-placement-os.json | 2 +- script/test/fixtures/expose/output-ocp.json | 4 ++-- .../test/fixtures/healthcheck/output-healthcheck-os.json | 8 ++++---- script/test/fixtures/multiple-files/output-ocp.json | 4 ++-- script/test/fixtures/multiple-type-volumes/output-os.json | 4 ++-- script/test/fixtures/pvc-request-size/output-os.json | 4 ++-- script/test/fixtures/statefulset/output-os.json | 4 ++-- script/test/fixtures/storage-class-name/output-os.json | 2 +- script/test/fixtures/v2/output-os.json | 2 +- script/test/fixtures/v3.0/output-os.json | 4 ++-- script/test/fixtures/volume-mounts/windows/output-os.json | 2 +- 15 files changed, 27 insertions(+), 28 deletions(-) diff --git a/pkg/transformer/openshift/openshift.go b/pkg/transformer/openshift/openshift.go index d39a3e2a..f47d33c5 100644 --- a/pkg/transformer/openshift/openshift.go +++ b/pkg/transformer/openshift/openshift.go @@ -56,9 +56,7 @@ func (o *OpenShift) initImageStream(name string, service kobject.ServiceConfig, if service.Image == "" { service.Image = name } - // Retrieve tags and image name for mapping - var importPolicy imageapi.TagImportPolicy if opt.InsecureRepository { importPolicy = imageapi.TagImportPolicy{Insecure: true} @@ -74,6 +72,7 @@ func (o *OpenShift) initImageStream(name string, service kobject.ServiceConfig, Name: service.Image, }, ImportPolicy: importPolicy, + Name: GetImageTag(service.Image), }) } diff --git a/script/test/fixtures/change-in-volume/output-os-empty-vols-template.json b/script/test/fixtures/change-in-volume/output-os-empty-vols-template.json index a4705424..4f56f904 100644 --- a/script/test/fixtures/change-in-volume/output-os-empty-vols-template.json +++ b/script/test/fixtures/change-in-volume/output-os-empty-vols-template.json @@ -143,7 +143,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", @@ -264,7 +264,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", diff --git a/script/test/fixtures/configmap-volume/output-os-withlabel.json b/script/test/fixtures/configmap-volume/output-os-withlabel.json index 67067d05..eb2a2aa5 100644 --- a/script/test/fixtures/configmap-volume/output-os-withlabel.json +++ b/script/test/fixtures/configmap-volume/output-os-withlabel.json @@ -109,7 +109,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", @@ -260,7 +260,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", diff --git a/script/test/fixtures/configmap-volume/output-os.json b/script/test/fixtures/configmap-volume/output-os.json index fc6f908e..18e5a2a9 100644 --- a/script/test/fixtures/configmap-volume/output-os.json +++ b/script/test/fixtures/configmap-volume/output-os.json @@ -106,7 +106,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", @@ -254,7 +254,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", diff --git a/script/test/fixtures/deploy/placement/output-placement-os.json b/script/test/fixtures/deploy/placement/output-placement-os.json index 1a12b827..ad75384e 100644 --- a/script/test/fixtures/deploy/placement/output-placement-os.json +++ b/script/test/fixtures/deploy/placement/output-placement-os.json @@ -170,7 +170,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", diff --git a/script/test/fixtures/expose/output-ocp.json b/script/test/fixtures/expose/output-ocp.json index b502b0bd..2a575204 100644 --- a/script/test/fixtures/expose/output-ocp.json +++ b/script/test/fixtures/expose/output-ocp.json @@ -145,7 +145,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", @@ -253,7 +253,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", diff --git a/script/test/fixtures/healthcheck/output-healthcheck-os.json b/script/test/fixtures/healthcheck/output-healthcheck-os.json index bc733936..7673fb3a 100644 --- a/script/test/fixtures/healthcheck/output-healthcheck-os.json +++ b/script/test/fixtures/healthcheck/output-healthcheck-os.json @@ -248,7 +248,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", @@ -376,7 +376,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", @@ -507,7 +507,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", @@ -638,7 +638,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", diff --git a/script/test/fixtures/multiple-files/output-ocp.json b/script/test/fixtures/multiple-files/output-ocp.json index e704ba6f..6b19f6da 100644 --- a/script/test/fixtures/multiple-files/output-ocp.json +++ b/script/test/fixtures/multiple-files/output-ocp.json @@ -84,7 +84,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", @@ -183,7 +183,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", diff --git a/script/test/fixtures/multiple-type-volumes/output-os.json b/script/test/fixtures/multiple-type-volumes/output-os.json index f2fcf529..6fc2b8d0 100644 --- a/script/test/fixtures/multiple-type-volumes/output-os.json +++ b/script/test/fixtures/multiple-type-volumes/output-os.json @@ -102,7 +102,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", @@ -258,7 +258,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", diff --git a/script/test/fixtures/pvc-request-size/output-os.json b/script/test/fixtures/pvc-request-size/output-os.json index 6defe69d..f2fa842e 100644 --- a/script/test/fixtures/pvc-request-size/output-os.json +++ b/script/test/fixtures/pvc-request-size/output-os.json @@ -180,7 +180,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", @@ -324,7 +324,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", diff --git a/script/test/fixtures/statefulset/output-os.json b/script/test/fixtures/statefulset/output-os.json index 0c40d367..39f16319 100644 --- a/script/test/fixtures/statefulset/output-os.json +++ b/script/test/fixtures/statefulset/output-os.json @@ -259,7 +259,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", @@ -481,7 +481,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", diff --git a/script/test/fixtures/storage-class-name/output-os.json b/script/test/fixtures/storage-class-name/output-os.json index 74c61c1a..e1d9f013 100644 --- a/script/test/fixtures/storage-class-name/output-os.json +++ b/script/test/fixtures/storage-class-name/output-os.json @@ -136,7 +136,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", diff --git a/script/test/fixtures/v2/output-os.json b/script/test/fixtures/v2/output-os.json index 9d06842e..6c3eac69 100644 --- a/script/test/fixtures/v2/output-os.json +++ b/script/test/fixtures/v2/output-os.json @@ -432,7 +432,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", diff --git a/script/test/fixtures/v3.0/output-os.json b/script/test/fixtures/v3.0/output-os.json index 6fca20db..aa4cffd0 100644 --- a/script/test/fixtures/v3.0/output-os.json +++ b/script/test/fixtures/v3.0/output-os.json @@ -121,7 +121,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", @@ -233,7 +233,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage", diff --git a/script/test/fixtures/volume-mounts/windows/output-os.json b/script/test/fixtures/volume-mounts/windows/output-os.json index 80953ff7..dd6892f5 100644 --- a/script/test/fixtures/volume-mounts/windows/output-os.json +++ b/script/test/fixtures/volume-mounts/windows/output-os.json @@ -130,7 +130,7 @@ }, "tags": [ { - "name": "", + "name": "latest", "annotations": null, "from": { "kind": "DockerImage",