Skip to content

Commit

Permalink
fix: ensure input CAbundle always end with a newline
Browse files Browse the repository at this point in the history
- 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 |

Signed-off-by: Wen Zhou <[email protected]>
  • Loading branch information
zdtsw committed Nov 4, 2024
1 parent 1f5af72 commit 1cb9c64
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion controllers/dscinitialization/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ func TestDataScienceClusterInitialization(t *testing.T) {

var testScheme = runtime.NewScheme()

//nolint:fatcontext
var _ = BeforeSuite(func() {
// can't use suite's context as the manager should survive the function
gCtx, gCancel = context.WithCancel(context.Background())

Check failure on line 82 in controllers/dscinitialization/suite_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

nested context in function literal (fatcontext)
Expand Down
1 change: 0 additions & 1 deletion controllers/webhook/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ func TestAPIs(t *testing.T) {
RunSpecs(t, "Webhook Suite")
}

//nolint:fatcontext
var _ = BeforeSuite(func() {
// can't use suite's context as the manager should survive the function
gCtx, gCancel = context.WithCancel(context.Background())

Check failure on line 84 in controllers/webhook/webhook_suite_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

nested context in function literal (fatcontext)
Expand Down
5 changes: 5 additions & 0 deletions pkg/trustedcabundle/trustedcabundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"fmt"
"strconv"
"strings"
"time"

"github.com/go-logr/logr"
Expand Down Expand Up @@ -47,6 +48,10 @@ 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
if !strings.HasSuffix(customCAData, "\n") {
customCAData += "\n"
}
// Expected configmap for the given namespace
desiredConfigMap := &corev1.ConfigMap{
TypeMeta: metav1.TypeMeta{
Expand Down

0 comments on commit 1cb9c64

Please sign in to comment.