Skip to content

Commit d8ba0e1

Browse files
committed
Power VS: Check endpoints against lower case strings
Power VS endpoint validation in the API only allows for lower case characters. However, the endpoint struct we check against is hardcoded to be PascalCase. This patch checks against the lower case version of the string to ensure it's recognized.
1 parent 8f478b8 commit d8ba0e1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pkg/storage/ibmcos/ibmcos.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"net/url"
1010
"path/filepath"
1111
"reflect"
12+
"strings"
1213
"time"
1314

1415
"golang.org/x/net/http/httpproxy"
@@ -498,19 +499,19 @@ func (d *driver) setServiceEndpointOverrides(infra *configapiv1.Infrastructure)
498499
if infra.Status.PlatformStatus.PowerVS != nil && len(infra.Status.PlatformStatus.PowerVS.ServiceEndpoints) > 0 {
499500
for _, endpoint := range infra.Status.PlatformStatus.PowerVS.ServiceEndpoints {
500501
switch endpoint.Name {
501-
case string(configapiv1.IBMCloudServiceCOS):
502+
case strings.ToLower(string(configapiv1.IBMCloudServiceCOS)):
502503
klog.Infof("found override for ibmcloud cos endpoint: %s", endpoint.URL)
503504
d.cosServiceEndpoint = endpoint.URL
504-
case string(configapiv1.IBMCloudServiceIAM):
505+
case strings.ToLower(string(configapiv1.IBMCloudServiceIAM)):
505506
klog.Infof("found override for ibmcloud iam endpoint: %s", endpoint.URL)
506507
d.iamServiceEndpoint = endpoint.URL
507-
case string(configapiv1.IBMCloudServiceResourceController):
508+
case strings.ToLower(string(configapiv1.IBMCloudServiceResourceController)):
508509
klog.Infof("found override for ibmcloud resource controller endpoint: %s", endpoint.URL)
509510
d.rcServiceEndpoint = endpoint.URL
510-
case string(configapiv1.IBMCloudServiceResourceManager):
511+
case strings.ToLower(string(configapiv1.IBMCloudServiceResourceManager)):
511512
klog.Infof("found override for ibmcloud resource manager endpoint: %s", endpoint.URL)
512513
d.rmServiceEndpoint = endpoint.URL
513-
case string(configapiv1.IBMCloudServiceCIS), string(configapiv1.IBMCloudServiceDNSServices), string(configapiv1.IBMCloudServiceGlobalSearch), string(configapiv1.IBMCloudServiceGlobalTagging), string(configapiv1.IBMCloudServiceHyperProtect), string(configapiv1.IBMCloudServiceKeyProtect), string(configapiv1.IBMCloudServiceVPC):
514+
case strings.ToLower(string(configapiv1.IBMCloudServiceCIS)), strings.ToLower(string(configapiv1.IBMCloudServiceDNSServices)), strings.ToLower(string(configapiv1.IBMCloudServiceGlobalSearch)), strings.ToLower(string(configapiv1.IBMCloudServiceGlobalTagging)), strings.ToLower(string(configapiv1.IBMCloudServiceHyperProtect)), strings.ToLower(string(configapiv1.IBMCloudServiceKeyProtect)), strings.ToLower(string(configapiv1.IBMCloudServiceVPC)):
514515
klog.Infof("ignoring unused service endpoint: %s", endpoint.Name)
515516
default:
516517
klog.Infof("ignoring unknown service: %s", endpoint.Name)

0 commit comments

Comments
 (0)