diff --git a/go.mod b/go.mod index 590a24329..e27450121 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/onsi/ginkgo/v2 v2.14.0 github.com/onsi/gomega v1.30.0 github.com/pkg/errors v0.9.1 - github.com/vmware/cloud-provider-for-cloud-director v0.0.0-20240214001708-af504c145ad5 + github.com/vmware/cloud-provider-for-cloud-director v0.0.0-20240725204714-a0a0e916a5ed github.com/vmware/go-vcloud-director/v2 v2.21.0 go.uber.org/zap v1.26.0 gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index da61690b9..dea7e405b 100644 --- a/go.sum +++ b/go.sum @@ -341,8 +341,8 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/vmware/cloud-provider-for-cloud-director v0.0.0-20240214001708-af504c145ad5 h1:wLY7YYIgfOroVF+R158smilg1Aw1Kbzo8ez1Dh5FlwM= -github.com/vmware/cloud-provider-for-cloud-director v0.0.0-20240214001708-af504c145ad5/go.mod h1:aZDliFAerzbmI6pL3bd1R53CEXJkNKkWgdM5q337rAw= +github.com/vmware/cloud-provider-for-cloud-director v0.0.0-20240725204714-a0a0e916a5ed h1:JTJVcpsOFI4VaHfPiHKZPepgMU+up9gidp7yRDy2/rs= +github.com/vmware/cloud-provider-for-cloud-director v0.0.0-20240725204714-a0a0e916a5ed/go.mod h1:aZDliFAerzbmI6pL3bd1R53CEXJkNKkWgdM5q337rAw= github.com/vmware/go-vcloud-director/v2 v2.21.0 h1:zIONrJpM+Fj+rDyXmsRfMAn1sP5WAP87USL0T9GS4DY= github.com/vmware/go-vcloud-director/v2 v2.21.0/go.mod h1:QPxGFgrUcSyzy9IlpwDE4UNT3tsOy2047tJOPEJ4nlw= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= diff --git a/release/version b/release/version index 18fa8e74f..757407982 100644 --- a/release/version +++ b/release/version @@ -1 +1 @@ -v1.3.0 +v1.3.1 diff --git a/vendor/github.com/vmware/cloud-provider-for-cloud-director/pkg/vcdsdk/auth.go b/vendor/github.com/vmware/cloud-provider-for-cloud-director/pkg/vcdsdk/auth.go index 7df936209..e8ada2fbd 100644 --- a/vendor/github.com/vmware/cloud-provider-for-cloud-director/pkg/vcdsdk/auth.go +++ b/vendor/github.com/vmware/cloud-provider-for-cloud-director/pkg/vcdsdk/auth.go @@ -99,6 +99,7 @@ func (config *VCDAuthConfig) GetSwaggerClientFromSecrets() (*govcd.VCDClient, *s swaggerConfig37.HTTPClient = &http.Client{ Transport: &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: config.Insecure}, + Proxy: http.ProxyFromEnvironment, }, } apiClient37 := swaggerClient.NewAPIClient(swaggerConfig37) diff --git a/vendor/github.com/vmware/cloud-provider-for-cloud-director/pkg/vcdsdk/gateway.go b/vendor/github.com/vmware/cloud-provider-for-cloud-director/pkg/vcdsdk/gateway.go index 3daf4f588..a59982869 100644 --- a/vendor/github.com/vmware/cloud-provider-for-cloud-director/pkg/vcdsdk/gateway.go +++ b/vendor/github.com/vmware/cloud-provider-for-cloud-director/pkg/vcdsdk/gateway.go @@ -1468,29 +1468,31 @@ func (gm *GatewayManager) IsNSXTBackedGateway() bool { // in case the code is unable to determine the required info, it will return false with an error. func (gm *GatewayManager) IsUsingIpSpaces() (bool, error) { edgeGatewayName := gm.GatewayRef.Name - vdc := gm.Client.VDC - if vdc == nil { - return false, fmt.Errorf("unable to determine if gateway [%s] is using Ip Spaces or not. nil VDC object in client", edgeGatewayName) + edgeGatewayID := gm.GatewayRef.Id + clusterOrg, err := gm.Client.VCDClient.GetOrgByName(gm.Client.ClusterOrgName) + if err != nil { + return false, fmt.Errorf("error retrieving org [%s]: [%v]", gm.Client.ClusterOrgName, err) + } + if clusterOrg == nil || clusterOrg.Org == nil { + return false, fmt.Errorf("unable to determine if gateway [%s] of org [%s] is using Ip Spaces or not; obtained nil org", edgeGatewayName, gm.Client.ClusterOrgName) } - edgeGateway, err := vdc.GetNsxtEdgeGatewayByName(edgeGatewayName) + edgeGateway, err := clusterOrg.GetNsxtEdgeGatewayById(edgeGatewayID) if err != nil { - return false, fmt.Errorf("unable to determine if gateway [%s] is using Ip Spaces or not. error [%v]", edgeGatewayName, err) + return false, fmt.Errorf("unable to determine if gateway [%s] of org [%s] is using Ip Spaces or not. error [%v]", edgeGatewayName, gm.Client.ClusterOrgName, err) } edgeGatewayUplinks := edgeGateway.EdgeGateway.EdgeGatewayUplinks - if edgeGatewayUplinks != nil { - if len(edgeGatewayUplinks) != 1 { - return false, fmt.Errorf("found invalid number of uplinks for gateway [%s], expecting 1", edgeGatewayName) - } - } else { - return false, fmt.Errorf("no uplinks were found for gateway [%s], expecting 1", edgeGatewayName) + if edgeGatewayUplinks == nil || len(edgeGatewayUplinks) == 0 { + return false, fmt.Errorf("no uplinks were found for gateway [%s], expecting atleast 1 uplink", edgeGatewayName) } - - result := edgeGatewayUplinks[0].UsingIpSpace - if result == nil { - return false, fmt.Errorf("unable to determine if gateway [%s] is using IP spaces or not", edgeGatewayName) + for _, edgeGatewayUplink := range edgeGatewayUplinks { + if edgeGatewayUplink.UsingIpSpace != nil && *edgeGatewayUplink.UsingIpSpace { + return true, nil + } + // If uplink doesn't support IP Spaces, or we are unable to determine it, check the next uplink } - return *result, nil + // if we reach here, edge gateway doesn't support IP Spaces + return false, nil } func (gm *GatewayManager) GetLoadBalancerPool(ctx context.Context, lbPoolName string) (*swaggerClient.EntityReference, error) { diff --git a/vendor/github.com/vmware/cloud-provider-for-cloud-director/pkg/vcdswaggerclient_37_2/model_access_control_grant.go b/vendor/github.com/vmware/cloud-provider-for-cloud-director/pkg/vcdswaggerclient_37_2/model_access_control_grant_modified.go similarity index 93% rename from vendor/github.com/vmware/cloud-provider-for-cloud-director/pkg/vcdswaggerclient_37_2/model_access_control_grant.go rename to vendor/github.com/vmware/cloud-provider-for-cloud-director/pkg/vcdswaggerclient_37_2/model_access_control_grant_modified.go index b2e6025ad..1565a1dee 100644 --- a/vendor/github.com/vmware/cloud-provider-for-cloud-director/pkg/vcdswaggerclient_37_2/model_access_control_grant.go +++ b/vendor/github.com/vmware/cloud-provider-for-cloud-director/pkg/vcdswaggerclient_37_2/model_access_control_grant_modified.go @@ -14,12 +14,14 @@ package swagger type AccessControlGrant struct { // VcloudId URN identifier for ACL grant Id string `json:"id,omitempty"` - // The tenant this grant applies in. This is managed by the system and depends on the organization the requester operates in at the time of creation and the actual principal type. - Tenant *EntityReference `json:"tenant,omitempty"` - // Indicates whether this access control grant is based on user memberships or entitlements + // The tenant this grant applies in. This is managed by the system and depends on the organization the requester operates in at the time of creation and the actual principal type. + // Tenant *EntityReference `json:"tenant,omitempty"` -> This doesn't work even with Postman + // The tenant this grant applies in. This is referenced by their organization ID. + MemberId string `json:"memberId"` + // Indicates whether this access control grant is based on user memberships or entitlements GrantType string `json:"grantType"` - // The object that this access control grant applies to + // The object that this access control grant applies to ObjectId string `json:"objectId,omitempty"` - // The ID of the level of access which the subject will be granted. + // The ID of the level of access which the subject will be granted. AccessLevelId string `json:"accessLevelId"` } diff --git a/vendor/modules.txt b/vendor/modules.txt index 0f654d8ae..704c0094c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -267,7 +267,7 @@ github.com/spf13/cast # github.com/spf13/pflag v1.0.5 ## explicit; go 1.12 github.com/spf13/pflag -# github.com/vmware/cloud-provider-for-cloud-director v0.0.0-20240214001708-af504c145ad5 +# github.com/vmware/cloud-provider-for-cloud-director v0.0.0-20240725204714-a0a0e916a5ed ## explicit; go 1.20 github.com/vmware/cloud-provider-for-cloud-director/pkg/testingsdk github.com/vmware/cloud-provider-for-cloud-director/pkg/util