Skip to content

Commit a8da75c

Browse files
authored
Merge pull request opendatahub-io#742 from hbelmiro/RHOAIENG-15689
Trimmed certificates before checking them
2 parents f10945b + 7b35ab5 commit a8da75c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

controllers/dspipeline_params.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip
654654
// "odh-trusted-ca-bundle" can have fields: "odh-ca-bundle.crt" and "ca-bundle.crt", we need to utilize both
655655
for _, val := range globalCerts {
656656
// If the ca-bundle field is empty, ignore it
657-
if val != "" {
657+
if strings.TrimSpace(val) != "" {
658658
p.APICustomPemCerts = append(p.APICustomPemCerts, []byte(val))
659659
}
660660
}
@@ -679,7 +679,7 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip
679679
}
680680
dspaProvidedCABundle := util.GetConfigMapValue(dspaCaBundleCfgKey, dspaCAConfigMap)
681681
// If the ca-bundle field is empty, ignore it
682-
if dspaProvidedCABundle != "" {
682+
if strings.TrimSpace(dspaProvidedCABundle) != "" {
683683
p.APICustomPemCerts = append(p.APICustomPemCerts, []byte(dspaProvidedCABundle))
684684
}
685685
}
@@ -694,7 +694,7 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip
694694
return serviceCACfgErr
695695
}
696696
serviceCABundle := util.GetConfigMapValue(config.OpenshiftServiceCAConfigMapKey, serviceCA)
697-
if serviceCABundle == "" {
697+
if strings.TrimSpace(serviceCABundle) == "" {
698698
return fmt.Errorf("expected key %s from configmap %s not found", config.OpenshiftServiceCAConfigMapKey, config.OpenshiftServiceCAConfigMapName)
699699
}
700700
p.APICustomPemCerts = append(p.APICustomPemCerts, []byte(serviceCABundle))
@@ -729,7 +729,7 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip
729729
return sysCertsErr
730730
}
731731

732-
if len(certs) != 0 {
732+
if len(bytes.TrimSpace(certs)) != 0 {
733733
p.APICustomPemCerts = append(p.APICustomPemCerts, certs)
734734
}
735735
}

0 commit comments

Comments
 (0)