@@ -174,6 +174,24 @@ func GetConfig(listers *regopclient.StorageListers) (*Swift, error) {
174
174
// CABundle returns either the configured CA bundle or indicates that the
175
175
// system trust bundle should be used instead.
176
176
func (d * driver ) CABundle () (string , bool , error ) {
177
+ sec , err := d .Listers .Secrets .Get (defaults .CloudCredentialsName )
178
+ if err != nil {
179
+ if ! apimachineryerrors .IsNotFound (err ) {
180
+ return "" , false , err
181
+ }
182
+ } else {
183
+ caBundle := string (sec .Data ["cacert" ])
184
+ if caBundle != "" {
185
+ return caBundle , false , nil
186
+ }
187
+ }
188
+
189
+ // Fallback for retrieving CA cert from the CCM config. Starting in
190
+ // OCP 4.19, cloud-credential-operator provides this in the credential
191
+ // secret, as seen above, so this is no longer necessary outside of
192
+ // upgrade scenarios.
193
+ // TODO(stephenfin): Remove in 4.20
194
+
177
195
cm , err := d .Listers .OpenShiftConfig .Get ("cloud-provider-config" )
178
196
if apimachineryerrors .IsNotFound (err ) {
179
197
return "" , true , nil
@@ -182,10 +200,10 @@ func (d *driver) CABundle() (string, bool, error) {
182
200
return "" , false , err
183
201
}
184
202
caBundle := string (cm .Data ["ca-bundle.pem" ])
185
- if caBundle = = "" {
186
- return "" , true , nil
203
+ if caBundle ! = "" {
204
+ return caBundle , false , nil
187
205
}
188
- return caBundle , false , nil
206
+ return "" , true , nil
189
207
}
190
208
191
209
type ErrContainerEndpointNotFound struct {
0 commit comments