Skip to content

Commit

Permalink
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 3 additions & 1 deletion cloud/scope/powervs_clients.go
Original file line number Diff line number Diff line change
@@ -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
7 changes: 3 additions & 4 deletions cloud/scope/powervs_machine.go
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions controllers/ibmpowervsmachine_controller.go
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=

0 comments on commit 25d995a

Please sign in to comment.