-
Notifications
You must be signed in to change notification settings - Fork 3
clean up stackit client #1060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aniruddha2000
wants to merge
44
commits into
main
Choose a base branch
from
cleanup-stackit-client
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
clean up stackit client #1060
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 b90f248
add volume methods
aniruddha2000 df7f754
add volume methods in interface
aniruddha2000 01d36a1
add filter funcs and nits
aniruddha2000 7aa7f86
add client build code and helpers
aniruddha2000 41415c3
replace loadbalancer calls
aniruddha2000 86cc7ed
replace iaas calls
aniruddha2000 a654b37
fix waitbackup ready and replace more calls
aniruddha2000 b08e6d7
fix more calls
aniruddha2000 252da5c
replace client creation in main.go
aniruddha2000 77ae60c
add cmd/controllerserver.go
aniruddha2000 5fd66e3
add mocks and fix iaas and loadbalancing option
aniruddha2000 5ba3d9c
add replace with new mock and old client imports with new
aniruddha2000 99f1a10
add test cases for the iaas methods
aniruddha2000 0957998
delete old client and mocks
aniruddha2000 432d00d
add fmt
aniruddha2000 890ceee
make verify
aniruddha2000 46d5bcf
make seperate test package
aniruddha2000 1591145
push rest of the tests
aniruddha2000 8ba163a
remove unused code
aniruddha2000 6b94f97
rename test package
aniruddha2000 3650654
rename further packages
aniruddha2000 27da084
make fmt
aniruddha2000 49095bf
fix lints
aniruddha2000 f1920c7
fix lintts
aniruddha2000 681228f
fix iaas tests with mock default api
aniruddha2000 32c56ef
convert back from client_test to client in tests
aniruddha2000 00ef51c
fix list return elements
aniruddha2000 893705b
remove labels casting
aniruddha2000 eecae5b
remove labels casting
aniruddha2000 3202cd6
fix test api calls
aniruddha2000 8cd3749
rebase go.mod
aniruddha2000 a5f8a05
make typed in IaaS client mock
aniruddha2000 71c0522
use typed in loadbalancer mock
aniruddha2000 281d9da
fix test with broken type in DoAndReturn
aniruddha2000 227913d
fix csi test case and bring back return string
aniruddha2000 238400d
fix mission region
aniruddha2000 cff9598
fix detatch volume logic
aniruddha2000 2729b7e
remove ErrNotFound custom error and use generic openapi error
aniruddha2000 89cf960
bring back reqID in the client
aniruddha2000 f41901d
remove region env var and retrieve from config instead
aniruddha2000 9f381fc
fix rebase
aniruddha2000 b1bbea0
fix format
aniruddha2000 8b8b445
fix format
aniruddha2000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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 ( | ||||||
|
|
@@ -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) | ||||||
|
|
@@ -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 | ||||||
| } | ||||||
|
|
||||||
| 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) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| } | ||||||
|
|
||||||
| 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) | ||||||
| } | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?