Skip to content

Commit 1656309

Browse files
authored
Infra: Fix Machine GT endpoint management (#2232)
Fix the Infrastructure Machine management for Global Tagging service and endpoints. Related: #2231
1 parent 53e5da3 commit 1656309

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cloud/scope/machine.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"sigs.k8s.io/cluster-api/util/patch"
4040

4141
infrav1beta2 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta2"
42+
"sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/authenticator"
4243
"sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/globaltagging"
4344
"sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/utils"
4445
"sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/vpc"
@@ -104,8 +105,17 @@ func NewMachineScope(params MachineScopeParams) (*MachineScope, error) {
104105
core.SetLoggingLevel(core.LevelDebug)
105106
}
106107

108+
auth, err := authenticator.GetAuthenticator()
109+
if err != nil {
110+
return nil, fmt.Errorf("error failed to create authenticator: %w", err)
111+
}
112+
107113
// Create Global Tagging client.
108-
gtOptions := globaltagging.ServiceOptions{}
114+
gtOptions := globaltagging.ServiceOptions{
115+
GlobalTaggingV1Options: &globaltaggingv1.GlobalTaggingV1Options{
116+
Authenticator: auth,
117+
},
118+
}
109119
// Override the Global Tagging endpoint if provided.
110120
if gtEndpoint := endpoints.FetchEndpoints(string(endpoints.GlobalTagging), params.ServiceEndpoint); gtEndpoint != "" {
111121
gtOptions.URL = gtEndpoint

0 commit comments

Comments
 (0)