@@ -88,7 +88,7 @@ func (a *Applier) Initialize() error {
8888// calculates the set of objects to be pruned (pruneIds), and orders the
8989// resources for the subsequent apply. Returns the sorted resources to
9090// apply as well as the objects for the prune, or an error if one occurred.
91- func (a * Applier ) prepareObjects (localInv * unstructured. Unstructured , localObjs []* unstructured.Unstructured ) (* ResourceObjects , error ) {
91+ func (a * Applier ) prepareObjects (localInv inventory. InventoryInfo , localObjs []* unstructured.Unstructured ) (* ResourceObjects , error ) {
9292 if localInv == nil {
9393 return nil , fmt .Errorf ("the local inventory can't be nil" )
9494 }
@@ -125,7 +125,7 @@ func (a *Applier) prepareObjects(localInv *unstructured.Unstructured, localObjs
125125// will be applied and the existing inventories used to determine
126126// resources that should be pruned.
127127type ResourceObjects struct {
128- LocalInv * unstructured. Unstructured
128+ LocalInv inventory. InventoryInfo
129129 Resources []* unstructured.Unstructured
130130 PruneIds []object.ObjMetadata
131131}
@@ -138,7 +138,7 @@ func (r *ResourceObjects) ObjsForApply() []*unstructured.Unstructured {
138138}
139139
140140// Inventory returns the unstructured representation of the inventory object.
141- func (r * ResourceObjects ) Inventory () * unstructured. Unstructured {
141+ func (r * ResourceObjects ) Inventory () inventory. InventoryInfo {
142142 return r .LocalInv
143143}
144144
@@ -172,7 +172,7 @@ func (r *ResourceObjects) AllIds() []object.ObjMetadata {
172172// before all the given resources have been applied to the cluster. Any
173173// cancellation or timeout will only affect how long we Wait for the
174174// resources to become current.
175- func (a * Applier ) Run (ctx context.Context , inventory * unstructured. Unstructured , objects []* unstructured.Unstructured , options Options ) <- chan event.Event {
175+ func (a * Applier ) Run (ctx context.Context , invInfo inventory. InventoryInfo , objects []* unstructured.Unstructured , options Options ) <- chan event.Event {
176176 eventChannel := make (chan event.Event )
177177 setDefaults (& options )
178178 a .invClient .SetDryRunStrategy (options .DryRunStrategy ) // client shared with prune, so sets dry-run for prune too.
@@ -182,13 +182,13 @@ func (a *Applier) Run(ctx context.Context, inventory *unstructured.Unstructured,
182182 // This provides us with a slice of all the objects that will be
183183 // applied to the cluster. This takes care of ordering resources
184184 // and handling the inventory object.
185- resourceObjects , err := a .prepareObjects (inventory , objects )
185+ resourceObjects , err := a .prepareObjects (invInfo , objects )
186186 if err != nil {
187187 handleError (eventChannel , err )
188188 return
189189 }
190190
191- mapper , err := a .provider .ToRESTMapper ()
191+ mapper , err := a .provider .Factory (). ToRESTMapper ()
192192 if err != nil {
193193 handleError (eventChannel , err )
194194 return
@@ -300,12 +300,11 @@ func handleError(eventChannel chan event.Event, err error) {
300300// inventoryNamespaceInSet returns the the namespace the passed inventory
301301// object will be applied to, or nil if this namespace object does not exist
302302// in the passed slice "infos" or the inventory object is cluster-scoped.
303- func inventoryNamespaceInSet (inv * unstructured. Unstructured , objs []* unstructured.Unstructured ) * unstructured.Unstructured {
303+ func inventoryNamespaceInSet (inv inventory. InventoryInfo , objs []* unstructured.Unstructured ) * unstructured.Unstructured {
304304 if inv == nil {
305305 return nil
306306 }
307- invAcc , _ := meta .Accessor (inv )
308- invNamespace := invAcc .GetNamespace ()
307+ invNamespace := inv .Namespace ()
309308
310309 for _ , obj := range objs {
311310 acc , _ := meta .Accessor (obj )
0 commit comments