@@ -38,6 +38,7 @@ import (
3838
3939 infrastructurev1alpha3 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1alpha3"
4040 "sigs.k8s.io/cluster-api-provider-ibmcloud/cloud/scope"
41+ "sigs.k8s.io/cluster-api-provider-ibmcloud/pkg"
4142)
4243
4344// IBMVPCMachineReconciler reconciles a IBMVPCMachine object
@@ -97,10 +98,13 @@ func (r *IBMVPCMachineReconciler) Reconcile(ctx context.Context, req ctrl.Reques
9798 }
9899
99100 // Create the cluster scope
100- iamEndpoint := os .Getenv ("IAM_ENDPOINT" )
101- apiKey := os .Getenv ("API_KEY" )
102101 svcEndpoint := os .Getenv ("SERVICE_ENDPOINT" )
103102
103+ authenticator , err := pkg .GetAuthenticator ()
104+ if err != nil {
105+ return ctrl.Result {}, errors .Wrapf (err , "failed to get authenticator" )
106+ }
107+
104108 // Create the machine scope
105109 machineScope , err := scope .NewMachineScope (scope.MachineScopeParams {
106110 Client : r .Client ,
@@ -109,7 +113,7 @@ func (r *IBMVPCMachineReconciler) Reconcile(ctx context.Context, req ctrl.Reques
109113 IBMVPCCluster : ibmCluster ,
110114 Machine : machine ,
111115 IBMVPCMachine : ibmVpcMachine ,
112- }, iamEndpoint , apiKey , svcEndpoint )
116+ }, authenticator , svcEndpoint )
113117 if err != nil {
114118 return ctrl.Result {}, errors .Errorf ("failed to create scope: %+v" , err )
115119 }
0 commit comments