Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
8626a05
clean up loadbalance and iaas client
aniruddha2000 May 4, 2026
b90f248
add volume methods
aniruddha2000 May 5, 2026
df7f754
add volume methods in interface
aniruddha2000 May 5, 2026
01d36a1
add filter funcs and nits
aniruddha2000 May 6, 2026
7aa7f86
add client build code and helpers
aniruddha2000 May 6, 2026
41415c3
replace loadbalancer calls
aniruddha2000 May 7, 2026
86cc7ed
replace iaas calls
aniruddha2000 May 8, 2026
a654b37
fix waitbackup ready and replace more calls
aniruddha2000 May 8, 2026
b08e6d7
fix more calls
aniruddha2000 May 8, 2026
252da5c
replace client creation in main.go
aniruddha2000 May 8, 2026
77ae60c
add cmd/controllerserver.go
aniruddha2000 May 8, 2026
5fd66e3
add mocks and fix iaas and loadbalancing option
aniruddha2000 May 9, 2026
5ba3d9c
add replace with new mock and old client imports with new
aniruddha2000 May 9, 2026
99f1a10
add test cases for the iaas methods
aniruddha2000 May 11, 2026
0957998
delete old client and mocks
aniruddha2000 May 11, 2026
432d00d
add fmt
aniruddha2000 May 11, 2026
890ceee
make verify
aniruddha2000 May 11, 2026
46d5bcf
make seperate test package
aniruddha2000 May 11, 2026
1591145
push rest of the tests
aniruddha2000 May 11, 2026
8ba163a
remove unused code
aniruddha2000 May 12, 2026
6b94f97
rename test package
aniruddha2000 May 12, 2026
3650654
rename further packages
aniruddha2000 May 12, 2026
27da084
make fmt
aniruddha2000 May 12, 2026
49095bf
fix lints
aniruddha2000 May 13, 2026
f1920c7
fix lintts
aniruddha2000 May 13, 2026
681228f
fix iaas tests with mock default api
aniruddha2000 May 13, 2026
32c56ef
convert back from client_test to client in tests
aniruddha2000 May 13, 2026
00ef51c
fix list return elements
aniruddha2000 May 13, 2026
893705b
remove labels casting
aniruddha2000 May 13, 2026
eecae5b
remove labels casting
aniruddha2000 May 13, 2026
3202cd6
fix test api calls
aniruddha2000 May 15, 2026
8cd3749
rebase go.mod
aniruddha2000 May 18, 2026
a5f8a05
make typed in IaaS client mock
aniruddha2000 May 18, 2026
71c0522
use typed in loadbalancer mock
aniruddha2000 May 18, 2026
281d9da
fix test with broken type in DoAndReturn
aniruddha2000 May 18, 2026
227913d
fix csi test case and bring back return string
aniruddha2000 May 19, 2026
238400d
fix mission region
aniruddha2000 May 29, 2026
cff9598
fix detatch volume logic
aniruddha2000 Jun 1, 2026
2729b7e
remove ErrNotFound custom error and use generic openapi error
aniruddha2000 Jun 1, 2026
89cf960
bring back reqID in the client
aniruddha2000 Jun 1, 2026
f41901d
remove region env var and retrieve from config instead
aniruddha2000 Jun 3, 2026
9f381fc
fix rebase
aniruddha2000 Jun 3, 2026
b1bbea0
fix format
aniruddha2000 Jun 3, 2026
8b8b445
fix format
aniruddha2000 Jun 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ mocks: $(MOCKGEN)
@$(MOCKGEN) -destination ./pkg/mock/iaas/iaas.go -package iaas github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api DefaultAPI

# client mocks
@$(MOCKGEN) -destination ./pkg/stackit/iaas_mock.go -package stackit ./pkg/stackit IaasClient
@$(MOCKGEN) -destination ./pkg/stackit/loadbalancer_mock.go -package stackit ./pkg/stackit LoadbalancerClient
@$(MOCKGEN) -destination ./pkg/stackit/server_mock.go -package stackit ./pkg/stackit NodeClient
@$(MOCKGEN) -destination ./pkg/stackit/metadata/metadata_mock.go -package metadata ./pkg/stackit/metadata IMetadata
@$(MOCKGEN) -destination ./pkg/csi/util/mount/mount_mock.go -package mount ./pkg/csi/util/mount IMount
@$(MOCKGEN) -destination ./pkg/stackit/client/mock/iaas_mock.go -typed -package client ./pkg/stackit/client IaaSClient
@$(MOCKGEN) -destination ./pkg/stackit/client/mock/loadbalancer_mock.go -typed -package client ./pkg/stackit/client LoadBalancingClient
@$(MOCKGEN) -destination ./pkg/stackit/client/mock/mock.go -package client ./pkg/stackit/client Factory

.PHONY: generate
generate: mocks
Expand Down
30 changes: 17 additions & 13 deletions cmd/stackit-csi-plugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import (

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"k8s.io/component-base/cli"
"k8s.io/klog/v2"

"github.com/stackitcloud/cloud-provider-stackit/pkg/csi"
"github.com/stackitcloud/cloud-provider-stackit/pkg/csi/blockstorage"
"github.com/stackitcloud/cloud-provider-stackit/pkg/csi/util/mount"
"github.com/stackitcloud/cloud-provider-stackit/pkg/stackit"
"github.com/stackitcloud/cloud-provider-stackit/pkg/metrics"
stackitclient "github.com/stackitcloud/cloud-provider-stackit/pkg/stackit/client"
"github.com/stackitcloud/cloud-provider-stackit/pkg/stackit/metadata"
"github.com/stackitcloud/cloud-provider-stackit/pkg/version"
sdkconfig "github.com/stackitcloud/stackit-sdk-go/core/config"
"k8s.io/component-base/cli"
"k8s.io/klog/v2"
)

var (
Expand Down Expand Up @@ -73,7 +74,7 @@ func main() {
cmd.PersistentFlags().BoolVar(&provideNodeService, "provide-node-service", true,
"If set to true then the CSI driver does provide the node service (default: true)")

stackit.AddExtraFlags(pflag.CommandLine)
stackitclient.AddExtraFlags(pflag.CommandLine)

code := cli.Run(cmd)
os.Exit(code)
Expand All @@ -89,29 +90,32 @@ func handle() {

if provideControllerService {
var err error
cfg, err := stackit.GetConfigFromFile(cloudConfig)
cfg, err := stackitclient.GetConfigFromFile(cloudConfig)
if err != nil {
klog.Fatal(err)
}

iaasClient, err := stackit.CreateIaaSClient(&cfg)
if err != nil {
klog.Fatalf("Failed to create IaaS client: %v", err)
iaasOpts := []sdkconfig.ConfigurationOption{
sdkconfig.WithHTTPClient(metrics.NewInstrumentedHTTPClient()), // TODO: Ask if this is needed or not
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the comment? I thin we need it

Did you test it?

}

if cfg.Global.APIEndpoints.IaasAPI != "" {
iaasOpts = append(iaasOpts, sdkconfig.WithEndpoint(cfg.Global.APIEndpoints.IaasAPI))
}

stackitProvider, err := stackit.CreateSTACKITProvider(iaasClient, &cfg)
iaasClient, err := stackitclient.New(cfg.Global.Region, cfg.Global.ProjectID).IaaS(iaasOpts)
if err != nil {
klog.Fatalf("Failed to create STACKIT provider: %v", err)
klog.Fatalf("Failed to create STACKIT stackitclient: %v", err)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
klog.Fatalf("Failed to create STACKIT stackitclient: %v", err)
klog.Fatalf("Failed to create STACKIT provider: %v", err)

}

d.SetupControllerService(stackitProvider)
d.SetupControllerService(iaasClient)
}

if provideNodeService {
// Initialize mount
mountProvider := mount.GetMountProvider()

cfg, err := stackit.GetConfigFromFile(cloudConfig)
cfg, err := stackitclient.GetConfigFromFile(cloudConfig)
if err != nil {
klog.Fatal(err)
}
Expand Down
50 changes: 26 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,34 +53,36 @@ require (
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.22.1 // indirect
github.com/go-openapi/jsonreference v0.21.2 // indirect
github.com/go-openapi/swag v0.25.1 // indirect
github.com/go-openapi/swag/cmdutils v0.25.1 // indirect
github.com/go-openapi/swag/conv v0.25.1 // indirect
github.com/go-openapi/swag/fileutils v0.25.1 // indirect
github.com/go-openapi/swag/jsonname v0.25.1 // indirect
github.com/go-openapi/swag/jsonutils v0.25.1 // indirect
github.com/go-openapi/swag/loading v0.25.1 // indirect
github.com/go-openapi/swag/mangling v0.25.1 // indirect
github.com/go-openapi/swag/netutils v0.25.1 // indirect
github.com/go-openapi/swag/stringutils v0.25.1 // indirect
github.com/go-openapi/swag/typeutils v0.25.1 // indirect
github.com/go-openapi/swag/yamlutils v0.25.1 // indirect
github.com/go-openapi/jsonpointer v0.22.4 // indirect
github.com/go-openapi/jsonreference v0.21.4 // indirect
github.com/go-openapi/swag v0.25.4 // indirect
github.com/go-openapi/swag/cmdutils v0.25.4 // indirect
github.com/go-openapi/swag/conv v0.25.4 // indirect
github.com/go-openapi/swag/fileutils v0.25.4 // indirect
github.com/go-openapi/swag/jsonname v0.25.4 // indirect
github.com/go-openapi/swag/jsonutils v0.25.4 // indirect
github.com/go-openapi/swag/loading v0.25.4 // indirect
github.com/go-openapi/swag/mangling v0.25.4 // indirect
github.com/go-openapi/swag/netutils v0.25.4 // indirect
github.com/go-openapi/swag/stringutils v0.25.4 // indirect
github.com/go-openapi/swag/typeutils v0.25.4 // indirect
github.com/go-openapi/swag/yamlutils v0.25.4 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/goccy/go-yaml v1.19.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/cel-go v0.26.0 // indirect
github.com/google/gnostic-models v0.7.0 // indirect
github.com/google/cel-go v0.27.0 // indirect
github.com/google/gnostic-models v0.7.1 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/pprof v0.0.0-20260402051712-545e8a4df936 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12 // indirect
github.com/klauspost/compress v1.18.4 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/moby/sys/mountinfo v0.7.2 // indirect
github.com/moby/term v0.5.2 // indirect
Expand All @@ -90,9 +92,9 @@ require (
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.67.5 // indirect
github.com/prometheus/procfs v0.19.2 // indirect
github.com/prometheus/procfs v0.20.1 // indirect
github.com/sirupsen/logrus v1.9.4 // indirect
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.24.0 // indirect
github.com/stoewer/go-strcase v1.3.1 // indirect
github.com/stretchr/objx v0.5.3 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.etcd.io/etcd/api/v3 v3.6.8 // indirect
Expand All @@ -102,8 +104,8 @@ require (
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 // indirect
go.opentelemetry.io/otel v1.43.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 // indirect
go.opentelemetry.io/otel/metric v1.43.0 // indirect
go.opentelemetry.io/otel/sdk v1.43.0 // indirect
go.opentelemetry.io/otel/trace v1.43.0 // indirect
Expand All @@ -113,13 +115,13 @@ require (
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.50.0 // indirect
golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 // indirect
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa // indirect
golang.org/x/mod v0.35.0 // indirect
golang.org/x/net v0.53.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/term v0.42.0 // indirect
golang.org/x/text v0.36.0 // indirect
golang.org/x/time v0.14.0 // indirect
golang.org/x/time v0.15.0 // indirect
golang.org/x/tools v0.44.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260226221140-a57be14db171 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 // indirect
Expand Down
Loading