Skip to content

Commit 5118241

Browse files
🤖 Update module github.com/stackitcloud/stackit-sdk-go/services/iaas to v1.7.0 (#42)
* 🤖 Update module github.com/stackitcloud/stackit-sdk-go/services/iaas to v1.7.0 * use iaas v2 api Signed-off-by: Felix Breuer <f.breuer94@gmail.com> --------- Signed-off-by: Felix Breuer <f.breuer94@gmail.com> Co-authored-by: ske-renovate-ce[bot] <163154779+ske-renovate-ce[bot]@users.noreply.github.com> Co-authored-by: Felix Breuer <f.breuer94@gmail.com>
1 parent a97a903 commit 5118241

23 files changed

Lines changed: 1834 additions & 7958 deletions

File tree

‎Makefile‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ check: $(GOIMPORTS) $(GOLANGCI_LINT) $(HELM) ## Runs golangci-lint, gofmt/goimpo
110110
@bash $(GARDENER_HACK_DIR)/check-charts.sh ./charts
111111

112112
# generate mock types for the following services from the SDK (space-separated list)
113-
SDK_MOCK_SERVICES := iaas dns
113+
SDK_MOCK_SERVICES := dns
114114

115115
.PHONY: generate-mocks
116116
generate-mocks: $(MOCKGEN)
@@ -120,7 +120,13 @@ generate-mocks: $(MOCKGEN)
120120
INTERFACES=`go doc -all github.com/stackitcloud/stackit-sdk-go/services/$$service | grep '^type Api.* interface' | sed -n 's/^type \(.*\) interface.*/\1/p' | paste -sd,`,DefaultApi; \
121121
$(MOCKGEN) -destination ./pkg/stackit/client/mock/$$service/$$service.go -package $$service github.com/stackitcloud/stackit-sdk-go/services/$$service $$INTERFACES; \
122122
done
123-
@$(MOCKGEN) -destination ./pkg/stackit/client/mock/loadbalancer/loadbalancer.go -package loadbalancer github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api DefaultAPI
123+
124+
@$(MOCKGEN) -destination ./pkg/stackit/client/mock/loadbalancer/loadbalancer.go -package loadbalancer -imports loadbalancerv2api=github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api DefaultAPI
125+
@$(MOCKGEN) -destination ./pkg/stackit/client/mock/iaas/iaas.go -package iaas -imports iaasv2api=github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api DefaultAPI
126+
127+
@$(MOCKGEN) -destination ./pkg/stackit/client/mock/mocks.go -package client github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/stackit/client Factory,DNSClient
128+
@$(MOCKGEN) -destination ./pkg/stackit/client/mock/iaas_mock.go -package client github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/stackit/client IaaSClient
129+
@$(MOCKGEN) -destination ./pkg/stackit/client/mock/loadbalancing_mock.go -package client github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/stackit/client LoadBalancingClient
124130

125131
.PHONY: generate
126132
generate: $(CONTROLLER_GEN) $(GEN_CRD_API_REFERENCE_DOCS) $(HELM) $(MOCKGEN) $(YQ) $(YAML2JSON) $(GOIMPORTS) generate-mocks ## Generates the controller-registration, other code-gen, the imagename constants as well as executes go:generate directives

‎go.mod‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ require (
2525
github.com/stackitcloud/stackit-sdk-go/core v0.23.0
2626
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.14.1
2727
github.com/stackitcloud/stackit-sdk-go/services/dns v0.17.6
28-
github.com/stackitcloud/stackit-sdk-go/services/iaas v1.3.5
28+
github.com/stackitcloud/stackit-sdk-go/services/iaas v1.7.0
2929
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.11.0
3030
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.21.0
3131
github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.15.0

‎go.sum‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,8 @@ github.com/stackitcloud/stackit-sdk-go/services/authorization v0.14.1 h1:9qIh4vs
471471
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.14.1/go.mod h1:hZc0FvlEhN8zmlORsKLBjBep6iYAY/QLnoV1rDnY69A=
472472
github.com/stackitcloud/stackit-sdk-go/services/dns v0.17.6 h1:GBRb49x5Nax/oQQaaf2F3kKwv8DQQOL0TQOC0C/v/Ew=
473473
github.com/stackitcloud/stackit-sdk-go/services/dns v0.17.6/go.mod h1:IX9iL3MigDZUmzwswTJMfYvyi118KAHrFMfjJUy5NYk=
474-
github.com/stackitcloud/stackit-sdk-go/services/iaas v1.3.5 h1:W57+XRa8wTLsi5CV9Tqa7mGgt/PvlRM//RurXSmvII8=
475-
github.com/stackitcloud/stackit-sdk-go/services/iaas v1.3.5/go.mod h1:lTWjW57eAq1bwfM6nsNinhoBr3MHFW/GaFasdAsYfDM=
474+
github.com/stackitcloud/stackit-sdk-go/services/iaas v1.7.0 h1:WyOC7tEazOPF9PwlExsycYvhm2l9OcjGQfZHDAckVIc=
475+
github.com/stackitcloud/stackit-sdk-go/services/iaas v1.7.0/go.mod h1:78hDXs5sEokK2sAaBSn79kodytszmDYEAuMS56kPHIw=
476476
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.11.0 h1:81q4OIt54bw4Of5UP/sqXTgT8LkzeY+uHIgSvzQQl3w=
477477
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.11.0/go.mod h1:hjXxEkJ247sa9IxoACRK8oUvly7Hux2qnIw7rj4c6xs=
478478
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.21.0 h1:ey0wPQLM9DjQPcpTFsJHYuNu1huCKBxi9Pc5XFdIWNA=

‎pkg/controller/bastion/actuator.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1"
1111
"github.com/gardener/gardener/pkg/controllerutils/reconciler"
1212
"github.com/go-logr/logr"
13-
iaaswait "github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
13+
iaaswait "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api/wait"
1414
corev1 "k8s.io/api/core/v1"
1515
"k8s.io/apimachinery/pkg/runtime"
1616
"k8s.io/apimachinery/pkg/runtime/serializer"

‎pkg/controller/bastion/resources.go‎

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

77
"github.com/go-logr/logr"
8-
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
8+
iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api"
99

1010
stackitclient "github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/stackit/client"
1111
)

‎pkg/controller/bastion/resources_public_ip.go‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import (
55
"fmt"
66

77
"github.com/go-logr/logr"
8-
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
9-
"k8s.io/utils/ptr"
8+
iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api"
109

1110
"github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/stackit"
1211
)
@@ -15,7 +14,7 @@ func (r *Resources) reconcilePublicIP(ctx context.Context, log logr.Logger) erro
1514
if r.PublicIP == nil {
1615
var err error
1716
r.PublicIP, err = r.IaaS.CreatePublicIp(ctx, iaas.CreatePublicIPPayload{
18-
Labels: new(stackit.ToLabels(r.Labels)),
17+
Labels: stackit.ToLabels(r.Labels),
1918
})
2019
if err != nil {
2120
return fmt.Errorf("error creating public IP: %w", err)
@@ -24,7 +23,7 @@ func (r *Resources) reconcilePublicIP(ctx context.Context, log logr.Logger) erro
2423
log.Info("Created public IP", "publicIP", r.PublicIP.GetId())
2524
}
2625

27-
if networkInterface := ptr.Deref(r.PublicIP.GetNetworkInterface(), ""); networkInterface != "" {
26+
if networkInterface := r.PublicIP.GetNetworkInterface(); networkInterface != "" {
2827
log.V(1).Info("Public IP is already associated with network interface", "publicIP", r.PublicIP.GetId(), "networkInterface", networkInterface)
2928
return nil
3029
}

‎pkg/controller/bastion/resources_security_group.go‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"net/netip"
77

88
"github.com/go-logr/logr"
9-
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
9+
iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api"
1010

1111
"github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/stackit"
1212
stackitclient "github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/stackit/client"
@@ -20,8 +20,8 @@ func (r *Resources) reconcileSecurityGroup(ctx context.Context, log logr.Logger)
2020
if r.SecurityGroup == nil {
2121
var err error
2222
r.SecurityGroup, err = r.IaaS.CreateSecurityGroup(ctx, iaas.CreateSecurityGroupPayload{
23-
Name: new(r.ResourceName),
24-
Labels: new(stackit.ToLabels(r.Labels)),
23+
Name: r.ResourceName,
24+
Labels: stackit.ToLabels(r.Labels),
2525

2626
Description: new("Security group for Bastion " + r.Bastion.Name),
2727
})
@@ -61,7 +61,7 @@ func (o *Options) determineWantedSecurityGroupRules() ([]iaas.SecurityGroupRule,
6161
// DHCP tells us our IP and the route to the metadata server
6262
Description: new("Allow DHCP requests"),
6363

64-
Direction: new(stackit.DirectionEgress),
64+
Direction: stackit.DirectionEgress,
6565
Ethertype: new(stackit.EtherTypeIPv4),
6666
Protocol: new(stackit.ProtocolUDP),
6767
PortRange: iaas.NewPortRange(68, 67),
@@ -71,7 +71,7 @@ func (o *Options) determineWantedSecurityGroupRules() ([]iaas.SecurityGroupRule,
7171
{
7272
Description: new("Allow egress to metadata server"),
7373

74-
Direction: new(stackit.DirectionEgress),
74+
Direction: stackit.DirectionEgress,
7575
Ethertype: new(stackit.EtherTypeIPv4),
7676
Protocol: new(stackit.ProtocolTCP),
7777
PortRange: iaas.NewPortRange(80, 80),
@@ -81,7 +81,7 @@ func (o *Options) determineWantedSecurityGroupRules() ([]iaas.SecurityGroupRule,
8181
{
8282
Description: new(fmt.Sprintf("Allow egress from Bastion %s to %s worker nodes", o.Bastion.Name, o.TechnicalID)),
8383

84-
Direction: new(stackit.DirectionEgress),
84+
Direction: stackit.DirectionEgress,
8585
Ethertype: new(stackit.EtherTypeIPv4),
8686
Protocol: new(stackit.ProtocolTCP),
8787
PortRange: portRangeSSH,
@@ -95,7 +95,7 @@ func (o *Options) determineWantedSecurityGroupRules() ([]iaas.SecurityGroupRule,
9595
rules = append(rules, iaas.SecurityGroupRule{
9696
Description: new(fmt.Sprintf("Allow ingress to Bastion %s from world", o.Bastion.Name)),
9797

98-
Direction: new(stackit.DirectionIngress),
98+
Direction: stackit.DirectionIngress,
9999
Ethertype: new(stackit.EtherTypeIPv4),
100100
Protocol: new(stackit.ProtocolTCP),
101101
PortRange: portRangeSSH,
@@ -120,7 +120,7 @@ func (o *Options) determineWantedSecurityGroupRules() ([]iaas.SecurityGroupRule,
120120
rules = append(rules, iaas.SecurityGroupRule{
121121
Description: new(fmt.Sprintf("Allow ingress to Bastion %s from %s", o.Bastion.Name, normalizedCIDR)),
122122

123-
Direction: new(stackit.DirectionIngress),
123+
Direction: stackit.DirectionIngress,
124124
Ethertype: new(etherType),
125125
Protocol: new(stackit.ProtocolTCP),
126126
PortRange: portRangeSSH,
@@ -137,7 +137,7 @@ func (r *Resources) reconcileWorkerSecurityGroupRule(ctx context.Context, log lo
137137
wantedRule := iaas.SecurityGroupRule{
138138
Description: new(fmt.Sprintf("Allow ingress to shoot worker nodes from Bastion %s", r.Bastion.Name)),
139139

140-
Direction: new(stackit.DirectionIngress),
140+
Direction: stackit.DirectionIngress,
141141
Ethertype: new(stackit.EtherTypeIPv4),
142142
Protocol: new(stackit.ProtocolTCP),
143143
PortRange: portRangeSSH,

‎pkg/controller/bastion/resources_security_group_test.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1"
77
. "github.com/onsi/ginkgo/v2"
88
. "github.com/onsi/gomega"
9-
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
9+
iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api"
1010
networkingv1 "k8s.io/api/networking/v1"
1111
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1212

@@ -47,7 +47,7 @@ var _ = Describe("Security Group", func() {
4747
iaas.SecurityGroupRule{
4848
Description: new(fmt.Sprintf("Allow ingress to Bastion %s from %s", o.Bastion.Name, "1.2.3.4/32")),
4949

50-
Direction: new(stackit.DirectionIngress),
50+
Direction: stackit.DirectionIngress,
5151
Ethertype: new(stackit.EtherTypeIPv4),
5252
Protocol: new(stackit.ProtocolTCP),
5353
PortRange: iaas.NewPortRange(22, 22),
@@ -57,7 +57,7 @@ var _ = Describe("Security Group", func() {
5757
iaas.SecurityGroupRule{
5858
Description: new(fmt.Sprintf("Allow ingress to Bastion %s from %s", o.Bastion.Name, "2001:db8:1::/48")),
5959

60-
Direction: new(stackit.DirectionIngress),
60+
Direction: stackit.DirectionIngress,
6161
Ethertype: new(stackit.EtherTypeIPv6),
6262
Protocol: new(stackit.ProtocolTCP),
6363
PortRange: iaas.NewPortRange(22, 22),
@@ -74,7 +74,7 @@ var _ = Describe("Security Group", func() {
7474
iaas.SecurityGroupRule{
7575
Description: new(fmt.Sprintf("Allow ingress to Bastion %s from world", o.Bastion.Name)),
7676

77-
Direction: new(stackit.DirectionIngress),
77+
Direction: stackit.DirectionIngress,
7878
Ethertype: new(stackit.EtherTypeIPv4),
7979
Protocol: new(stackit.ProtocolTCP),
8080
PortRange: iaas.NewPortRange(22, 22),

‎pkg/controller/bastion/resources_server.go‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package bastion
22

33
import (
44
"context"
5+
"encoding/base64"
56
"fmt"
67

78
"github.com/go-logr/logr"
8-
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
9+
iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api"
910

1011
"github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/stackit"
1112
)
@@ -18,24 +19,24 @@ func (r *Resources) reconcileServer(ctx context.Context, log logr.Logger) error
1819

1920
var err error
2021
r.Server, err = r.IaaS.CreateServer(ctx, iaas.CreateServerPayload{
21-
Name: new(r.ResourceName),
22-
Labels: new(stackit.ToLabels(r.Labels)),
22+
Name: r.ResourceName,
23+
Labels: stackit.ToLabels(r.Labels),
2324

2425
AvailabilityZone: new(r.AvailabilityZone),
25-
MachineType: new(r.MachineType),
26-
BootVolume: &iaas.ServerBootVolume{
26+
MachineType: r.MachineType,
27+
BootVolume: &iaas.BootVolume{
2728
DeleteOnTermination: new(true),
2829
Source: iaas.NewBootVolumeSource(r.ImageID, "image"),
2930
// TODO: make size and performance class configurable
3031
Size: new(int64(10)),
3132
},
3233

33-
SecurityGroups: new([]string{r.SecurityGroup.GetId()}),
34-
Networking: new(iaas.CreateServerNetworkingAsCreateServerPayloadAllOfNetworking(&iaas.CreateServerNetworking{
34+
SecurityGroups: []string{r.SecurityGroup.GetId()},
35+
Networking: iaas.CreateServerNetworkingAsCreateServerPayloadAllOfNetworking(&iaas.CreateServerNetworking{
3536
NetworkId: new(r.NetworkID),
36-
})),
37+
}),
3738

38-
UserData: new(r.Bastion.Spec.UserData),
39+
UserData: new(base64.StdEncoding.EncodeToString(r.Bastion.Spec.UserData)),
3940
})
4041
if err != nil {
4142
return fmt.Errorf("error creating server: %w", err)

‎pkg/controller/bastion/resources_test.go‎

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ package bastion
22

33
import (
44
"context"
5+
"encoding/base64"
56
"net/http"
67

78
extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1"
89
"github.com/go-logr/logr"
910
. "github.com/onsi/ginkgo/v2"
1011
. "github.com/onsi/gomega"
11-
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
12+
iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api"
1213
"go.uber.org/mock/gomock"
1314
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1415

@@ -47,10 +48,10 @@ var _ = Describe("Bastion Resources", func() {
4748
resources.ResourceName = "test-resource"
4849
resources.Labels = map[string]string{"test-labels-key": "test-labels-value"}
4950

50-
expectedSecurityGroup := []iaas.SecurityGroup{{Name: new("test-security-group")}}
51+
expectedSecurityGroup := []iaas.SecurityGroup{{Name: "test-security-group"}}
5152
mockIaaS.EXPECT().GetSecurityGroupByName(ctx, resources.ResourceName).Return(expectedSecurityGroup, nil)
5253

53-
expectedServer := []iaas.Server{{Name: new("test-server")}}
54+
expectedServer := []iaas.Server{{Name: "test-server"}}
5455
mockIaaS.EXPECT().GetServerByName(ctx, resources.ResourceName).Return(expectedServer, nil)
5556

5657
expectedPublicIP := []iaas.PublicIp{{Id: new("test-ip")}}
@@ -157,7 +158,7 @@ var _ = Describe("Bastion Resources", func() {
157158
}
158159
resources.PublicIP = &iaas.PublicIp{
159160
Id: new("test-public-ip"),
160-
NetworkInterface: iaas.NewNullableString(new("test-interface")),
161+
NetworkInterface: *iaas.NewNullableString(new("test-interface")),
161162
}
162163

163164
err := resources.reconcilePublicIP(ctx, logger)
@@ -222,23 +223,23 @@ var _ = Describe("Bastion Resources", func() {
222223
resources.SecurityGroup = &iaas.SecurityGroup{Id: new("test-security-group")}
223224

224225
expectedPayload := iaas.CreateServerPayload{
225-
Name: new("test-resource"),
226-
Labels: new(stackit.ToLabels(map[string]string{
226+
Name: "test-resource",
227+
Labels: stackit.ToLabels(map[string]string{
227228
"test-label-key": "test-label-value",
228-
})),
229+
}),
229230
AvailabilityZone: new("test-az"),
230-
MachineType: new("test-machine"),
231-
BootVolume: &iaas.ServerBootVolume{
231+
MachineType: "test-machine",
232+
BootVolume: &iaas.BootVolume{
232233
DeleteOnTermination: new(true),
233234
Source: iaas.NewBootVolumeSource("test-image", "image"),
234235
Size: new(int64(10)),
235236
},
236-
SecurityGroups: new([]string{"test-security-group"}),
237-
Networking: new(iaas.CreateServerNetworkingAsCreateServerPayloadAllOfNetworking(&iaas.CreateServerNetworking{
237+
SecurityGroups: []string{"test-security-group"},
238+
Networking: iaas.CreateServerNetworkingAsCreateServerPayloadAllOfNetworking(&iaas.CreateServerNetworking{
238239
NetworkId: new("test-network"),
239-
})),
240+
}),
240241

241-
UserData: new([]byte{1, 2, 3, 4}),
242+
UserData: new(base64.StdEncoding.EncodeToString([]byte{1, 2, 3, 4})),
242243
}
243244
expectedServer := &iaas.Server{
244245
Id: new("test-server"),
@@ -292,8 +293,8 @@ var _ = Describe("Bastion Resources", func() {
292293
}
293294

294295
expectedPayload := iaas.CreateSecurityGroupPayload{
295-
Name: new("test-resource"),
296-
Labels: new(stackit.ToLabels(map[string]string{"test-labels-key": "test-labels-value"})),
296+
Name: "test-resource",
297+
Labels: stackit.ToLabels(map[string]string{"test-labels-key": "test-labels-value"}),
297298
Description: new("Security group for Bastion test-bastion"),
298299
}
299300
expectedSecurityGroup := &iaas.SecurityGroup{

0 commit comments

Comments
 (0)