Skip to content

clean up stackit client#1060

Open
aniruddha2000 wants to merge 44 commits into
mainfrom
cleanup-stackit-client
Open

clean up stackit client#1060
aniruddha2000 wants to merge 44 commits into
mainfrom
cleanup-stackit-client

Conversation

@aniruddha2000
Copy link
Copy Markdown
Member

How to categorize this PR?

/kind cleanup

What this PR does / why we need it:

This PR introduces clean up for the stackit client and the mocks.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Breaking changes:

@ske-prow ske-prow Bot added the kind/cleanup Something that is not needed anymore and can be cleaned up label May 4, 2026
@ske-prow
Copy link
Copy Markdown

ske-prow Bot commented May 4, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign olegvanhorst for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ske-prow ske-prow Bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 4, 2026
Comment thread pkg/stackit/filter_test.go Outdated
@aniruddha2000 aniruddha2000 force-pushed the cleanup-stackit-client branch 3 times, most recently from 1819545 to 34cd84b Compare May 18, 2026 09:32
@ske-prow ske-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 18, 2026
@ske-prow ske-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 28, 2026
@aniruddha2000 aniruddha2000 force-pushed the cleanup-stackit-client branch from 391a765 to 9f381fc Compare June 3, 2026 09:32
@ske-prow ske-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 3, 2026
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?

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)

Comment thread pkg/ccm/instances.go
type Instances struct {
regionProviderID bool
iaasClient stackit.NodeClient
iaasClient stackitclient.IaaSClient
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.

Should this maybe be a ptr?

loadBalancer.GetLoadBalancerName(context.Background(), clusterName, svc),
versionMatcher("current-version"),
).MinTimes(1).Return(myLb, nil)
).MinTimes(1).Return(nil)
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.

Why is the return "myLB" gone?

),
).MinTimes(1).Return(myLb, nil),
mockClient.EXPECT().DeleteCredentials(gomock.Any(), projectID, gomock.Any()).MinTimes(1).Return(nil),
).MinTimes(1).Return(nil),
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.

Same here

payload := iaas.ResizeVolumePayload{
Size: volSizeGB,
}
err = cloud.ExpandVolume(ctx, volumeID, *volume.Status, payload)
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
err = cloud.ExpandVolume(ctx, volumeID, *volume.Status, payload)
err = cloud.ExpandVolume(ctx, volumeID, *volume.Status, iaas.ResizeVolumePayload{Size: volSizeGB})

Can we put this into one line?

Do(func(_ context.Context, opts *iaas.CreateVolumePayload) {
iaasClient.EXPECT().
CreateVolume(gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, opts *iaas.CreateVolumePayload) (*iaas.Volume, error) {
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.

Why was the Do changed into DoAndREturn?

}, nil
}

func (i iaasClient) GetServer(ctx context.Context, serverID string) (*iaas.Server, error) {
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.

Why is this a value receiver instead of a pointer reviewer?

func (i *iaasClient) 

vs

func (i iaasClient) 

}, nil
}

func (l loadBalancingClient) CreateLoadBalancer(ctx context.Context, payload *loadbalancer.CreateLoadBalancerPayload) (*loadbalancer.LoadBalancer, error) {
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.

Why the value receiver? See above IaaSClient

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.

We should also here add the X-Request-Id header copy to error message wrapper.

I would prefer however if we can find a way to make this prettier than individually wrapping each call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Something that is not needed anymore and can be cleaned up size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants