mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 13:45:06 +00:00
Remove ObjectNameFunc from custom resources
Signed-off-by: Monis Khan <mkhan@redhat.com>
This commit is contained in:
@@ -17,7 +17,6 @@ limitations under the License.
|
|||||||
package customresource
|
package customresource
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/apimachinery/pkg/api/meta"
|
|
||||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
@@ -41,13 +40,6 @@ func NewREST(resource schema.GroupResource, listKind schema.GroupVersionKind, co
|
|||||||
ret.SetGroupVersionKind(listKind)
|
ret.SetGroupVersionKind(listKind)
|
||||||
return ret
|
return ret
|
||||||
},
|
},
|
||||||
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
|
||||||
accessor, err := meta.Accessor(obj)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
return accessor.GetName(), nil
|
|
||||||
},
|
|
||||||
PredicateFunc: strategy.MatchCustomResourceDefinitionStorage,
|
PredicateFunc: strategy.MatchCustomResourceDefinitionStorage,
|
||||||
QualifiedResource: resource,
|
QualifiedResource: resource,
|
||||||
|
|
||||||
|
@@ -38,9 +38,6 @@ func NewREST(scheme *runtime.Scheme, optsGetter generic.RESTOptionsGetter) *REST
|
|||||||
Copier: scheme,
|
Copier: scheme,
|
||||||
NewFunc: func() runtime.Object { return &apiextensions.CustomResourceDefinition{} },
|
NewFunc: func() runtime.Object { return &apiextensions.CustomResourceDefinition{} },
|
||||||
NewListFunc: func() runtime.Object { return &apiextensions.CustomResourceDefinitionList{} },
|
NewListFunc: func() runtime.Object { return &apiextensions.CustomResourceDefinitionList{} },
|
||||||
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
|
||||||
return obj.(*apiextensions.CustomResourceDefinition).Name, nil
|
|
||||||
},
|
|
||||||
PredicateFunc: MatchCustomResourceDefinition,
|
PredicateFunc: MatchCustomResourceDefinition,
|
||||||
QualifiedResource: apiextensions.Resource("customresourcedefinitions"),
|
QualifiedResource: apiextensions.Resource("customresourcedefinitions"),
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user