Skip to content

Commit de1de0f

Browse files
committed
deprecation: Use NewDynamicRESTMapper instead of NewDiscoveryRESTMapper
NewDiscoveryRESTMapper has been removed from the latest controller-runtime. NewDynamicRESTMapper is preferred, and is available in older versions of controller-runtime also, so prefer that in all controller-runtime versions.
1 parent fa951b6 commit de1de0f

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

commonclient/restmapper_cr11.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ import (
1010
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
1111
)
1212

13-
// NewDiscoveryRESTMapper is a version-independent wrapper around apiutil.NewDiscoveryRESTMapper
13+
// NewDiscoveryRESTMapper is a version-independent wrapper around creating a meta.RESTMapper
14+
// It calls NewDynamicRESTMapper as of kubebuilder-declarative-pattern 0.17.
15+
// Deprecated: prefer NewDynamicRESTMapper
1416
func NewDiscoveryRESTMapper(c *rest.Config, httpClient *http.Client) (meta.RESTMapper, error) {
15-
return apiutil.NewDiscoveryRESTMapper(c)
17+
return NewDynamicRESTMapper(c)
18+
}
19+
20+
// NewDynamicRESTMapper is a version-independent wrapper around apiutil.NewDynamicRESTMapper
21+
func NewDynamicRESTMapper(c *rest.Config, httpClient *http.Client) (meta.RESTMapper, error) {
22+
return apiutil.NewDynamicRESTMapper(c)
1623
}

commonclient/restmapper_cr15.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ import (
1010
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
1111
)
1212

13-
// NewDiscoveryRESTMapper is a version-independent wrapper around apiutil.NewDiscoveryRESTMapper
13+
// NewDiscoveryRESTMapper is a version-independent wrapper around creating a meta.RESTMapper
14+
// It calls NewDynamicRESTMapper as of kubebuilder-declarative-pattern 0.17.
15+
// Deprecated: prefer NewDynamicRESTMapper
1416
func NewDiscoveryRESTMapper(c *rest.Config, httpClient *http.Client) (meta.RESTMapper, error) {
15-
return apiutil.NewDiscoveryRESTMapper(c, httpClient)
17+
return NewDynamicRESTMapper(c, httpClient)
18+
}
19+
20+
// NewDynamicRESTMapper is a version-independent wrapper around apiutil.NewDynamicRESTMapper
21+
func NewDynamicRESTMapper(c *rest.Config, httpClient *http.Client) (meta.RESTMapper, error) {
22+
return apiutil.NewDynamicRESTMapper(c, httpClient)
1623
}

0 commit comments

Comments
 (0)