diff --git a/armometadata/k8sutils.go b/armometadata/k8sutils.go index 1020006..4754a47 100644 --- a/armometadata/k8sutils.go +++ b/armometadata/k8sutils.go @@ -154,14 +154,14 @@ func ExtractMetadataFromJsonBytes(input []byte) (Metadata, error) { case m.ApiVersion == "security.istio.io/v1" && strings.HasPrefix(jsonPath, "spec.selector.matchLabels."): m.PodSelectorMatchLabels[unquote(key)] = unquote(value) case m.ApiVersion == "projectcalico.org/v3" && jsonPath == "spec.selector": - m.PodSelectorMatchLabels = parseCalicoSelector(value) + m.PodSelectorMatchLabels = ParseCalicoSelector(value) } return true }) return m, err } -func parseCalicoSelector(value []byte) map[string]string { +func ParseCalicoSelector(value []byte) map[string]string { selector := map[string]string{} for _, rule := range strings.Split(unquote(value), "&&") { s := strings.Split(rule, "==") diff --git a/armometadata/k8sutils_test.go b/armometadata/k8sutils_test.go index 1f80d8d..870f24e 100644 --- a/armometadata/k8sutils_test.go +++ b/armometadata/k8sutils_test.go @@ -311,7 +311,7 @@ func Test_parseCalicoSelector(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - assert.Equalf(t, tt.want, parseCalicoSelector(tt.value), "parseCalicoSelector(%v)", tt.value) + assert.Equalf(t, tt.want, ParseCalicoSelector(tt.value), "ParseCalicoSelector(%v)", tt.value) }) } }