diff --git a/go.mod b/go.mod index 7194671c..4b426916 100644 --- a/go.mod +++ b/go.mod @@ -22,12 +22,12 @@ require ( github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.10.2 github.com/spf13/pflag v1.0.10 - github.com/stackitcloud/stackit-sdk-go/core v0.22.0 + github.com/stackitcloud/stackit-sdk-go/core v0.23.0 github.com/stackitcloud/stackit-sdk-go/services/authorization v0.12.0 github.com/stackitcloud/stackit-sdk-go/services/dns v0.17.6 - github.com/stackitcloud/stackit-sdk-go/services/iaas v1.3.5 + github.com/stackitcloud/stackit-sdk-go/services/iaas v1.7.0 github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.8.0 - github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.19.0 + github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.20.1 github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.12.0 go.uber.org/atomic v1.11.0 go.uber.org/mock v0.6.0 diff --git a/go.sum b/go.sum index 5ee3d596..9152def7 100644 --- a/go.sum +++ b/go.sum @@ -465,18 +465,18 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stackitcloud/stackit-sdk-go/core v0.22.0 h1:6rViz7GnNwXSh51Lur5xuDzO8EWSZfN9J0HvEkBKq6c= -github.com/stackitcloud/stackit-sdk-go/core v0.22.0/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI= +github.com/stackitcloud/stackit-sdk-go/core v0.23.0 h1:zPrOhf3Xe47rKRs1fg/AqKYUiJJRYjdcv+3qsS50mEs= +github.com/stackitcloud/stackit-sdk-go/core v0.23.0/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI= github.com/stackitcloud/stackit-sdk-go/services/authorization v0.12.0 h1:HxPgBu04j5tj6nfZ2r0l6v4VXC0/tYOGe4sA5Addra8= github.com/stackitcloud/stackit-sdk-go/services/authorization v0.12.0/go.mod h1:uYI9pHAA2g84jJN25ejFUxa0/JtfpPZqMDkctQ1BzJk= github.com/stackitcloud/stackit-sdk-go/services/dns v0.17.6 h1:GBRb49x5Nax/oQQaaf2F3kKwv8DQQOL0TQOC0C/v/Ew= github.com/stackitcloud/stackit-sdk-go/services/dns v0.17.6/go.mod h1:IX9iL3MigDZUmzwswTJMfYvyi118KAHrFMfjJUy5NYk= -github.com/stackitcloud/stackit-sdk-go/services/iaas v1.3.5 h1:W57+XRa8wTLsi5CV9Tqa7mGgt/PvlRM//RurXSmvII8= -github.com/stackitcloud/stackit-sdk-go/services/iaas v1.3.5/go.mod h1:lTWjW57eAq1bwfM6nsNinhoBr3MHFW/GaFasdAsYfDM= +github.com/stackitcloud/stackit-sdk-go/services/iaas v1.7.0 h1:WyOC7tEazOPF9PwlExsycYvhm2l9OcjGQfZHDAckVIc= +github.com/stackitcloud/stackit-sdk-go/services/iaas v1.7.0/go.mod h1:78hDXs5sEokK2sAaBSn79kodytszmDYEAuMS56kPHIw= github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.8.0 h1:DxrN85V738CRLynu6MULQHO+OXyYnkhVPgoZKULfFIs= github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.8.0/go.mod h1:ClPE4TOM1FeaJiwTXvApq4gWaSgTLq6nU3PPHAIQDN4= -github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.19.0 h1:OcjYHjTsKLlOz8GF2owYdJK0cUqGGzjHRQLYUH0vMnQ= -github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.19.0/go.mod h1:jiPIzF8lcm5Dx0TkDK2CBgeRBHSRUqwyX+z/zqo1bes= +github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.20.1 h1:IvZqEXjRjXrkjY0aSZFZ5zccOr2ZB+fj+N8AG46ajC4= +github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.20.1/go.mod h1:yjrIuyp6+6RCYTiP77NGV1DniULFyhLTz9B5ebwvF40= github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.12.0 h1:l1EDIlXce2C8JcbBDHVa6nZ4SjPTqmnALTgrhms+NKI= github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.12.0/go.mod h1:EXq8/J7t9p8zPmdIq+atuxyAbnQwxrQT18fI+Qpv98k= github.com/stoewer/go-strcase v1.3.1 h1:iS0MdW+kVTxgMoE1LAZyMiYJFKlOzLooE4MxjirtkAs= diff --git a/pkg/controller/bastion/actuator.go b/pkg/controller/bastion/actuator.go index 7568e67e..bbc2626c 100644 --- a/pkg/controller/bastion/actuator.go +++ b/pkg/controller/bastion/actuator.go @@ -10,7 +10,7 @@ import ( extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" "github.com/gardener/gardener/pkg/controllerutils/reconciler" "github.com/go-logr/logr" - iaaswait "github.com/stackitcloud/stackit-sdk-go/services/iaas/wait" + iaaswait "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api/wait" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer" diff --git a/pkg/controller/bastion/resources.go b/pkg/controller/bastion/resources.go index 03d79706..47821e18 100644 --- a/pkg/controller/bastion/resources.go +++ b/pkg/controller/bastion/resources.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/go-logr/logr" - "github.com/stackitcloud/stackit-sdk-go/services/iaas" + iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api" stackitclient "github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/stackit/client" ) diff --git a/pkg/controller/bastion/resources_public_ip.go b/pkg/controller/bastion/resources_public_ip.go index 10c52d99..1a9e15a0 100644 --- a/pkg/controller/bastion/resources_public_ip.go +++ b/pkg/controller/bastion/resources_public_ip.go @@ -5,8 +5,7 @@ import ( "fmt" "github.com/go-logr/logr" - "github.com/stackitcloud/stackit-sdk-go/services/iaas" - "k8s.io/utils/ptr" + iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api" "github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/stackit" ) @@ -15,7 +14,7 @@ func (r *Resources) reconcilePublicIP(ctx context.Context, log logr.Logger) erro if r.PublicIP == nil { var err error r.PublicIP, err = r.IaaS.CreatePublicIp(ctx, iaas.CreatePublicIPPayload{ - Labels: new(stackit.ToLabels(r.Labels)), + Labels: stackit.ToLabels(r.Labels), }) if err != nil { return fmt.Errorf("error creating public IP: %w", err) @@ -24,7 +23,7 @@ func (r *Resources) reconcilePublicIP(ctx context.Context, log logr.Logger) erro log.Info("Created public IP", "publicIP", r.PublicIP.GetId()) } - if networkInterface := ptr.Deref(r.PublicIP.GetNetworkInterface(), ""); networkInterface != "" { + if networkInterface := r.PublicIP.GetNetworkInterface(); networkInterface != "" { log.V(1).Info("Public IP is already associated with network interface", "publicIP", r.PublicIP.GetId(), "networkInterface", networkInterface) return nil } diff --git a/pkg/controller/bastion/resources_security_group.go b/pkg/controller/bastion/resources_security_group.go index 82650441..fc41bac6 100644 --- a/pkg/controller/bastion/resources_security_group.go +++ b/pkg/controller/bastion/resources_security_group.go @@ -6,7 +6,7 @@ import ( "net/netip" "github.com/go-logr/logr" - "github.com/stackitcloud/stackit-sdk-go/services/iaas" + iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api" "github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/stackit" 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) if r.SecurityGroup == nil { var err error r.SecurityGroup, err = r.IaaS.CreateSecurityGroup(ctx, iaas.CreateSecurityGroupPayload{ - Name: new(r.ResourceName), - Labels: new(stackit.ToLabels(r.Labels)), + Name: r.ResourceName, + Labels: stackit.ToLabels(r.Labels), Description: new("Security group for Bastion " + r.Bastion.Name), }) @@ -61,7 +61,7 @@ func (o *Options) determineWantedSecurityGroupRules() ([]iaas.SecurityGroupRule, // DHCP tells us our IP and the route to the metadata server Description: new("Allow DHCP requests"), - Direction: new(stackit.DirectionEgress), + Direction: stackit.DirectionEgress, Ethertype: new(stackit.EtherTypeIPv4), Protocol: new(stackit.ProtocolUDP), PortRange: iaas.NewPortRange(68, 67), @@ -71,7 +71,7 @@ func (o *Options) determineWantedSecurityGroupRules() ([]iaas.SecurityGroupRule, { Description: new("Allow egress to metadata server"), - Direction: new(stackit.DirectionEgress), + Direction: stackit.DirectionEgress, Ethertype: new(stackit.EtherTypeIPv4), Protocol: new(stackit.ProtocolTCP), PortRange: iaas.NewPortRange(80, 80), @@ -81,7 +81,7 @@ func (o *Options) determineWantedSecurityGroupRules() ([]iaas.SecurityGroupRule, { Description: new(fmt.Sprintf("Allow egress from Bastion %s to %s worker nodes", o.Bastion.Name, o.TechnicalID)), - Direction: new(stackit.DirectionEgress), + Direction: stackit.DirectionEgress, Ethertype: new(stackit.EtherTypeIPv4), Protocol: new(stackit.ProtocolTCP), PortRange: portRangeSSH, @@ -95,7 +95,7 @@ func (o *Options) determineWantedSecurityGroupRules() ([]iaas.SecurityGroupRule, rules = append(rules, iaas.SecurityGroupRule{ Description: new(fmt.Sprintf("Allow ingress to Bastion %s from world", o.Bastion.Name)), - Direction: new(stackit.DirectionIngress), + Direction: stackit.DirectionIngress, Ethertype: new(stackit.EtherTypeIPv4), Protocol: new(stackit.ProtocolTCP), PortRange: portRangeSSH, @@ -120,7 +120,7 @@ func (o *Options) determineWantedSecurityGroupRules() ([]iaas.SecurityGroupRule, rules = append(rules, iaas.SecurityGroupRule{ Description: new(fmt.Sprintf("Allow ingress to Bastion %s from %s", o.Bastion.Name, normalizedCIDR)), - Direction: new(stackit.DirectionIngress), + Direction: stackit.DirectionIngress, Ethertype: new(etherType), Protocol: new(stackit.ProtocolTCP), PortRange: portRangeSSH, @@ -137,7 +137,7 @@ func (r *Resources) reconcileWorkerSecurityGroupRule(ctx context.Context, log lo wantedRule := iaas.SecurityGroupRule{ Description: new(fmt.Sprintf("Allow ingress to shoot worker nodes from Bastion %s", r.Bastion.Name)), - Direction: new(stackit.DirectionIngress), + Direction: stackit.DirectionIngress, Ethertype: new(stackit.EtherTypeIPv4), Protocol: new(stackit.ProtocolTCP), PortRange: portRangeSSH, diff --git a/pkg/controller/bastion/resources_security_group_test.go b/pkg/controller/bastion/resources_security_group_test.go index 22920eb9..5a7590d5 100644 --- a/pkg/controller/bastion/resources_security_group_test.go +++ b/pkg/controller/bastion/resources_security_group_test.go @@ -6,7 +6,7 @@ import ( extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/stackitcloud/stackit-sdk-go/services/iaas" + iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api" networkingv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -47,7 +47,7 @@ var _ = Describe("Security Group", func() { iaas.SecurityGroupRule{ Description: new(fmt.Sprintf("Allow ingress to Bastion %s from %s", o.Bastion.Name, "1.2.3.4/32")), - Direction: new(stackit.DirectionIngress), + Direction: stackit.DirectionIngress, Ethertype: new(stackit.EtherTypeIPv4), Protocol: new(stackit.ProtocolTCP), PortRange: iaas.NewPortRange(22, 22), @@ -57,7 +57,7 @@ var _ = Describe("Security Group", func() { iaas.SecurityGroupRule{ Description: new(fmt.Sprintf("Allow ingress to Bastion %s from %s", o.Bastion.Name, "2001:db8:1::/48")), - Direction: new(stackit.DirectionIngress), + Direction: stackit.DirectionIngress, Ethertype: new(stackit.EtherTypeIPv6), Protocol: new(stackit.ProtocolTCP), PortRange: iaas.NewPortRange(22, 22), @@ -74,7 +74,7 @@ var _ = Describe("Security Group", func() { iaas.SecurityGroupRule{ Description: new(fmt.Sprintf("Allow ingress to Bastion %s from world", o.Bastion.Name)), - Direction: new(stackit.DirectionIngress), + Direction: stackit.DirectionIngress, Ethertype: new(stackit.EtherTypeIPv4), Protocol: new(stackit.ProtocolTCP), PortRange: iaas.NewPortRange(22, 22), diff --git a/pkg/controller/bastion/resources_server.go b/pkg/controller/bastion/resources_server.go index d35b723d..f6abd0cb 100644 --- a/pkg/controller/bastion/resources_server.go +++ b/pkg/controller/bastion/resources_server.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/go-logr/logr" - "github.com/stackitcloud/stackit-sdk-go/services/iaas" + iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api" "github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/stackit" ) @@ -18,24 +18,24 @@ func (r *Resources) reconcileServer(ctx context.Context, log logr.Logger) error var err error r.Server, err = r.IaaS.CreateServer(ctx, iaas.CreateServerPayload{ - Name: new(r.ResourceName), - Labels: new(stackit.ToLabels(r.Labels)), + Name: r.ResourceName, + Labels: stackit.ToLabels(r.Labels), AvailabilityZone: new(r.AvailabilityZone), - MachineType: new(r.MachineType), - BootVolume: &iaas.ServerBootVolume{ + MachineType: r.MachineType, + BootVolume: &iaas.BootVolume{ DeleteOnTermination: new(true), Source: iaas.NewBootVolumeSource(r.ImageID, "image"), // TODO: make size and performance class configurable Size: new(int64(10)), }, - SecurityGroups: new([]string{r.SecurityGroup.GetId()}), - Networking: new(iaas.CreateServerNetworkingAsCreateServerPayloadAllOfNetworking(&iaas.CreateServerNetworking{ + SecurityGroups: []string{r.SecurityGroup.GetId()}, + Networking: iaas.CreateServerNetworkingAsCreateServerPayloadAllOfNetworking(&iaas.CreateServerNetworking{ NetworkId: new(r.NetworkID), - })), + }), - UserData: new(r.Bastion.Spec.UserData), + UserData: new(string(r.Bastion.Spec.UserData)), }) if err != nil { return fmt.Errorf("error creating server: %w", err) diff --git a/pkg/controller/bastion/resources_test.go b/pkg/controller/bastion/resources_test.go index fccd590c..0f6ac9a5 100644 --- a/pkg/controller/bastion/resources_test.go +++ b/pkg/controller/bastion/resources_test.go @@ -8,7 +8,7 @@ import ( "github.com/go-logr/logr" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/stackitcloud/stackit-sdk-go/services/iaas" + iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api" "go.uber.org/mock/gomock" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -47,10 +47,10 @@ var _ = Describe("Bastion Resources", func() { resources.ResourceName = "test-resource" resources.Labels = map[string]string{"test-labels-key": "test-labels-value"} - expectedSecurityGroup := []iaas.SecurityGroup{{Name: new("test-security-group")}} + expectedSecurityGroup := []iaas.SecurityGroup{{Name: "test-security-group"}} mockIaaS.EXPECT().GetSecurityGroupByName(ctx, resources.ResourceName).Return(expectedSecurityGroup, nil) - expectedServer := []iaas.Server{{Name: new("test-server")}} + expectedServer := []iaas.Server{{Name: "test-server"}} mockIaaS.EXPECT().GetServerByName(ctx, resources.ResourceName).Return(expectedServer, nil) expectedPublicIP := []iaas.PublicIp{{Id: new("test-ip")}} @@ -157,7 +157,7 @@ var _ = Describe("Bastion Resources", func() { } resources.PublicIP = &iaas.PublicIp{ Id: new("test-public-ip"), - NetworkInterface: iaas.NewNullableString(new("test-interface")), + NetworkInterface: *iaas.NewNullableString(new("test-interface")), } err := resources.reconcilePublicIP(ctx, logger) @@ -222,23 +222,23 @@ var _ = Describe("Bastion Resources", func() { resources.SecurityGroup = &iaas.SecurityGroup{Id: new("test-security-group")} expectedPayload := iaas.CreateServerPayload{ - Name: new("test-resource"), - Labels: new(stackit.ToLabels(map[string]string{ + Name: "test-resource", + Labels: stackit.ToLabels(map[string]string{ "test-label-key": "test-label-value", - })), + }), AvailabilityZone: new("test-az"), - MachineType: new("test-machine"), - BootVolume: &iaas.ServerBootVolume{ + MachineType: "test-machine", + BootVolume: &iaas.BootVolume{ DeleteOnTermination: new(true), Source: iaas.NewBootVolumeSource("test-image", "image"), Size: new(int64(10)), }, - SecurityGroups: new([]string{"test-security-group"}), - Networking: new(iaas.CreateServerNetworkingAsCreateServerPayloadAllOfNetworking(&iaas.CreateServerNetworking{ + SecurityGroups: []string{"test-security-group"}, + Networking: iaas.CreateServerNetworkingAsCreateServerPayloadAllOfNetworking(&iaas.CreateServerNetworking{ NetworkId: new("test-network"), - })), + }), - UserData: new([]byte{1, 2, 3, 4}), + UserData: new(string([]byte{1, 2, 3, 4})), } expectedServer := &iaas.Server{ Id: new("test-server"), @@ -292,8 +292,8 @@ var _ = Describe("Bastion Resources", func() { } expectedPayload := iaas.CreateSecurityGroupPayload{ - Name: new("test-resource"), - Labels: new(stackit.ToLabels(map[string]string{"test-labels-key": "test-labels-value"})), + Name: "test-resource", + Labels: stackit.ToLabels(map[string]string{"test-labels-key": "test-labels-value"}), Description: new("Security group for Bastion test-bastion"), } expectedSecurityGroup := &iaas.SecurityGroup{ diff --git a/pkg/controller/infrastructure/openstack/infraflow/reconcile.go b/pkg/controller/infrastructure/openstack/infraflow/reconcile.go index 062af254..abe75b65 100644 --- a/pkg/controller/infrastructure/openstack/infraflow/reconcile.go +++ b/pkg/controller/infrastructure/openstack/infraflow/reconcile.go @@ -523,7 +523,7 @@ func (fctx *FlowContext) ensureStackitSSHKeyPair(ctx context.Context) error { return err } if keyPair != nil { - publicKey := ptr.Deref(keyPair.PublicKey, "") + publicKey := keyPair.PublicKey // if the public keys are matching then return early. In all other cases we should be creating (or replacing) the keypair with a new one. if publicKey != "" && publicKey == string(fctx.infra.Spec.SSHPublicKey) { fctx.state.Set(NameKeyPair, *keyPair.Name) diff --git a/pkg/controller/infrastructure/stackit/infraflow/reconcile.go b/pkg/controller/infrastructure/stackit/infraflow/reconcile.go index a5cb1320..4257a488 100644 --- a/pkg/controller/infrastructure/stackit/infraflow/reconcile.go +++ b/pkg/controller/infrastructure/stackit/infraflow/reconcile.go @@ -9,7 +9,7 @@ import ( gardenv1beta1helper "github.com/gardener/gardener/pkg/api/core/v1beta1/helper" gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1" "github.com/gardener/gardener/pkg/utils/flow" - "github.com/stackitcloud/stackit-sdk-go/services/iaas" + iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api" "k8s.io/utils/ptr" "github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/controller/infrastructure/openstack/infraflow/shared" @@ -215,7 +215,7 @@ func (fctx *FlowContext) ensureStackitSSHKeyPair(ctx context.Context) error { return err } if keyPair != nil { - publicKey := ptr.Deref(keyPair.PublicKey, "") + publicKey := keyPair.PublicKey // if the public keys are matching then return early. In all other cases we should be creating (or replacing) the keypair with a new one. if publicKey != "" && publicKey == string(fctx.infra.Spec.SSHPublicKey) { fctx.state.Set(NameKeyPair, *keyPair.Name) @@ -245,7 +245,7 @@ func (fctx *FlowContext) ensureSecGroup(ctx context.Context) error { log := shared.LogFromContext(ctx) payload := iaas.CreateSecurityGroupPayload{ - Name: new(fctx.defaultSecurityGroupName()), + Name: fctx.defaultSecurityGroupName(), Description: new("Cluster Nodes"), } @@ -299,34 +299,34 @@ func (fctx *FlowContext) ensureSecGroupRules(ctx context.Context) error { desiredRules := []iaas.SecurityGroupRule{ { - Direction: new(stackit.DirectionIngress), + Direction: stackit.DirectionIngress, Ethertype: new(stackit.EtherTypeIPv4), RemoteSecurityGroupId: new(group.GetId()), Description: new("IPv4: allow all incoming traffic within the same security group"), }, { - Direction: new(stackit.DirectionEgress), + Direction: stackit.DirectionEgress, Ethertype: new(stackit.EtherTypeIPv4), Description: new("IPv4: allow all outgoing traffic"), }, { - Direction: new(stackit.DirectionIngress), + Direction: stackit.DirectionIngress, Ethertype: new(stackit.EtherTypeIPv4), Protocol: new(stackit.ProtocolTCP), PortRange: &iaas.PortRange{ - Max: new(int64(32767)), - Min: new(int64(30000)), + Max: int64(32767), + Min: int64(30000), }, IpRange: new(nodesCIDR), Description: new("IPv4: allow all incoming tcp traffic with port range 30000-32767"), }, { - Direction: new(stackit.DirectionIngress), + Direction: stackit.DirectionIngress, Ethertype: new(stackit.EtherTypeIPv4), Protocol: new(stackit.ProtocolUDP), PortRange: &iaas.PortRange{ - Max: new(int64(32767)), - Min: new(int64(30000)), + Max: int64(32767), + Min: int64(30000), }, IpRange: new(nodesCIDR), Description: new("IPv4: allow all incoming udp traffic with port range 30000-32767"), @@ -335,7 +335,7 @@ func (fctx *FlowContext) ensureSecGroupRules(ctx context.Context) error { if fctx.cluster.Shoot.Spec.Networking != nil && fctx.cluster.Shoot.Spec.Networking.Pods != nil { podCIDRRule := iaas.SecurityGroupRule{ - Direction: new(stackit.DirectionIngress), + Direction: stackit.DirectionIngress, Ethertype: new(stackit.EtherTypeIPv4), IpRange: new(*fctx.cluster.Shoot.Spec.Networking.Pods), Description: new("IPv4: allow all incoming traffic from cluster pod CIDR"), @@ -377,15 +377,15 @@ func (fctx *FlowContext) ensureIsolatedNetwork(ctx context.Context) error { network := iaas.CreateNetworkIPv4{ CreateNetworkIPv4WithPrefix: &iaas.CreateNetworkIPv4WithPrefix{ - Nameservers: new(dnsServers), - Prefix: new(fctx.workerCIDR()), + Nameservers: dnsServers, + Prefix: fctx.workerCIDR(), }, } desired := iaas.CreateIsolatedNetworkPayload{ Dhcp: new(true), Ipv4: new(network), - Name: new(fctx.technicalID), + Name: fctx.technicalID, } current, err := findExisting(ctx, fctx.state.Get(IdentifierNetwork), fctx.defaultNetworkName(), fctx.iaasClient.GetNetworkById, fctx.iaasClient.GetNetworkByName) if err != nil { @@ -424,8 +424,8 @@ func (fctx *FlowContext) ensureEgressIP(ctx context.Context) error { return fmt.Errorf("could not find IPv4 config in network: %s", network.GetId()) } routerIP, ok := network.Ipv4.GetPublicIpOk() - if ok { - result = append(result, routerIP) + if ok && routerIP != nil { + result = append(result, *routerIP) fctx.state.SetObject(IdentifierEgressCIDRs, result) return nil } diff --git a/pkg/stackit/client/iaas.go b/pkg/stackit/client/iaas.go index fc617842..39536a77 100644 --- a/pkg/stackit/client/iaas.go +++ b/pkg/stackit/client/iaas.go @@ -9,7 +9,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" sdkconfig "github.com/stackitcloud/stackit-sdk-go/core/config" - "github.com/stackitcloud/stackit-sdk-go/services/iaas" + iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api" stackitv1alpha1 "github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/apis/stackit/v1alpha1" "github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/stackit" @@ -49,7 +49,7 @@ type IaaSClient interface { } type iaasClient struct { - Client iaas.DefaultApi + Client iaas.DefaultAPI projectID string region string } @@ -142,7 +142,7 @@ func NewIaaSClient(region string, endpoints stackitv1alpha1.APIEndpoints, creden return nil, err } return &iaasClient{ - Client: apiClient, + Client: apiClient.DefaultAPI, projectID: credentials.ProjectID, region: region, }, nil @@ -165,12 +165,12 @@ func (c iaasClient) CreateSecurityGroup(ctx context.Context, payload iaas.Create } func (c iaasClient) DeleteSecurityGroup(ctx context.Context, securityGroupId string) error { - return c.Client.DeleteSecurityGroupExecute(ctx, c.projectID, c.region, securityGroupId) + return c.Client.DeleteSecurityGroup(ctx, c.projectID, c.region, securityGroupId).Execute() } // GetSecurityGroupByName finds the first security group with the given name. func (c iaasClient) GetSecurityGroupByName(ctx context.Context, name string) ([]iaas.SecurityGroup, error) { - securityGroups, err := c.Client.ListSecurityGroupsExecute(ctx, c.projectID, c.region) + securityGroups, err := c.Client.ListSecurityGroups(ctx, c.projectID, c.region).Execute() if err != nil { return nil, fmt.Errorf("error listing security groups: %w", err) } @@ -208,7 +208,7 @@ func (c iaasClient) ReconcileSecurityGroupRules(ctx context.Context, log logr.Lo ruleLog.V(1).Info("Found existing security group rule") } else { // delete unwanted rule - if err := c.Client.DeleteSecurityGroupRuleExecute(ctx, c.projectID, c.region, securityGroup.GetId(), existingRule.GetId()); err != nil { + if err := c.Client.DeleteSecurityGroupRule(ctx, c.projectID, c.region, securityGroup.GetId(), existingRule.GetId()).Execute(); err != nil { return fmt.Errorf("error deleting unwanted security group rule %s in group %s: %w", existingRule.GetId(), securityGroup.GetId(), err) } @@ -282,12 +282,12 @@ func (c iaasClient) CreateServer(ctx context.Context, payload iaas.CreateServerP } func (c iaasClient) DeleteServer(ctx context.Context, serverId string) error { - return c.Client.DeleteServerExecute(ctx, c.projectID, c.region, serverId) + return c.Client.DeleteServer(ctx, c.projectID, c.region, serverId).Execute() } // GetServerByName finds the first server with the given name. func (c iaasClient) GetServerByName(ctx context.Context, name string) ([]iaas.Server, error) { - servers, err := c.Client.ListServersExecute(ctx, c.projectID, c.region) + servers, err := c.Client.ListServers(ctx, c.projectID, c.region).Execute() if err != nil { return nil, fmt.Errorf("error listing servers: %w", err) } @@ -305,13 +305,13 @@ func (c iaasClient) CreatePublicIp(ctx context.Context, payload iaas.CreatePubli } func (c iaasClient) DeletePublicIp(ctx context.Context, publicIpId string) error { - return c.Client.DeletePublicIPExecute(ctx, c.projectID, c.region, publicIpId) + return c.Client.DeletePublicIP(ctx, c.projectID, c.region, publicIpId).Execute() } // GetPublicIpByLabels finds the first public IP that matches the given label selector. Public IPs don't have a name, // so matching by label is our best option. func (c iaasClient) GetPublicIpByLabels(ctx context.Context, selector stackit.LabelSelector) ([]iaas.PublicIp, error) { - publicIPs, err := c.Client.ListPublicIPsExecute(ctx, c.projectID, c.region) + publicIPs, err := c.Client.ListPublicIPs(ctx, c.projectID, c.region).Execute() if err != nil { return nil, fmt.Errorf("error listing public IPs: %w", err) } @@ -325,11 +325,11 @@ func (c iaasClient) GetPublicIpByLabels(ctx context.Context, selector stackit.La } func (c iaasClient) AddPublicIpToServer(ctx context.Context, serverId, publicIpId string) error { - return c.Client.AddPublicIpToServerExecute(ctx, c.projectID, c.region, serverId, publicIpId) + return c.Client.AddPublicIpToServer(ctx, c.projectID, c.region, serverId, publicIpId).Execute() } func (c iaasClient) GetKeypair(ctx context.Context, name string) (*iaas.Keypair, error) { - keypair, err := c.Client.GetKeyPairExecute(ctx, name) + keypair, err := c.Client.GetKeyPair(ctx, name).Execute() if IsNotFound(err) { return nil, nil } @@ -337,18 +337,18 @@ func (c iaasClient) GetKeypair(ctx context.Context, name string) (*iaas.Keypair, } func (c iaasClient) CreateKeypair(ctx context.Context, name, publicKey string) (*iaas.Keypair, error) { - return c.Client.CreateKeyPair(ctx).CreateKeyPairPayload(iaas.CreateKeyPairPayload{Name: &name, PublicKey: &publicKey}).Execute() + return c.Client.CreateKeyPair(ctx).CreateKeyPairPayload(iaas.CreateKeyPairPayload{Name: &name, PublicKey: publicKey}).Execute() } func (c iaasClient) DeleteKeypair(ctx context.Context, name string) error { - return c.Client.DeleteKeyPairExecute(ctx, name) + return c.Client.DeleteKeyPair(ctx, name).Execute() } func IsolatedNetworkToPartialUpdate(network iaas.CreateIsolatedNetworkPayload) iaas.PartialUpdateNetworkPayload { return iaas.PartialUpdateNetworkPayload{ Dhcp: network.Dhcp, Labels: network.Labels, - Name: network.Name, + Name: &network.Name, Ipv4: &iaas.UpdateNetworkIPv4Body{ Gateway: network.Ipv4.CreateNetworkIPv4WithPrefix.Gateway, Nameservers: network.Ipv4.CreateNetworkIPv4WithPrefix.Nameservers, diff --git a/pkg/stackit/client/mock/mocks.go b/pkg/stackit/client/mock/mocks.go index 69caec90..1a32240f 100644 --- a/pkg/stackit/client/mock/mocks.go +++ b/pkg/stackit/client/mock/mocks.go @@ -16,7 +16,7 @@ import ( logr "github.com/go-logr/logr" stackit "github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/stackit" client "github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/stackit/client" - iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas" + v2api "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api" loadbalancer "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer" gomock "go.uber.org/mock/gomock" v1 "k8s.io/api/core/v1" @@ -131,10 +131,10 @@ func (mr *MockIaaSClientMockRecorder) AddPublicIpToServer(ctx, serverId, publicI } // CreateIsolatedNetwork mocks base method. -func (m *MockIaaSClient) CreateIsolatedNetwork(ctx context.Context, payload iaas.CreateIsolatedNetworkPayload) (*iaas.Network, error) { +func (m *MockIaaSClient) CreateIsolatedNetwork(ctx context.Context, payload v2api.CreateIsolatedNetworkPayload) (*v2api.Network, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateIsolatedNetwork", ctx, payload) - ret0, _ := ret[0].(*iaas.Network) + ret0, _ := ret[0].(*v2api.Network) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -146,10 +146,10 @@ func (mr *MockIaaSClientMockRecorder) CreateIsolatedNetwork(ctx, payload any) *g } // CreateKeypair mocks base method. -func (m *MockIaaSClient) CreateKeypair(ctx context.Context, name, publicKey string) (*iaas.Keypair, error) { +func (m *MockIaaSClient) CreateKeypair(ctx context.Context, name, publicKey string) (*v2api.Keypair, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateKeypair", ctx, name, publicKey) - ret0, _ := ret[0].(*iaas.Keypair) + ret0, _ := ret[0].(*v2api.Keypair) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -161,10 +161,10 @@ func (mr *MockIaaSClientMockRecorder) CreateKeypair(ctx, name, publicKey any) *g } // CreatePublicIp mocks base method. -func (m *MockIaaSClient) CreatePublicIp(ctx context.Context, payload iaas.CreatePublicIPPayload) (*iaas.PublicIp, error) { +func (m *MockIaaSClient) CreatePublicIp(ctx context.Context, payload v2api.CreatePublicIPPayload) (*v2api.PublicIp, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreatePublicIp", ctx, payload) - ret0, _ := ret[0].(*iaas.PublicIp) + ret0, _ := ret[0].(*v2api.PublicIp) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -176,10 +176,10 @@ func (mr *MockIaaSClientMockRecorder) CreatePublicIp(ctx, payload any) *gomock.C } // CreateSecurityGroup mocks base method. -func (m *MockIaaSClient) CreateSecurityGroup(ctx context.Context, payload iaas.CreateSecurityGroupPayload) (*iaas.SecurityGroup, error) { +func (m *MockIaaSClient) CreateSecurityGroup(ctx context.Context, payload v2api.CreateSecurityGroupPayload) (*v2api.SecurityGroup, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateSecurityGroup", ctx, payload) - ret0, _ := ret[0].(*iaas.SecurityGroup) + ret0, _ := ret[0].(*v2api.SecurityGroup) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -191,10 +191,10 @@ func (mr *MockIaaSClientMockRecorder) CreateSecurityGroup(ctx, payload any) *gom } // CreateSecurityGroupRule mocks base method. -func (m *MockIaaSClient) CreateSecurityGroupRule(ctx context.Context, securityGroupId string, wantedRule iaas.SecurityGroupRule) (*iaas.SecurityGroupRule, error) { +func (m *MockIaaSClient) CreateSecurityGroupRule(ctx context.Context, securityGroupId string, wantedRule v2api.SecurityGroupRule) (*v2api.SecurityGroupRule, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateSecurityGroupRule", ctx, securityGroupId, wantedRule) - ret0, _ := ret[0].(*iaas.SecurityGroupRule) + ret0, _ := ret[0].(*v2api.SecurityGroupRule) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -206,10 +206,10 @@ func (mr *MockIaaSClientMockRecorder) CreateSecurityGroupRule(ctx, securityGroup } // CreateServer mocks base method. -func (m *MockIaaSClient) CreateServer(ctx context.Context, payload iaas.CreateServerPayload) (*iaas.Server, error) { +func (m *MockIaaSClient) CreateServer(ctx context.Context, payload v2api.CreateServerPayload) (*v2api.Server, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateServer", ctx, payload) - ret0, _ := ret[0].(*iaas.Server) + ret0, _ := ret[0].(*v2api.Server) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -291,10 +291,10 @@ func (mr *MockIaaSClientMockRecorder) DeleteServer(ctx, serverId any) *gomock.Ca } // GetKeypair mocks base method. -func (m *MockIaaSClient) GetKeypair(ctx context.Context, name string) (*iaas.Keypair, error) { +func (m *MockIaaSClient) GetKeypair(ctx context.Context, name string) (*v2api.Keypair, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetKeypair", ctx, name) - ret0, _ := ret[0].(*iaas.Keypair) + ret0, _ := ret[0].(*v2api.Keypair) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -306,10 +306,10 @@ func (mr *MockIaaSClientMockRecorder) GetKeypair(ctx, name any) *gomock.Call { } // GetNetworkById mocks base method. -func (m *MockIaaSClient) GetNetworkById(ctx context.Context, id string) (*iaas.Network, error) { +func (m *MockIaaSClient) GetNetworkById(ctx context.Context, id string) (*v2api.Network, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetNetworkById", ctx, id) - ret0, _ := ret[0].(*iaas.Network) + ret0, _ := ret[0].(*v2api.Network) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -321,10 +321,10 @@ func (mr *MockIaaSClientMockRecorder) GetNetworkById(ctx, id any) *gomock.Call { } // GetNetworkByName mocks base method. -func (m *MockIaaSClient) GetNetworkByName(ctx context.Context, name string) ([]iaas.Network, error) { +func (m *MockIaaSClient) GetNetworkByName(ctx context.Context, name string) ([]v2api.Network, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetNetworkByName", ctx, name) - ret0, _ := ret[0].([]iaas.Network) + ret0, _ := ret[0].([]v2api.Network) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -336,10 +336,10 @@ func (mr *MockIaaSClientMockRecorder) GetNetworkByName(ctx, name any) *gomock.Ca } // GetPublicIpByLabels mocks base method. -func (m *MockIaaSClient) GetPublicIpByLabels(ctx context.Context, selector stackit.LabelSelector) ([]iaas.PublicIp, error) { +func (m *MockIaaSClient) GetPublicIpByLabels(ctx context.Context, selector stackit.LabelSelector) ([]v2api.PublicIp, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetPublicIpByLabels", ctx, selector) - ret0, _ := ret[0].([]iaas.PublicIp) + ret0, _ := ret[0].([]v2api.PublicIp) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -351,10 +351,10 @@ func (mr *MockIaaSClientMockRecorder) GetPublicIpByLabels(ctx, selector any) *go } // GetSecurityGroupById mocks base method. -func (m *MockIaaSClient) GetSecurityGroupById(ctx context.Context, securityGroupId string) (*iaas.SecurityGroup, error) { +func (m *MockIaaSClient) GetSecurityGroupById(ctx context.Context, securityGroupId string) (*v2api.SecurityGroup, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetSecurityGroupById", ctx, securityGroupId) - ret0, _ := ret[0].(*iaas.SecurityGroup) + ret0, _ := ret[0].(*v2api.SecurityGroup) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -366,10 +366,10 @@ func (mr *MockIaaSClientMockRecorder) GetSecurityGroupById(ctx, securityGroupId } // GetSecurityGroupByName mocks base method. -func (m *MockIaaSClient) GetSecurityGroupByName(ctx context.Context, name string) ([]iaas.SecurityGroup, error) { +func (m *MockIaaSClient) GetSecurityGroupByName(ctx context.Context, name string) ([]v2api.SecurityGroup, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetSecurityGroupByName", ctx, name) - ret0, _ := ret[0].([]iaas.SecurityGroup) + ret0, _ := ret[0].([]v2api.SecurityGroup) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -381,10 +381,10 @@ func (mr *MockIaaSClientMockRecorder) GetSecurityGroupByName(ctx, name any) *gom } // GetServerByName mocks base method. -func (m *MockIaaSClient) GetServerByName(ctx context.Context, name string) ([]iaas.Server, error) { +func (m *MockIaaSClient) GetServerByName(ctx context.Context, name string) ([]v2api.Server, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetServerByName", ctx, name) - ret0, _ := ret[0].([]iaas.Server) + ret0, _ := ret[0].([]v2api.Server) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -410,7 +410,7 @@ func (mr *MockIaaSClientMockRecorder) ProjectID() *gomock.Call { } // ReconcileSecurityGroupRules mocks base method. -func (m *MockIaaSClient) ReconcileSecurityGroupRules(ctx context.Context, log logr.Logger, securityGroup *iaas.SecurityGroup, wantedRules []iaas.SecurityGroupRule) error { +func (m *MockIaaSClient) ReconcileSecurityGroupRules(ctx context.Context, log logr.Logger, securityGroup *v2api.SecurityGroup, wantedRules []v2api.SecurityGroupRule) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ReconcileSecurityGroupRules", ctx, log, securityGroup, wantedRules) ret0, _ := ret[0].(error) @@ -424,10 +424,10 @@ func (mr *MockIaaSClientMockRecorder) ReconcileSecurityGroupRules(ctx, log, secu } // UpdateNetwork mocks base method. -func (m *MockIaaSClient) UpdateNetwork(ctx context.Context, networkId string, payload iaas.PartialUpdateNetworkPayload) (*iaas.Network, error) { +func (m *MockIaaSClient) UpdateNetwork(ctx context.Context, networkId string, payload v2api.PartialUpdateNetworkPayload) (*v2api.Network, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateNetwork", ctx, networkId, payload) - ret0, _ := ret[0].(*iaas.Network) + ret0, _ := ret[0].(*v2api.Network) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -439,7 +439,7 @@ func (mr *MockIaaSClientMockRecorder) UpdateNetwork(ctx, networkId, payload any) } // UpdateSecurityGroupRules mocks base method. -func (m *MockIaaSClient) UpdateSecurityGroupRules(ctx context.Context, group *iaas.SecurityGroup, desiredRules []iaas.SecurityGroupRule, allowDelete func(*iaas.SecurityGroupRule) bool) (bool, error) { +func (m *MockIaaSClient) UpdateSecurityGroupRules(ctx context.Context, group *v2api.SecurityGroup, desiredRules []v2api.SecurityGroupRule, allowDelete func(*v2api.SecurityGroupRule) bool) (bool, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateSecurityGroupRules", ctx, group, desiredRules, allowDelete) ret0, _ := ret[0].(bool) diff --git a/pkg/stackit/equality.go b/pkg/stackit/equality.go index b0320c30..e5993907 100644 --- a/pkg/stackit/equality.go +++ b/pkg/stackit/equality.go @@ -2,7 +2,7 @@ package stackit import ( "github.com/google/go-cmp/cmp" - "github.com/stackitcloud/stackit-sdk-go/services/iaas" + iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api" "k8s.io/apimachinery/pkg/conversion" ) diff --git a/pkg/stackit/equality_test.go b/pkg/stackit/equality_test.go index 98c229b6..08b0acc7 100644 --- a/pkg/stackit/equality_test.go +++ b/pkg/stackit/equality_test.go @@ -3,7 +3,7 @@ package stackit_test import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/stackitcloud/stackit-sdk-go/services/iaas" + iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api" . "github.com/stackitcloud/gardener-extension-provider-stackit/v2/pkg/stackit" ) @@ -61,11 +61,11 @@ var _ = Describe("Equality", func() { It("should work in SecurityGroupRule", func() { a := iaas.SecurityGroupRule{ - Direction: new(DirectionEgress), + Direction: DirectionEgress, Protocol: &iaas.Protocol{Name: new("tcp")}, } b := iaas.SecurityGroupRule{ - Direction: new(DirectionEgress), + Direction: DirectionEgress, Protocol: &iaas.Protocol{Name: new("tcp")}, } Expect(Equality.DeepEqual(a, b)).To(BeTrue()) diff --git a/pkg/stackit/types.go b/pkg/stackit/types.go index a8e8f540..8f5b4629 100644 --- a/pkg/stackit/types.go +++ b/pkg/stackit/types.go @@ -1,7 +1,7 @@ package stackit import ( - "github.com/stackitcloud/stackit-sdk-go/services/iaas" + iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api" ) // The SDK is lacking constants for well-known values of the security group rule fields. diff --git a/test/integration/infrastructure/stackit/infrastructure_test.go b/test/integration/infrastructure/stackit/infrastructure_test.go index 4211c076..1fb1c27b 100644 --- a/test/integration/infrastructure/stackit/infrastructure_test.go +++ b/test/integration/infrastructure/stackit/infrastructure_test.go @@ -24,7 +24,7 @@ import ( "github.com/go-logr/logr" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/stackitcloud/stackit-sdk-go/services/iaas" + iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api" corev1 "k8s.io/api/core/v1" schedulingv1 "k8s.io/api/scheduling/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -593,11 +593,11 @@ func prepareIsolatedNetwork(log logr.Logger, networkName string) (*string, error log.Info("Waiting until network is created", "networkName", networkName) createOpts := iaas.CreateIsolatedNetworkPayload{ - Name: new(networkName), + Name: networkName, Ipv4: &iaas.CreateNetworkIPv4{ CreateNetworkIPv4WithPrefix: &iaas.CreateNetworkIPv4WithPrefix{ - Nameservers: new([]string{dnsServer}), - Prefix: new(workerCIDR), + Nameservers: []string{dnsServer}, + Prefix: workerCIDR, }, }, } @@ -607,7 +607,7 @@ func prepareIsolatedNetwork(log logr.Logger, networkName string) (*string, error } log.Info("Network is created", "networkName", networkName) - return network.Id, nil + return new(network.Id), nil } func teardownNetwork(log logr.Logger, networkID string) error { @@ -638,7 +638,7 @@ func verifyCreation(infraStatus extensionsv1alpha1.InfrastructureStatus, provide var externalFixedIPs []string ip, ok := net.Ipv4.GetPublicIpOk() if ok { - externalFixedIPs = append(externalFixedIPs, ip) + externalFixedIPs = append(externalFixedIPs, *ip) } // verify router ip in status