From b39296c47e819cc828c807393b7e2ff001b10bb0 Mon Sep 17 00:00:00 2001 From: Kyle Rockman Date: Tue, 12 Aug 2025 15:22:40 -0400 Subject: [PATCH] Breaking change for unification --- .changes/unreleased/Refactor-20250812-152151.yaml | 3 +++ workers/k8s.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .changes/unreleased/Refactor-20250812-152151.yaml diff --git a/.changes/unreleased/Refactor-20250812-152151.yaml b/.changes/unreleased/Refactor-20250812-152151.yaml new file mode 100644 index 0000000..2917646 --- /dev/null +++ b/.changes/unreleased/Refactor-20250812-152151.yaml @@ -0,0 +1,3 @@ +kind: Refactor +body: 'BREAKING CHANGE: Refactor the automatic external_kind calculation for when posting to custom data integration so that "/" are not turned into "_"' +time: 2025-08-12T15:21:51.825057-04:00 diff --git a/workers/k8s.go b/workers/k8s.go index 688da69..fe778dd 100644 --- a/workers/k8s.go +++ b/workers/k8s.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "strings" "sync" "time" @@ -75,12 +76,11 @@ func (s *K8SWorker) parse(item *unstructured.Unstructured) (opslevel.JSON, error } func (s *K8SWorker) sendEvent(kind string, id string, value *unstructured.Unstructured) { - kind = strings.Replace(kind, "/", "_", -1) if viper.GetBool("dry-run") { log.Info().Msgf("[DRYRUN] POST %s | %s", kind, id) log.Debug().Msgf("\t%#v", value) } else { - url := fmt.Sprintf("%s?external_kind=%s", s.integration, kind) + url := fmt.Sprintf("%s?external_kind=%s", s.integration, url.QueryEscape(kind)) resp, err := s.restClient.R().SetBody(value).Post(url) if err != nil { log.Error().Err(err).Msgf("error during post")