Skip to content

Commit

Permalink
Remove discovery.ResourceMapper (#1101)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha committed Jan 6, 2024
1 parent a1d475c commit 87c402a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 0 additions & 4 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
core_util "kmodules.xyz/client-go/core/v1"
"kmodules.xyz/client-go/discovery"
"kmodules.xyz/client-go/tools/queue"
appcat_cs "kmodules.xyz/custom-resources/client/clientset/versioned"
appcat_in "kmodules.xyz/custom-resources/client/informers/externalversions"
Expand All @@ -61,9 +60,6 @@ type Controller struct {
AppCatalogClient appcat_cs.Interface
// Cluster topology when the operator started
ClusterTopology *core_util.Topology
// RESTMapper allows clients to map resources to kind, and map kind and version
// to interfaces for manipulating those objects.
Mapper discovery.ResourceMapper
// Event Recorder
Recorder record.EventRecorder
// Audit Event Publisher
Expand Down
5 changes: 3 additions & 2 deletions pkg/controller/initializer/stash/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,12 @@ func (c *Controller) extractDatabaseInfo(ri *restoreInfo) error {
}
ri.do.Name = owner.Name

gvr, err := c.Mapper.GVR(schema.FromAPIVersionAndKind(owner.APIVersion, owner.Kind))
gvk := schema.FromAPIVersionAndKind(owner.APIVersion, owner.Kind)
mapping, err := c.KBClient.RESTMapper().RESTMapping(gvk.GroupKind(), gvk.Version)
if err != nil {
return err
}
ri.do.GVR = gvr
ri.do.GVR = mapping.Resource

return nil
}
Expand Down

0 comments on commit 87c402a

Please sign in to comment.