From d26c8fe8dc115765ab1d9da03e203a147306e47a Mon Sep 17 00:00:00 2001 From: Britania Rodriguez Reyes Date: Thu, 7 Nov 2024 11:15:08 -0800 Subject: [PATCH] load cloud config --- cmd/memberagent/main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/memberagent/main.go b/cmd/memberagent/main.go index 5dbf7bfc5..6fd52b84d 100644 --- a/cmd/memberagent/main.go +++ b/cmd/memberagent/main.go @@ -49,6 +49,7 @@ import ( "go.goms.io/fleet/pkg/propertyprovider" "go.goms.io/fleet/pkg/propertyprovider/azure" "go.goms.io/fleet/pkg/utils" + azureCloudConfig "go.goms.io/fleet/pkg/utils/cloudconfig/azure" "go.goms.io/fleet/pkg/utils/httpclient" //+kubebuilder:scaffold:imports ) @@ -366,10 +367,15 @@ func Start(ctx context.Context, hubCfg, memberConfig *rest.Config, hubOpts, memb switch { case propertyProvider != nil && *propertyProvider == azurePropertyProvider: klog.V(2).Info("setting up the Azure property provider") - // TODO: Set cloud configuration. // Note that the property provider, though initialized here, is not started until // the specific instance wins the leader election. - klog.V(1).InfoS("Cloud config loaded successfully", "config", cloudConfigFile) + cloudConfig, err := azureCloudConfig.NewCloudConfigFromFile(*cloudConfigFile) + if err != nil { + klog.ErrorS(err, "Unable to load cloud config", "file name", *cloudConfigFile) + return fmt.Errorf("unable to load cloud config: %w", err) + } + cloudConfig.SetUserAgent("fleet-member-agent") + klog.V(1).InfoS("Cloud config loaded successfully", "config", cloudConfig) pp = azure.New(region) default: // Fall back to not using any property provider if the provided type is none or