Skip to content

Commit 8f478b8

Browse files
committed
Power VS: Add support for endpoint overrides
1 parent bc66580 commit 8f478b8

File tree

1 file changed

+50
-21
lines changed

1 file changed

+50
-21
lines changed

pkg/storage/ibmcos/ibmcos.go

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -469,29 +469,58 @@ func (d *driver) CreateStorage(cr *imageregistryv1.Config) error {
469469

470470
// setServiceEndpointOverrides will collect any necessary IBM Cloud Service endpoint overrides and set them for the driver to use for IBM Cloud Services
471471
func (d *driver) setServiceEndpointOverrides(infra *configapiv1.Infrastructure) {
472-
// We currently only handle overrides for IBMCloud (api/config/v1/IBMCloudPlatformType), not PowerVS
473-
if infra.Status.PlatformStatus != nil && infra.Status.PlatformStatus.Type == configapiv1.IBMCloudPlatformType && infra.Status.PlatformStatus.IBMCloud != nil {
474-
if len(infra.Status.PlatformStatus.IBMCloud.ServiceEndpoints) > 0 {
475-
for _, endpoint := range infra.Status.PlatformStatus.IBMCloud.ServiceEndpoints {
476-
switch endpoint.Name {
477-
case configapiv1.IBMCloudServiceCOS:
478-
klog.Infof("found override for ibmcloud cos endpoint: %s", endpoint.URL)
479-
d.cosServiceEndpoint = endpoint.URL
480-
case configapiv1.IBMCloudServiceIAM:
481-
klog.Infof("found override for ibmcloud iam endpoint: %s", endpoint.URL)
482-
d.iamServiceEndpoint = endpoint.URL
483-
case configapiv1.IBMCloudServiceResourceController:
484-
klog.Infof("found override for ibmcloud resource controller endpoint: %s", endpoint.URL)
485-
d.rcServiceEndpoint = endpoint.URL
486-
case configapiv1.IBMCloudServiceResourceManager:
487-
klog.Infof("found override for ibmcloud resource manager endpoint: %s", endpoint.URL)
488-
d.rmServiceEndpoint = endpoint.URL
489-
case configapiv1.IBMCloudServiceCIS, configapiv1.IBMCloudServiceDNSServices, configapiv1.IBMCloudServiceGlobalSearch, configapiv1.IBMCloudServiceGlobalTagging, configapiv1.IBMCloudServiceHyperProtect, configapiv1.IBMCloudServiceKeyProtect, configapiv1.IBMCloudServiceVPC:
490-
klog.Infof("ignoring unused service endpoint: %s", endpoint.Name)
491-
default:
492-
klog.Infof("ignoring unknown service: %s", endpoint.Name)
472+
if infra.Status.PlatformStatus != nil {
473+
switch infra.Status.PlatformStatus.Type {
474+
case configapiv1.IBMCloudPlatformType:
475+
if infra.Status.PlatformStatus.IBMCloud != nil && len(infra.Status.PlatformStatus.IBMCloud.ServiceEndpoints) > 0 {
476+
for _, endpoint := range infra.Status.PlatformStatus.IBMCloud.ServiceEndpoints {
477+
switch endpoint.Name {
478+
case configapiv1.IBMCloudServiceCOS:
479+
klog.Infof("found override for ibmcloud cos endpoint: %s", endpoint.URL)
480+
d.cosServiceEndpoint = endpoint.URL
481+
case configapiv1.IBMCloudServiceIAM:
482+
klog.Infof("found override for ibmcloud iam endpoint: %s", endpoint.URL)
483+
d.iamServiceEndpoint = endpoint.URL
484+
case configapiv1.IBMCloudServiceResourceController:
485+
klog.Infof("found override for ibmcloud resource controller endpoint: %s", endpoint.URL)
486+
d.rcServiceEndpoint = endpoint.URL
487+
case configapiv1.IBMCloudServiceResourceManager:
488+
klog.Infof("found override for ibmcloud resource manager endpoint: %s", endpoint.URL)
489+
d.rmServiceEndpoint = endpoint.URL
490+
case configapiv1.IBMCloudServiceCIS, configapiv1.IBMCloudServiceDNSServices, configapiv1.IBMCloudServiceGlobalSearch, configapiv1.IBMCloudServiceGlobalTagging, configapiv1.IBMCloudServiceHyperProtect, configapiv1.IBMCloudServiceKeyProtect, configapiv1.IBMCloudServiceVPC:
491+
klog.Infof("ignoring unused service endpoint: %s", endpoint.Name)
492+
default:
493+
klog.Infof("ignoring unknown service: %s", endpoint.Name)
494+
}
493495
}
494496
}
497+
case configapiv1.PowerVSPlatformType:
498+
if infra.Status.PlatformStatus.PowerVS != nil && len(infra.Status.PlatformStatus.PowerVS.ServiceEndpoints) > 0 {
499+
for _, endpoint := range infra.Status.PlatformStatus.PowerVS.ServiceEndpoints {
500+
switch endpoint.Name {
501+
case string(configapiv1.IBMCloudServiceCOS):
502+
klog.Infof("found override for ibmcloud cos endpoint: %s", endpoint.URL)
503+
d.cosServiceEndpoint = endpoint.URL
504+
case string(configapiv1.IBMCloudServiceIAM):
505+
klog.Infof("found override for ibmcloud iam endpoint: %s", endpoint.URL)
506+
d.iamServiceEndpoint = endpoint.URL
507+
case string(configapiv1.IBMCloudServiceResourceController):
508+
klog.Infof("found override for ibmcloud resource controller endpoint: %s", endpoint.URL)
509+
d.rcServiceEndpoint = endpoint.URL
510+
case string(configapiv1.IBMCloudServiceResourceManager):
511+
klog.Infof("found override for ibmcloud resource manager endpoint: %s", endpoint.URL)
512+
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+
klog.Infof("ignoring unused service endpoint: %s", endpoint.Name)
515+
default:
516+
klog.Infof("ignoring unknown service: %s", endpoint.Name)
517+
}
518+
}
519+
}
520+
case configapiv1.AWSPlatformType, configapiv1.AzurePlatformType, configapiv1.BareMetalPlatformType, configapiv1.GCPPlatformType, configapiv1.LibvirtPlatformType, configapiv1.OpenStackPlatformType, configapiv1.NonePlatformType, configapiv1.VSpherePlatformType, configapiv1.OvirtPlatformType, configapiv1.KubevirtPlatformType, configapiv1.EquinixMetalPlatformType, configapiv1.AlibabaCloudPlatformType, configapiv1.NutanixPlatformType, configapiv1.ExternalPlatformType:
521+
klog.Infof("provider type unsupported by IBM Cloud: %s", infra.Status.PlatformStatus.Type)
522+
default:
523+
klog.Infof("ignoring unknown provider type: %s", infra.Status.PlatformStatus.Type)
495524
}
496525
}
497526
}

0 commit comments

Comments
 (0)