diff --git a/cloud/scope/powervs_clients.go b/cloud/scope/powervs_clients.go index 8e9a7c282..ba39bca6b 100644 --- a/cloud/scope/powervs_clients.go +++ b/cloud/scope/powervs_clients.go @@ -17,6 +17,7 @@ limitations under the License. package scope import ( + "context" "time" "github.com/IBM-Cloud/power-go-client/clients/instance" @@ -37,12 +38,13 @@ type IBMPowerVSClient struct { // NewIBMPowerVSClient creates and returns a IBM Power VS client func NewIBMPowerVSClient(token, account, cloudInstanceID, region, zone string, debug bool) (_ *IBMPowerVSClient, err error) { client := &IBMPowerVSClient{} + ctx := context.Background() client.session, err = ibmpisession.New(token, region, debug, TIMEOUT, account, zone) if err != nil { return nil, err } - client.InstanceClient = instance.NewIBMPIInstanceClient(client.session, cloudInstanceID) + client.InstanceClient = instance.NewIBMPIInstanceClient(ctx, client.session, cloudInstanceID) client.NetworkClient = instance.NewIBMPINetworkClient(client.session, cloudInstanceID) client.ImageClient = instance.NewIBMPIImageClient(client.session, cloudInstanceID) return client, nil diff --git a/cloud/scope/powervs_machine.go b/cloud/scope/powervs_machine.go index f06ccde08..e54b28872 100644 --- a/cloud/scope/powervs_machine.go +++ b/cloud/scope/powervs_machine.go @@ -21,7 +21,6 @@ import ( "encoding/base64" "fmt" "strconv" - "time" "github.com/go-logr/logr" "github.com/pkg/errors" @@ -121,7 +120,7 @@ func NewPowerVSMachineScope(params PowerVSMachineScopeParams) (*PowerVSMachineSc } func (m *PowerVSMachineScope) ensureInstanceUnique(instanceName string) (*models.PVMInstanceReference, error) { - instances, err := m.IBMPowerVSClient.InstanceClient.GetAll(m.IBMPowerVSMachine.Spec.ServiceInstanceID, 60*time.Minute) + instances, err := m.IBMPowerVSClient.InstanceClient.GetAll() if err != nil { return nil, err } @@ -186,7 +185,7 @@ func (m *PowerVSMachineScope) CreateMachine() (*models.PVMInstanceReference, err UserData: cloudInitData, }, } - _, err = m.IBMPowerVSClient.InstanceClient.Create(params, s.ServiceInstanceID, time.Hour) + _, err = m.IBMPowerVSClient.InstanceClient.Create(params.Body) if err != nil { return nil, err } @@ -205,7 +204,7 @@ func (m *PowerVSMachineScope) PatchObject() error { // DeleteMachine deletes the power vs machine associated with machine instance id and service instance id. func (m *PowerVSMachineScope) DeleteMachine() error { - return m.IBMPowerVSClient.InstanceClient.Delete(m.IBMPowerVSMachine.Status.InstanceID, m.IBMPowerVSMachine.Spec.ServiceInstanceID, time.Hour) + return m.IBMPowerVSClient.InstanceClient.Delete(m.IBMPowerVSMachine.Status.InstanceID) } // GetBootstrapData returns the base64 encoded bootstrap data from the secret in the Machine's bootstrap.dataSecretName diff --git a/controllers/ibmpowervsmachine_controller.go b/controllers/ibmpowervsmachine_controller.go index 831fc1073..df0da5283 100644 --- a/controllers/ibmpowervsmachine_controller.go +++ b/controllers/ibmpowervsmachine_controller.go @@ -19,7 +19,6 @@ package controllers import ( "context" "fmt" - "time" "github.com/go-logr/logr" "github.com/pkg/errors" @@ -169,7 +168,7 @@ func (r *IBMPowerVSMachineReconciler) reconcileNormal(ctx context.Context, machi } if ins != nil { - instance, err := machineScope.IBMPowerVSClient.InstanceClient.Get(*ins.PvmInstanceID, machineScope.IBMPowerVSMachine.Spec.ServiceInstanceID, 60*time.Minute) + instance, err := machineScope.IBMPowerVSClient.InstanceClient.Get(*ins.PvmInstanceID) if err != nil { return ctrl.Result{}, err } diff --git a/go.mod b/go.mod index 86ce600dc..3673555a1 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/IBM-Cloud/bluemix-go v0.0.0-20200921095234-26d1d0148c62 - github.com/IBM-Cloud/power-go-client v1.0.78 + github.com/IBM-Cloud/power-go-client v1.0.80 github.com/IBM/go-sdk-core/v5 v5.9.0 github.com/IBM/vpc-go-sdk v0.14.0 github.com/go-logr/logr v0.4.0 diff --git a/go.sum b/go.sum index 201692475..63a4ee83b 100644 --- a/go.sum +++ b/go.sum @@ -57,8 +57,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/IBM-Cloud/bluemix-go v0.0.0-20200921095234-26d1d0148c62 h1:8I8Z3mRorZhgT31vXPysZNuVQV7vWR3GSVtmh8xJ9L8= github.com/IBM-Cloud/bluemix-go v0.0.0-20200921095234-26d1d0148c62/go.mod h1:gPJbH1etcDj7qS/hBRiLuYW9CY0bRcostSKusa51xR0= -github.com/IBM-Cloud/power-go-client v1.0.78 h1:N2r/l3fep6Us2XZfK/cSyz02QImas5SkPBjIcIZ/Nz4= -github.com/IBM-Cloud/power-go-client v1.0.78/go.mod h1:YRBsrY+n1+3xMd6HzfG0VATkXZqOQktK5Yvjx9x6ACc= +github.com/IBM-Cloud/power-go-client v1.0.80 h1:52dpu7pCpsRu5L1w2mejC3rDjwQwoenIvZznWetTgSs= +github.com/IBM-Cloud/power-go-client v1.0.80/go.mod h1:YRBsrY+n1+3xMd6HzfG0VATkXZqOQktK5Yvjx9x6ACc= github.com/IBM/go-sdk-core/v5 v5.7.2/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc0XQUqRO9Jc= github.com/IBM/go-sdk-core/v5 v5.9.0 h1:j+Ra0VIA1E96gOuH1Psl2wlHfKoevYYqQeeeFYKibJ4= github.com/IBM/go-sdk-core/v5 v5.9.0/go.mod h1:axE2JrRq79gIJTjKPBwV6gWHswvVptBjbcvvCPIxARM=