Skip to content

Commit 152be30

Browse files
committed
♻️ refacto: switch to SDKv3
1 parent 2220b05 commit 152be30

Some content is hidden

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

49 files changed

+1157
-1194
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ BUILD_ENV := "buildenv/cloud-provider-osc:0.0"
2121
BUILD_ENV_RUN := "build-cloud-provider-osc"
2222
DEPLOY_NAME := "k8s-osc-ccm"
2323

24-
SOURCES := $(shell find ./cloud-controller-manager -name '*.go')
24+
SOURCES := $(shell find ./ccm -name '*.go')
2525
GOOS ?= $(shell go env GOOS)
2626
VERSION ?= $(shell git describe --tags --always --dirty)
2727
LDFLAGS := "-w -s -X 'github.com/outscale/cloud-provider-osc/cloud-controller-manager/utils.version=$(VERSION)'"
@@ -63,7 +63,7 @@ build: $(SOURCES)
6363
CGO_ENABLED=0 GOOS=$(GOOS) go build $(GO_ADD_OPTIONS) \
6464
-ldflags $(LDFLAGS) \
6565
-o osc-cloud-controller-manager \
66-
cloud-controller-manager/cmd/osc-cloud-controller-manager/main.go
66+
ccm/cmd/osc-cloud-controller-manager/main.go
6767

6868
.PHONY: verify
6969
verify: verify-fmt vet
@@ -82,7 +82,7 @@ mock-generate:
8282

8383
.PHONY: test
8484
test:
85-
CGO_ENABLED=0 OSC_ACCESS_KEY=test OSC_SECRET_KEY=test go test -count=1 -v ./cloud-controller-manager/... ./deploy/...
85+
CGO_ENABLED=0 OSC_ACCESS_KEY=test OSC_SECRET_KEY=test go test -count=1 -v ./ccm/... ./deploy/...
8686

8787

8888
.PHONY: build-image

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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"fmt"
66
"slices"
77

8-
"github.com/outscale/cloud-provider-osc/cloud-controller-manager/osc/oapi"
9-
"github.com/outscale/cloud-provider-osc/cloud-controller-manager/utils"
10-
"github.com/outscale/osc-sdk-go/v2"
8+
"github.com/outscale/cloud-provider-osc/ccm/oapi"
9+
"github.com/outscale/cloud-provider-osc/ccm/utils"
10+
"github.com/outscale/osc-sdk-go/v3/pkg/osc"
1111
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1212
clientset "k8s.io/client-go/kubernetes"
1313
"k8s.io/klog/v2"
@@ -46,16 +46,16 @@ func New(ctx context.Context, clusterID string) (*Cloud, error) {
4646
} else {
4747
// primary cluster ID (CAPOSC v1)
4848
c.clusterID = []string{self.ClusterID()}
49-
if self.SubnetID != "" {
49+
if self.SubnetID != nil {
5050
// alternate cluster ID (CAPOSC v0)
5151
subs, err := api.OAPI().ReadSubnets(ctx, osc.ReadSubnetsRequest{
52-
Filters: &osc.FiltersSubnet{SubnetIds: &[]string{self.SubnetID}},
52+
Filters: &osc.FiltersSubnet{SubnetIds: &[]string{*self.SubnetID}},
5353
})
5454
if err != nil {
5555
return nil, fmt.Errorf("error finding self subnets: %w", err)
5656
}
5757
if len(subs) == 1 {
58-
clusterID := getClusterIDFromTags(subs[0].GetTags())
58+
clusterID := getClusterIDFromTags(subs[0].Tags)
5959
if clusterID != "" && !slices.Contains(c.clusterID, clusterID) {
6060
c.clusterID = append(c.clusterID, clusterID)
6161
}

0 commit comments

Comments
 (0)