Skip to content

Commit

Permalink
Trimmed certificates
Browse files Browse the repository at this point in the history
Signed-off-by: Helber Belmiro <[email protected]>
(cherry picked from commit 7b35ab5)
  • Loading branch information
hbelmiro committed Nov 13, 2024
1 parent cd1cda6 commit 51277ad
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions controllers/dspipeline_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip
// "odh-trusted-ca-bundle" can have fields: "odh-ca-bundle.crt" and "ca-bundle.crt", we need to utilize both
for _, val := range globalCerts {
// If the ca-bundle field is empty, ignore it
if val != "" {
if strings.TrimSpace(val) != "" {
p.APICustomPemCerts = append(p.APICustomPemCerts, []byte(val))
}
}
Expand All @@ -679,7 +679,7 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip
}
dspaProvidedCABundle := util.GetConfigMapValue(dspaCaBundleCfgKey, dspaCAConfigMap)
// If the ca-bundle field is empty, ignore it
if dspaProvidedCABundle != "" {
if strings.TrimSpace(dspaProvidedCABundle) != "" {
p.APICustomPemCerts = append(p.APICustomPemCerts, []byte(dspaProvidedCABundle))
}
}
Expand All @@ -694,7 +694,7 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip
return serviceCACfgErr
}
serviceCABundle := util.GetConfigMapValue(config.OpenshiftServiceCAConfigMapKey, serviceCA)
if serviceCABundle == "" {
if strings.TrimSpace(serviceCABundle) == "" {
return fmt.Errorf("expected key %s from configmap %s not found", config.OpenshiftServiceCAConfigMapKey, config.OpenshiftServiceCAConfigMapName)
}
p.APICustomPemCerts = append(p.APICustomPemCerts, []byte(serviceCABundle))
Expand Down Expand Up @@ -729,7 +729,7 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip
return sysCertsErr
}

if len(certs) != 0 {
if len(bytes.TrimSpace(certs)) != 0 {
p.APICustomPemCerts = append(p.APICustomPemCerts, certs)
}
}
Expand Down

0 comments on commit 51277ad

Please sign in to comment.