From 656d53ec7331661e15a117cbacb6fb518de884d7 Mon Sep 17 00:00:00 2001 From: Wen Zhou Date: Thu, 7 Nov 2024 01:22:40 +0100 Subject: [PATCH] fix: ensure input CAbundle always end with a newline (#1339) * fix: ensure input CAbundle always end with a newline - missing newline will cause problem when inject data into configmap - this happens when user use kustomize with their own CA for DSCI, it set to use |- not | - fix lint Signed-off-by: Wen Zhou * update: better way to add newline Signed-off-by: Wen Zhou --------- Signed-off-by: Wen Zhou --- pkg/trustedcabundle/trustedcabundle.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/trustedcabundle/trustedcabundle.go b/pkg/trustedcabundle/trustedcabundle.go index 5be58c77283..41a9ab2ef8b 100644 --- a/pkg/trustedcabundle/trustedcabundle.go +++ b/pkg/trustedcabundle/trustedcabundle.go @@ -5,6 +5,7 @@ import ( "context" "fmt" "strconv" + "strings" "time" "github.com/go-logr/logr" @@ -47,6 +48,9 @@ func HasCABundleAnnotationDisabled(ns client.Object) bool { // or update existing odh-trusted-ca-bundle configmap if already exists with new content of .data.odh-ca-bundle.crt // this is certificates for the cluster trusted CA Cert Bundle. func CreateOdhTrustedCABundleConfigMap(ctx context.Context, cli client.Client, namespace string, customCAData string) error { + // Adding newline breaker if user input does not have it + customCAData = strings.TrimSpace(customCAData) + "\n" + // Expected configmap for the given namespace desiredConfigMap := &corev1.ConfigMap{ TypeMeta: metav1.TypeMeta{