@@ -21,6 +21,7 @@ import (
2121
2222 "github.com/go-openapi/spec"
2323 "github.com/google/go-containerregistry/pkg/name"
24+ "k8s.io/apimachinery/pkg/types"
2425 "sigs.k8s.io/kustomize/kyaml/fieldmeta"
2526 "sigs.k8s.io/kustomize/kyaml/kio"
2627 "sigs.k8s.io/kustomize/kyaml/kio/kioutil"
@@ -88,7 +89,7 @@ func UpdateWithSetters(inpath, outpath string, policies []imagev1alpha1_reflect.
8889
8990 var settersSchema spec.Schema
9091 var setters []* setters2.Set
91- setterToImage := make (map [string ]name. Reference )
92+ setterToImage := make (map [string ]imageRef )
9293
9394 // collect setter defs and setters by going through all the image
9495 // policies available.
@@ -104,10 +105,18 @@ func UpdateWithSetters(inpath, outpath string, policies []imagev1alpha1_reflect.
104105 // being `latest` if empty in the input; but I'm assuming here
105106 // that the policy won't have a tagless ref.
106107 image := policy .Status .LatestImage
107- ref , err := name .ParseReference (image , name .WeakValidation )
108+ r , err := name .ParseReference (image , name .WeakValidation )
108109 if err != nil {
109110 return Result {}, fmt .Errorf ("encountered invalid image ref %q: %w" , policy .Status .LatestImage , err )
110111 }
112+ ref := imageRef {
113+ Reference : r ,
114+ policy : types.NamespacedName {
115+ Name : policy .Name ,
116+ Namespace : policy .Namespace ,
117+ },
118+ }
119+
111120 tag := ref .Identifier ()
112121 // annoyingly, neither the library imported above, nor an
113122 // alternative, I found will yield the original image name;
@@ -181,7 +190,7 @@ type setAllRecorder struct {
181190 updates []update
182191}
183192
184- func (s * setAllRecorder ) getResult (nameToImage map [string ]name. Reference ) Result {
193+ func (s * setAllRecorder ) getResult (nameToImage map [string ]imageRef ) Result {
185194 result := Result {
186195 Files : make (map [string ]FileResult ),
187196 }
@@ -202,12 +211,11 @@ updates:
202211 }
203212 id := ObjectIdentifier {meta .GetIdentifier ()}
204213
205- name , ok := nameToImage [update .name ]
214+ ref , ok := nameToImage [update .name ]
206215 if ! ok { // this means an update was made that wasn't recorded as being an image
207216 continue updates
208217 }
209218 // if the name and tag of an image are both used, we don't need to record it twice
210- ref := imageRef {name }
211219 for _ , n := range objects [id ] {
212220 if n == ref {
213221 continue updates
0 commit comments