diff --git a/instanceidhandler/v1/instanceidhandler.go b/instanceidhandler/v1/instanceidhandler.go index 62080dd..a693671 100644 --- a/instanceidhandler/v1/instanceidhandler.go +++ b/instanceidhandler/v1/instanceidhandler.go @@ -6,7 +6,6 @@ import ( "fmt" "github.com/kubescape/k8s-interface/instanceidhandler" - "github.com/kubescape/k8s-interface/k8sinterface" "github.com/kubescape/k8s-interface/names" ) @@ -120,10 +119,8 @@ func (id *InstanceID) GetHashed() string { } func (id *InstanceID) GetLabels() map[string]string { - group, version := k8sinterface.SplitApiVersion(id.GetAPIVersion()) return map[string]string{ - ApiGroupMetadataKey: group, - ApiVersionMetadataKey: version, + ApiVersionMetadataKey: id.GetAPIVersion(), NamespaceMetadataKey: id.GetNamespace(), KindMetadataKey: id.GetKind(), NameMetadataKey: id.GetName(), diff --git a/instanceidhandler/v1/instanceidhandler_test.go b/instanceidhandler/v1/instanceidhandler_test.go index fa90b37..7fc2461 100644 --- a/instanceidhandler/v1/instanceidhandler_test.go +++ b/instanceidhandler/v1/instanceidhandler_test.go @@ -107,8 +107,7 @@ func TestInstanceID(t *testing.T) { t.Errorf("can't create instance ID from service") } expectedLabels := map[string]string{ - ApiGroupMetadataKey: "apps", - ApiVersionMetadataKey: "v1", + ApiVersionMetadataKey: "apps/v1", NamespaceMetadataKey: "default", KindMetadataKey: "ReplicaSet", NameMetadataKey: "nginx-84f5585d68", @@ -121,8 +120,7 @@ func TestInstanceID(t *testing.T) { } expectedLabels = map[string]string{ - ApiGroupMetadataKey: "batch", - ApiVersionMetadataKey: "v1", + ApiVersionMetadataKey: "batch/v1", NamespaceMetadataKey: "default", KindMetadataKey: "Job", NameMetadataKey: "nginx-job", @@ -134,7 +132,6 @@ func TestInstanceID(t *testing.T) { } expectedLabels = map[string]string{ - ApiGroupMetadataKey: "", ApiVersionMetadataKey: "v1", NamespaceMetadataKey: "default", KindMetadataKey: "Pod",