From a6367dc0755024ed5a171cc71def4b25691be2ea Mon Sep 17 00:00:00 2001 From: Humair Khan Date: Tue, 5 Mar 2024 14:03:39 -0500 Subject: [PATCH] chore: ignore empty cabundle fields. Signed-off-by: Humair Khan --- controllers/dspipeline_params.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/controllers/dspipeline_params.go b/controllers/dspipeline_params.go index 043eff021..c14696867 100644 --- a/controllers/dspipeline_params.go +++ b/controllers/dspipeline_params.go @@ -520,7 +520,10 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip log.Info(fmt.Sprintf("Found global CA Bundle %s present in this namespace %s, this bundle will be included in external tls connections.", config.GlobalODHCaBundleConfigMapName, p.Namespace)) // "odh-trusted-ca-bundle" can have fields: "odh-ca-bundle.crt" and "ca-bundle.crt", we need to utilize both for _, val := range globalCerts { - p.APICustomPemCerts = append(p.APICustomPemCerts, []byte(val)) + // If the ca-bundle field is empty, ignore it + if val != "" { + p.APICustomPemCerts = append(p.APICustomPemCerts, []byte(val)) + } } } @@ -535,7 +538,11 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip log.Info(fmt.Sprintf("Encountered error when attempting to fetch ConfigMap: [%s], Error: %v", dspaCaBundleCfgName, dspaCACfgErr)) return dspaCACfgErr } - p.APICustomPemCerts = append(p.APICustomPemCerts, []byte(dspaProvidedCABundle)) + + // If the ca-bundle field is empty, ignore it + if dspaProvidedCABundle != "" { + p.APICustomPemCerts = append(p.APICustomPemCerts, []byte(dspaProvidedCABundle)) + } } // There are situations where global & user provided certs, or a provided ca trust configmap(s) have various trust bundles