mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-16 17:33:14 +00:00
Simplify gvk, speed up cluster-scoped checks.
This commit is contained in:
@@ -87,12 +87,7 @@ func (r *Resource) GetBinaryDataMap() map[string]string {
|
||||
}
|
||||
|
||||
func (r *Resource) GetGvk() resid.Gvk {
|
||||
meta, err := r.node.GetMeta()
|
||||
if err != nil {
|
||||
return resid.GvkFromString("")
|
||||
}
|
||||
g, v := resid.ParseGroupVersion(meta.APIVersion)
|
||||
return resid.Gvk{Group: g, Version: v, Kind: meta.Kind}
|
||||
return resid.GvkFromNode(r.node)
|
||||
}
|
||||
|
||||
func (r *Resource) Hash(h ifc.KustHasher) (string, error) {
|
||||
|
||||
@@ -87,11 +87,13 @@ func TestResourceId(t *testing.T) {
|
||||
{
|
||||
in: testConfigMap,
|
||||
id: resid.NewResIdWithNamespace(
|
||||
resid.Gvk{Version: "v1", Kind: "ConfigMap"}, "winnie", "hundred-acre-wood"),
|
||||
resid.NewGvk("", "v1", "ConfigMap"),
|
||||
"winnie", "hundred-acre-wood"),
|
||||
},
|
||||
{
|
||||
in: testDeployment,
|
||||
id: resid.NewResId(resid.Gvk{Group: "apps", Version: "v1", Kind: "Deployment"}, "pooh"),
|
||||
id: resid.NewResId(
|
||||
resid.NewGvk("apps", "v1", "Deployment"), "pooh"),
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
|
||||
Reference in New Issue
Block a user