Skip to content

Commit 7d1330e

Browse files
committed
fixup! ♻️ refacto: switch to SDKv3
1 parent 88ab43e commit 7d1330e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+160
-156
lines changed

cloud-controller-manager/osc/cloud/annotations.go renamed to ccm/cloud/annotations.go

File renamed without changes.

cloud-controller-manager/osc/cloud/cloud.go renamed to ccm/cloud/cloud.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/outscale/cloud-provider-osc/cloud-controller-manager/osc/oapi"
7+
"github.com/outscale/cloud-provider-osc/ccm/oapi"
88
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
99
clientset "k8s.io/client-go/kubernetes"
1010
"k8s.io/klog/v2"

cloud-controller-manager/osc/cloud/loadbalancer.go renamed to ccm/cloud/loadbalancer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/aws/aws-sdk-go/aws"
1717
"github.com/aws/aws-sdk-go/service/elb"
1818
"github.com/go-viper/mapstructure/v2"
19-
"github.com/outscale/cloud-provider-osc/cloud-controller-manager/osc/oapi"
19+
"github.com/outscale/cloud-provider-osc/ccm/oapi"
2020
"github.com/outscale/osc-sdk-go/v3/pkg/osc"
2121
v1 "k8s.io/api/core/v1"
2222
"k8s.io/apimachinery/pkg/util/sets"

cloud-controller-manager/osc/cloud/loadbalancer_config_test.go renamed to ccm/cloud/loadbalancer_config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package cloud_test
33
import (
44
"testing"
55

6-
"github.com/outscale/cloud-provider-osc/cloud-controller-manager/osc/cloud"
6+
"github.com/outscale/cloud-provider-osc/ccm/cloud"
77
"github.com/stretchr/testify/assert"
88
"github.com/stretchr/testify/require"
99
v1 "k8s.io/api/core/v1"

cloud-controller-manager/osc/cloud/tags.go renamed to ccm/cloud/tags.go

File renamed without changes.

cloud-controller-manager/osc/cloud/utils.go renamed to ccm/cloud/utils.go

File renamed without changes.
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ func (vm *VM) NodeAddresses() []v1.NodeAddress {
8282
}
8383

8484
func (vm *VM) IsStopped() bool {
85-
return vm.cloudVm.State == "stopped"
85+
return vm.cloudVm.State == osc.VmStateStopped
8686
}
8787

8888
func (vm *VM) IsTerminated() bool {
89-
return vm.cloudVm.State == "terminated"
89+
return vm.cloudVm.State == osc.VmStateTerminated
9090
}
9191

9292
// InstanceID returns the instance ID
@@ -129,12 +129,12 @@ func (c *Cloud) GetVMsByNodeName(ctx context.Context, nodeNames ...string) ([]VM
129129
sdkVMs, err := c.api.OAPI().ReadVms(ctx, osc.ReadVmsRequest{
130130
Filters: &osc.FiltersVm{
131131
TagKeys: &[]string{clusterIDTagKey(c.clusterID)},
132-
VmStateNames: &[]string{
133-
"pending",
134-
"running",
135-
"stopping",
136-
"stopped",
137-
"shutting-down",
132+
VmStateNames: &[]osc.VmState{
133+
osc.VmStatePending,
134+
osc.VmStateRunning,
135+
osc.VmStateStopping,
136+
osc.VmStateStopped,
137+
osc.VmStateShuttingDown,
138138
},
139139
},
140140
})

cloud-controller-manager/cmd/osc-cloud-controller-manager/main.go renamed to ccm/cmd/osc-cloud-controller-manager/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"io"
3030
"os"
3131

32-
osc "github.com/outscale/cloud-provider-osc/cloud-controller-manager/osc"
32+
osc "github.com/outscale/cloud-provider-osc/ccm"
3333
"k8s.io/apimachinery/pkg/util/wait"
3434
cloudprovider "k8s.io/cloud-provider"
3535
"k8s.io/cloud-provider/app"

cloud-controller-manager/osc/helpers_test.go renamed to ccm/helpers_test.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
package osc_test
1+
package ccm_test
22

33
import (
44
"testing"
55

66
"github.com/aws/aws-sdk-go/service/elb"
7-
"github.com/outscale/cloud-provider-osc/cloud-controller-manager/osc/cloud"
8-
"github.com/outscale/cloud-provider-osc/cloud-controller-manager/osc/oapi"
9-
oapimocks "github.com/outscale/cloud-provider-osc/cloud-controller-manager/osc/oapi/mocks"
7+
"github.com/outscale/cloud-provider-osc/ccm/cloud"
8+
"github.com/outscale/cloud-provider-osc/ccm/oapi"
9+
oapimocks "github.com/outscale/cloud-provider-osc/ccm/oapi/mocks"
10+
"github.com/outscale/osc-sdk-go/v3/pkg/osc"
1011
sdk "github.com/outscale/osc-sdk-go/v3/pkg/osc"
1112
"go.uber.org/mock/gomock"
1213
v1 "k8s.io/api/core/v1"
@@ -52,7 +53,7 @@ var (
5253
SubnetId: ptr.To("subnet-bar"),
5354
NetId: ptr.To("net-bar"),
5455
SecurityGroups: []sdk.SecurityGroupLight{{SecurityGroupId: "sg-worker"}, {SecurityGroupId: "sg-node"}},
55-
State: "running",
56+
State: osc.VmStateRunning,
5657
}
5758
vmNode = v1.Node{
5859
ObjectMeta: metav1.ObjectMeta{
@@ -73,7 +74,7 @@ var (
7374
NetId: ptr.To("net-bar"),
7475
SubnetId: ptr.To("subnet-bar"),
7576
SecurityGroups: []sdk.SecurityGroupLight{{SecurityGroupId: "sg-controlplane"}, {SecurityGroupId: "sg-node"}},
76-
State: "running",
77+
State: osc.VmStateRunning,
7778
}
7879
self = cloud.FromOscVm(&sdkSelf)
7980
)
@@ -83,12 +84,12 @@ func expectVMs(mock *oapimocks.MockOAPI, vms ...sdk.Vm) {
8384
ReadVms(gomock.Any(), gomock.Eq(sdk.ReadVmsRequest{
8485
Filters: &sdk.FiltersVm{
8586
TagKeys: &[]string{"OscK8sClusterID/foo"},
86-
VmStateNames: &[]string{
87-
"pending",
88-
"running",
89-
"stopping",
90-
"stopped",
91-
"shutting-down",
87+
VmStateNames: &[]osc.VmState{
88+
osc.VmStatePending,
89+
osc.VmStateRunning,
90+
osc.VmStateStopping,
91+
osc.VmStateStopped,
92+
osc.VmStateShuttingDown,
9293
},
9394
},
9495
})).
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package osc
1+
package ccm
22

33
import (
44
"context"
55
"errors"
66
"fmt"
77

8-
"github.com/outscale/cloud-provider-osc/cloud-controller-manager/osc/cloud"
8+
"github.com/outscale/cloud-provider-osc/ccm/cloud"
99
"k8s.io/client-go/informers"
1010
"k8s.io/klog/v2"
1111
)

0 commit comments

Comments
 (0)