Skip to content

Commit

Permalink
deps: update module github.com/gophercloud/gophercloud to v2 (#3300)
Browse files Browse the repository at this point in the history
* deps: update module github.com/gophercloud/gophercloud to v2

* update module github.com/gophercloud/utils to v2 and add context

Signed-off-by: Daniel Weiße <[email protected]>

---------

Signed-off-by: Daniel Weiße <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel Weiße <[email protected]>
  • Loading branch information
renovate[bot] and daniel-weisse authored Aug 8, 2024
1 parent 8b256f2 commit 087855e
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 59 deletions.
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ use_repo(
"com_github_google_keep_sorted",
"com_github_google_uuid",
"com_github_googleapis_gax_go_v2",
"com_github_gophercloud_gophercloud",
"com_github_gophercloud_utils",
"com_github_gophercloud_gophercloud_v2",
"com_github_gophercloud_utils_v2",
"com_github_grpc_ecosystem_go_grpc_middleware_v2",
"com_github_hashicorp_go_kms_wrapping_v2",
"com_github_hashicorp_go_kms_wrapping_wrappers_awskms_v2",
Expand Down
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ require (
github.com/google/go-tpm-tools v0.4.4
github.com/google/uuid v1.6.0
github.com/googleapis/gax-go/v2 v2.13.0
github.com/gophercloud/gophercloud v1.14.0
github.com/gophercloud/utils v0.0.0-20231010081019-80377eca5d56
github.com/gophercloud/gophercloud/v2 v2.1.0
github.com/gophercloud/utils/v2 v2.0.0-20240807081201-990d90b23c70
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0
github.com/hashicorp/go-kms-wrapping/v2 v2.0.16
github.com/hashicorp/go-kms-wrapping/wrappers/awskms/v2 v2.0.9
Expand Down Expand Up @@ -118,7 +118,7 @@ require (
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
golang.org/x/mod v0.20.0
golang.org/x/sys v0.23.0
golang.org/x/text v0.16.0
golang.org/x/text v0.17.0
golang.org/x/tools v0.23.0
google.golang.org/api v0.190.0
google.golang.org/grpc v1.65.0
Expand Down Expand Up @@ -235,6 +235,7 @@ require (
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gofrs/uuid/v5 v5.2.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
Expand Down Expand Up @@ -354,7 +355,7 @@ require (
go.uber.org/zap v1.27.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/time v0.5.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJA
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gofrs/uuid/v5 v5.2.0 h1:qw1GMx6/y8vhVsx626ImfKMuS5CvJmhIKKtuyvfajMM=
github.com/gofrs/uuid/v5 v5.2.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
Expand Down Expand Up @@ -500,11 +502,10 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDPT0hH1s=
github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A=
github.com/gophercloud/gophercloud v1.3.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM=
github.com/gophercloud/gophercloud v1.14.0 h1:Bt9zQDhPrbd4qX7EILGmy+i7GP35cc+AAL2+wIJpUE8=
github.com/gophercloud/gophercloud v1.14.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM=
github.com/gophercloud/utils v0.0.0-20231010081019-80377eca5d56 h1:sH7xkTfYzxIEgzq1tDHIMKRh1vThOEOGNsettdEeLbE=
github.com/gophercloud/utils v0.0.0-20231010081019-80377eca5d56/go.mod h1:VSalo4adEk+3sNkmVJLnhHoOyOYYS8sTWLG4mv5BKto=
github.com/gophercloud/gophercloud/v2 v2.1.0 h1:91p6c+uMckXyx39nSIYjDirDBnPVFQq0q1njLNPX+NY=
github.com/gophercloud/gophercloud/v2 v2.1.0/go.mod h1:f2hMRC7Kakbv5vM7wSGHrIPZh6JZR60GVHryJlF/K44=
github.com/gophercloud/utils/v2 v2.0.0-20240807081201-990d90b23c70 h1:UFRmN3w9eSxwHsOGjA3BiYGEBDUAFaHHv5alaMHbbFE=
github.com/gophercloud/utils/v2 v2.0.0-20240807081201-990d90b23c70/go.mod h1:ZNbSKwPYzyQ7PKmlCvVdI2JvwVHsl/ZVVXnpJRNkLrQ=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4=
github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q=
Expand Down Expand Up @@ -1009,7 +1010,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
Expand Down Expand Up @@ -1082,8 +1082,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -1145,8 +1145,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
Expand Down
22 changes: 11 additions & 11 deletions internal/cloud/openstack/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ go_library(
"//internal/cloud/metadata",
"//internal/constants",
"//internal/role",
"@com_github_gophercloud_gophercloud//:gophercloud",
"@com_github_gophercloud_gophercloud//openstack/compute/v2/servers",
"@com_github_gophercloud_gophercloud//openstack/networking/v2/networks",
"@com_github_gophercloud_gophercloud//openstack/networking/v2/subnets",
"@com_github_gophercloud_gophercloud//pagination",
"@com_github_gophercloud_utils//openstack/clientconfig",
"@com_github_gophercloud_gophercloud_v2//:gophercloud",
"@com_github_gophercloud_gophercloud_v2//openstack/compute/v2/servers",
"@com_github_gophercloud_gophercloud_v2//openstack/networking/v2/networks",
"@com_github_gophercloud_gophercloud_v2//openstack/networking/v2/subnets",
"@com_github_gophercloud_gophercloud_v2//pagination",
"@com_github_gophercloud_utils_v2//openstack/clientconfig",
],
)

Expand All @@ -40,11 +40,11 @@ go_test(
deps = [
"//internal/cloud/metadata",
"//internal/role",
"@com_github_gophercloud_gophercloud//:gophercloud",
"@com_github_gophercloud_gophercloud//openstack/compute/v2/servers",
"@com_github_gophercloud_gophercloud//openstack/networking/v2/networks",
"@com_github_gophercloud_gophercloud//openstack/networking/v2/subnets",
"@com_github_gophercloud_gophercloud//pagination",
"@com_github_gophercloud_gophercloud_v2//:gophercloud",
"@com_github_gophercloud_gophercloud_v2//openstack/compute/v2/servers",
"@com_github_gophercloud_gophercloud_v2//openstack/networking/v2/networks",
"@com_github_gophercloud_gophercloud_v2//openstack/networking/v2/subnets",
"@com_github_gophercloud_gophercloud_v2//pagination",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
],
Expand Down
10 changes: 5 additions & 5 deletions internal/cloud/openstack/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"context"

"github.com/edgelesssys/constellation/v2/internal/role"
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
"github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
"github.com/gophercloud/gophercloud/openstack/networking/v2/subnets"
"github.com/gophercloud/gophercloud/pagination"
"github.com/gophercloud/gophercloud/v2/openstack/compute/v2/servers"
"github.com/gophercloud/gophercloud/v2/openstack/networking/v2/networks"
"github.com/gophercloud/gophercloud/v2/openstack/networking/v2/subnets"
"github.com/gophercloud/gophercloud/v2/pagination"
)

type imdsAPI interface {
Expand All @@ -34,5 +34,5 @@ type serversAPI interface {
}

type pagerAPI interface {
AllPages() (pagination.Page, error)
AllPages(context.Context) (pagination.Page, error)
}
10 changes: 5 additions & 5 deletions internal/cloud/openstack/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"context"

"github.com/edgelesssys/constellation/v2/internal/role"
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
"github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
"github.com/gophercloud/gophercloud/openstack/networking/v2/subnets"
"github.com/gophercloud/gophercloud/pagination"
"github.com/gophercloud/gophercloud/v2/openstack/compute/v2/servers"
"github.com/gophercloud/gophercloud/v2/openstack/networking/v2/networks"
"github.com/gophercloud/gophercloud/v2/openstack/networking/v2/subnets"
"github.com/gophercloud/gophercloud/v2/pagination"
)

type stubIMDSClient struct {
Expand Down Expand Up @@ -90,6 +90,6 @@ type stubPager struct {
allPagesErr error
}

func (p *stubPager) AllPages() (pagination.Page, error) {
func (p *stubPager) AllPages(_ context.Context) (pagination.Page, error) {
return p.page, p.allPagesErr
}
26 changes: 13 additions & 13 deletions internal/cloud/openstack/openstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (
"github.com/edgelesssys/constellation/v2/internal/cloud/metadata"
"github.com/edgelesssys/constellation/v2/internal/constants"
"github.com/edgelesssys/constellation/v2/internal/role"
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
"github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
"github.com/gophercloud/gophercloud/openstack/networking/v2/subnets"
"github.com/gophercloud/utils/openstack/clientconfig"
"github.com/gophercloud/gophercloud/v2/openstack/compute/v2/servers"
"github.com/gophercloud/gophercloud/v2/openstack/networking/v2/networks"
"github.com/gophercloud/gophercloud/v2/openstack/networking/v2/subnets"
"github.com/gophercloud/utils/v2/openstack/clientconfig"
)

const (
Expand Down Expand Up @@ -65,13 +65,13 @@ func New(ctx context.Context) (*MetadataClient, error) {
},
}

serversClient, err := clientconfig.NewServiceClient("compute", clientOpts)
serversClient, err := clientconfig.NewServiceClient(ctx, "compute", clientOpts)
if err != nil {
return nil, fmt.Errorf("creating compute client: %w", err)
}
serversClient.Microversion = microversion

networksClient, err := clientconfig.NewServiceClient("network", clientOpts)
networksClient, err := clientconfig.NewServiceClient(ctx, "network", clientOpts)
if err != nil {
return nil, fmt.Errorf("creating network client: %w", err)
}
Expand Down Expand Up @@ -122,12 +122,12 @@ func (c *MetadataClient) List(ctx context.Context) ([]metadata.InstanceMetadata,

uidTag := fmt.Sprintf("constellation-uid-%s", uid)

subnet, err := c.getSubnetCIDR(uidTag)
subnet, err := c.getSubnetCIDR(ctx, uidTag)
if err != nil {
return nil, err
}

srvs, err := c.getServers(uidTag)
srvs, err := c.getServers(ctx, uidTag)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -240,9 +240,9 @@ func (c *MetadataClient) GetLoadBalancerEndpoint(ctx context.Context) (host, por
return host, strconv.FormatInt(constants.KubernetesPort, 10), nil
}

func (c *MetadataClient) getSubnetCIDR(uidTag string) (netip.Prefix, error) {
func (c *MetadataClient) getSubnetCIDR(ctx context.Context, uidTag string) (netip.Prefix, error) {
listNetworksOpts := networks.ListOpts{Tags: uidTag}
networksPage, err := c.api.ListNetworks(listNetworksOpts).AllPages()
networksPage, err := c.api.ListNetworks(listNetworksOpts).AllPages(ctx)
if err != nil {
return netip.Prefix{}, fmt.Errorf("listing networks: %w", err)
}
Expand All @@ -255,7 +255,7 @@ func (c *MetadataClient) getSubnetCIDR(uidTag string) (netip.Prefix, error) {
}

listSubnetsOpts := subnets.ListOpts{Tags: uidTag}
subnetsPage, err := c.api.ListSubnets(listSubnetsOpts).AllPages()
subnetsPage, err := c.api.ListSubnets(listSubnetsOpts).AllPages(ctx)
if err != nil {
return netip.Prefix{}, fmt.Errorf("listing subnets: %w", err)
}
Expand Down Expand Up @@ -285,9 +285,9 @@ func (c *MetadataClient) getSubnetCIDR(uidTag string) (netip.Prefix, error) {
return cidr, nil
}

func (c *MetadataClient) getServers(uidTag string) ([]servers.Server, error) {
func (c *MetadataClient) getServers(ctx context.Context, uidTag string) ([]servers.Server, error) {
listServersOpts := servers.ListOpts{Tags: uidTag}
serversPage, err := c.api.ListServers(listServersOpts).AllPages()
serversPage, err := c.api.ListServers(listServersOpts).AllPages(ctx)
if err != nil {
return nil, fmt.Errorf("listing servers: %w", err)
}
Expand Down
10 changes: 5 additions & 5 deletions internal/cloud/openstack/openstack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import (

"github.com/edgelesssys/constellation/v2/internal/cloud/metadata"
"github.com/edgelesssys/constellation/v2/internal/role"
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
"github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
"github.com/gophercloud/gophercloud/openstack/networking/v2/subnets"
"github.com/gophercloud/gophercloud/pagination"
"github.com/gophercloud/gophercloud/v2"
"github.com/gophercloud/gophercloud/v2/openstack/compute/v2/servers"
"github.com/gophercloud/gophercloud/v2/openstack/networking/v2/networks"
"github.com/gophercloud/gophercloud/v2/openstack/networking/v2/subnets"
"github.com/gophercloud/gophercloud/v2/pagination"
"github.com/stretchr/testify/assert"
)

Expand Down
8 changes: 4 additions & 4 deletions internal/cloud/openstack/wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ SPDX-License-Identifier: AGPL-3.0-only
package openstack

import (
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
"github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
"github.com/gophercloud/gophercloud/openstack/networking/v2/subnets"
"github.com/gophercloud/gophercloud/v2"
"github.com/gophercloud/gophercloud/v2/openstack/compute/v2/servers"
"github.com/gophercloud/gophercloud/v2/openstack/networking/v2/networks"
"github.com/gophercloud/gophercloud/v2/openstack/networking/v2/subnets"
)

type apiClient struct {
Expand Down

0 comments on commit 087855e

Please sign in to comment.