From 5da7737797b5382ed0354e293d47be079ea21496 Mon Sep 17 00:00:00 2001 From: michaeljguarino Date: Thu, 9 May 2024 09:33:06 -0400 Subject: [PATCH] For incomprehensible reasons, google stringifies this data field Need to sanitize it a bit before then. --- internal/controller/constraint_controller.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/controller/constraint_controller.go b/internal/controller/constraint_controller.go index 810d73aa..7035f6c5 100644 --- a/internal/controller/constraint_controller.go +++ b/internal/controller/constraint_controller.go @@ -3,6 +3,7 @@ package controller import ( "context" "fmt" + "strings" "gopkg.in/yaml.v3" @@ -120,6 +121,8 @@ func GenerateAPIConstraint(instance *unstructured.Unstructured, template *templa if annotations := instance.GetAnnotations(); annotations != nil { var bundleData BundleData if d, ok := annotations[bundleDataAnnotation]; ok { + d = strings.TrimSpace(d) + d = strings.Trim(d, "\"") if err := yaml.Unmarshal([]byte(d), &bundleData); err != nil { pca.Description = lo.ToPtr(bundleData.Description) pca.Recommendation = lo.ToPtr(bundleData.Remediation)