Skip to content

Commit 5d2b595

Browse files
committed
Fix Renovate's go-cfclient v3 bump to use the correct module path and
migrate the Cloud Foundry client code from v2 to v3. Renovate proposed github.com/cloudfoundry-community/go-cfclient/v3, but that module's own go.mod declares its path as github.com/cloudfoundry/go-cfclient/v3 (the project moved orgs), which made the dependency unresolvable and broke all CI on the PR. Ports pkg/util/cloudproviders/cloudfoundry and cmd/cluster-agent-cloudfoundry to the v3 API: client/config/resource package split, functional-options config construction, pointer-based Metadata and typed Relationships, and native paginated sub-clients replacing the old hand-rolled raw-HTTP pagination code.
1 parent 1453483 commit 5d2b595

10 files changed

Lines changed: 395 additions & 406 deletions

File tree

LICENSE-3rdparty.csv

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,6 @@ core,github.com/DataDog/zstd_0,BSD-3-Clause,"Copyright (c) 2016, Datadog <info@d
341341
core,github.com/DisposaBoy/JsonConfigReader,MIT,* Andreas Jaekle `https://github.com/ekle` | * DisposaBoy `https://github.com/DisposaBoy` | * Steven Osborn `https://github.com/steve918` | Copyright (c) 2012 The JsonConfigReader Authors | This is the official list of JsonConfigReader authors for copyright purposes.
342342
core,github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp,Apache-2.0,Copyright 2020 Google LLC
343343
core,github.com/Masterminds/goutils,Apache-2.0,Copyright 2014 Alexander Okoli
344-
core,github.com/Masterminds/semver,MIT,"Copyright (C) 2014-2019, Matt Butcher and Matt Farina"
345344
core,github.com/Masterminds/semver/v3,MIT,"Copyright (C) 2014-2019, Matt Butcher and Matt Farina"
346345
core,github.com/Masterminds/sprig/v3,MIT,Copyright (C) 2013-2020 Masterminds
347346
core,github.com/Microsoft/go-winio,MIT,Copyright (c) 2015 Microsoft
@@ -900,10 +899,19 @@ core,github.com/cloudflare/circl/math/mlsbset,BSD-3-Clause,Copyright (c) 2009 Th
900899
core,github.com/cloudflare/circl/sign,BSD-3-Clause,Copyright (c) 2009 The Go Authors. All rights reserved | Copyright (c) 2019 Cloudflare. All rights reserved
901900
core,github.com/cloudflare/circl/sign/ed25519,BSD-3-Clause,Copyright (c) 2009 The Go Authors. All rights reserved | Copyright (c) 2019 Cloudflare. All rights reserved
902901
core,github.com/cloudflare/circl/sign/ed448,BSD-3-Clause,Copyright (c) 2009 The Go Authors. All rights reserved | Copyright (c) 2019 Cloudflare. All rights reserved
903-
core,github.com/cloudfoundry-community/go-cfclient/v2,MIT,Copyright (c) 2017 Long Nguyen
902+
core,github.com/cloudfoundry/go-cfclient/v3/client,MIT,Copyright (c) 2017 Long Nguyen
903+
core,github.com/cloudfoundry/go-cfclient/v3/config,MIT,Copyright (c) 2017 Long Nguyen
904+
core,github.com/cloudfoundry/go-cfclient/v3/internal/check,MIT,Copyright (c) 2017 Long Nguyen
905+
core,github.com/cloudfoundry/go-cfclient/v3/internal/http,MIT,Copyright (c) 2017 Long Nguyen
906+
core,github.com/cloudfoundry/go-cfclient/v3/internal/ios,MIT,Copyright (c) 2017 Long Nguyen
907+
core,github.com/cloudfoundry/go-cfclient/v3/internal/jwt,MIT,Copyright (c) 2017 Long Nguyen
908+
core,github.com/cloudfoundry/go-cfclient/v3/internal/path,MIT,Copyright (c) 2017 Long Nguyen
909+
core,github.com/cloudfoundry/go-cfclient/v3/resource,MIT,Copyright (c) 2017 Long Nguyen
910+
core,github.com/cloudfoundry/go-cfclient/v3/testutil,MIT,Copyright (c) 2017 Long Nguyen
904911
core,github.com/cncf/xds/go/udpa/annotations,Apache-2.0,Copyright 2020 Envoyproxy Authors
905912
core,github.com/cncf/xds/go/xds/annotations/v3,Apache-2.0,Copyright 2020 Envoyproxy Authors
906913
core,github.com/cncf/xds/go/xds/core/v3,Apache-2.0,Copyright 2020 Envoyproxy Authors
914+
core,github.com/codegangsta/inject,MIT,Copyright (c) 2013 Jeremy Saenz
907915
core,github.com/containerd/cgroups/v3,Apache-2.0,"Copyright 2012-2015 Docker, Inc."
908916
core,github.com/containerd/cgroups/v3/cgroup1,Apache-2.0,"Copyright 2012-2015 Docker, Inc."
909917
core,github.com/containerd/cgroups/v3/cgroup1/stats,Apache-2.0,"Copyright 2012-2015 Docker, Inc."
@@ -1152,6 +1160,7 @@ core,github.com/go-logr/logr/funcr,Apache-2.0,Copyright 2019 The logr Authors. |
11521160
core,github.com/go-logr/logr/slogr,Apache-2.0,Copyright 2019 The logr Authors. | Copyright 2020 The logr Authors.
11531161
core,github.com/go-logr/stdr,Apache-2.0,Copyright 2019 The logr Authors.
11541162
core,github.com/go-logr/zapr,Apache-2.0,Copyright 2018 Solly Ross | Copyright 2019 The logr Authors.
1163+
core,github.com/go-martini/martini,MIT,Copyright (c) 2015 Jeremy Saenz
11551164
core,github.com/go-ole/go-ole,MIT,"Copyright © 2013-2017 Yasuhiro Matsumoto, <mattn.jp@gmail.com>"
11561165
core,github.com/go-ole/go-ole/oleutil,MIT,"Copyright © 2013-2017 Yasuhiro Matsumoto, <mattn.jp@gmail.com>"
11571166
core,github.com/go-openapi/analysis,Apache-2.0,Copyright 2015 go-swagger maintainers
@@ -1572,6 +1581,7 @@ core,github.com/mailru/easyjson,MIT,Copyright (c) 2016 Mail.Ru Group
15721581
core,github.com/mailru/easyjson/buffer,MIT,Copyright (c) 2016 Mail.Ru Group
15731582
core,github.com/mailru/easyjson/jlexer,MIT,Copyright (c) 2016 Mail.Ru Group
15741583
core,github.com/mailru/easyjson/jwriter,MIT,Copyright (c) 2016 Mail.Ru Group
1584+
core,github.com/martini-contrib/render,MIT,Copyright (c) 2013 Jeremy Saenz
15751585
core,github.com/masahiro331/go-disk,MIT,Copyright (c) 2022 Masahiro331
15761586
core,github.com/masahiro331/go-disk/fs,MIT,Copyright (c) 2022 Masahiro331
15771587
core,github.com/masahiro331/go-disk/gpt,MIT,Copyright (c) 2022 Masahiro331
@@ -2139,6 +2149,7 @@ core,github.com/outcaste-io/ristretto/z,MIT,"Copyright (c) 2014 Andreas Briese,
21392149
core,github.com/outcaste-io/ristretto/z/simd,MIT,"Copyright (c) 2014 Andreas Briese, eduToolbox@Bri-C GmbH, Sarstedt | Copyright (c) 2019 Ewan Chou | Copyright 2019 Dgraph Labs, Inc. and Contributors | Copyright 2020 Dgraph Labs, Inc. and Contributors | Copyright 2020 The LevelDB-Go and Pebble Authors. All rights reserved. | Copyright 2021 Dgraph Labs, Inc. and Contributors"
21402150
core,github.com/outscale/osc-sdk-go/v2,BSD-3-Clause,Copyright (c) Outscale SAS. All rights reserved
21412151
core,github.com/ovh/go-ovh/ovh,BSD-3-Clause,"Copyright (c) 2015-2025, OVH SAS"
2152+
core,github.com/oxtoacart/bpool,Apache-2.0,Copyright 2014 Percy Wegmann
21422153
core,github.com/package-url/packageurl-go,MIT,Copyright (c) the purl authors
21432154
core,github.com/pandatix/go-cvss/30,MIT,Copyright (c) 2022 Lucas TESSON - PandatiX <lucastesson@protonmail.com>
21442155
core,github.com/pandatix/go-cvss/31,MIT,Copyright (c) 2022 Lucas TESSON - PandatiX <lucastesson@protonmail.com>

cmd/cluster-agent-cloudfoundry/subcommands/run/command.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"time"
2121

2222
"code.cloudfoundry.org/bbs"
23-
"github.com/cloudfoundry-community/go-cfclient/v2"
23+
cfconfig "github.com/cloudfoundry/go-cfclient/v3/config"
2424
"github.com/spf13/cobra"
2525

2626
"github.com/DataDog/datadog-agent/cmd/agent/common"
@@ -280,20 +280,25 @@ func initializeCCCache(ctx context.Context, config config.Component) (cloudfound
280280
pollInterval := time.Second * time.Duration(config.GetInt("cloud_foundry_cc.poll_interval"))
281281

282282
// Create the CF client
283-
ccClient, err := cloudfoundry.NewCFClient(&cfclient.Config{
284-
ApiAddress: config.GetString("cloud_foundry_cc.url"),
285-
ClientID: config.GetString("cloud_foundry_cc.client_id"),
286-
ClientSecret: config.GetString("cloud_foundry_cc.client_secret"),
287-
SkipSslValidation: config.GetBool("cloud_foundry_cc.skip_ssl_validation"),
288-
})
283+
ccOpts := []cfconfig.Option{
284+
cfconfig.ClientCredentials(config.GetString("cloud_foundry_cc.client_id"), config.GetString("cloud_foundry_cc.client_secret")),
285+
}
286+
if config.GetBool("cloud_foundry_cc.skip_ssl_validation") {
287+
ccOpts = append(ccOpts, cfconfig.SkipTLSValidation())
288+
}
289+
ccCfg, err := cfconfig.New(config.GetString("cloud_foundry_cc.url"), ccOpts...)
290+
if err != nil {
291+
return nil, fmt.Errorf("failed to create CC client config: %v", err)
292+
}
293+
ccClient, err := cloudfoundry.NewCFClient(ccCfg)
289294
if err != nil {
290295
return nil, fmt.Errorf("failed to create CC client: %v", err)
291296
}
292297

293298
ccCache, err := cloudfoundry.ConfigureGlobalCCCache(ctx, cloudfoundry.CCCacheConfig{
294299
CCAPIClient: ccClient,
295300
PollInterval: pollInterval,
296-
AppsBatchSize: config.GetInt("cloud_foundry_cc.apps_batch_size"),
301+
AppsBatchSize: cloudfoundry.PerPage(config.GetInt("cloud_foundry_cc.apps_batch_size")),
297302
RefreshCacheOnMiss: config.GetBool("cluster_agent.refresh_on_cache_miss"),
298303
ServeNozzleData: config.GetBool("cluster_agent.serve_nozzle_data"),
299304
SidecarsTags: config.GetBool("cluster_agent.sidecars_tags"),

deps/go.MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ use_repo(
156156
"com_github_cilium_ebpf",
157157
"com_github_clbanning_mxj_v2",
158158
"com_github_cloudflare_cbpfc",
159-
"com_github_cloudfoundry_community_go_cfclient_v2",
159+
"com_github_cloudfoundry_go_cfclient_v3",
160160
"com_github_containerd_cgroups_v3",
161161
"com_github_containerd_containerd_api",
162162
"com_github_containerd_containerd_v2",

go.mod

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ require (
246246
github.com/cilium/ebpf v0.22.0
247247
github.com/clbanning/mxj/v2 v2.7.0
248248
github.com/cloudflare/cbpfc v0.0.0-20260219140841-0661ad29132c
249-
github.com/cloudfoundry-community/go-cfclient/v3 v3.0.0-alpha.21
249+
github.com/cloudfoundry/go-cfclient/v3 v3.0.0-beta.1
250250
github.com/containerd/cgroups/v3 v3.1.3
251251
github.com/containerd/containerd/api v1.11.1
252252
github.com/containerd/containerd/v2 v2.2.5
@@ -577,7 +577,6 @@ require (
577577
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.33.0 // indirect
578578
github.com/Jeffail/gabs/v2 v2.1.0 // indirect
579579
github.com/Masterminds/goutils v1.1.1 // indirect
580-
github.com/Masterminds/semver v1.5.0 // indirect
581580
github.com/NYTimes/gziphandler v1.1.1 // indirect
582581
github.com/ProtonMail/gopenpgp/v3 v3.2.1 // indirect
583582
github.com/Showmax/go-fqdn v1.0.0 // indirect
@@ -641,6 +640,7 @@ require (
641640
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
642641
github.com/cloudflare/circl v1.6.3 // indirect
643642
github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 // indirect
643+
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 // indirect
644644
github.com/containerd/continuity v0.4.5 // indirect
645645
github.com/containerd/errdefs/pkg v0.3.0 // indirect
646646
github.com/containerd/fifo v1.1.0 // indirect
@@ -694,6 +694,7 @@ require (
694694
github.com/go-logr/logr v1.4.3 // indirect
695695
github.com/go-logr/stdr v1.2.2 // indirect
696696
github.com/go-logr/zapr v1.3.0 // indirect
697+
github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab // indirect
697698
github.com/go-openapi/analysis v0.25.0 // indirect
698699
github.com/go-openapi/errors v0.22.7 // indirect
699700
github.com/go-openapi/jsonpointer v0.23.1 // indirect
@@ -743,7 +744,6 @@ require (
743744
github.com/googleapis/gax-go/v2 v2.22.0 // indirect
744745
github.com/gophercloud/gophercloud v0.1.0 // indirect
745746
github.com/gophercloud/gophercloud/v2 v2.12.0 // indirect
746-
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect
747747
github.com/gorilla/mux v1.8.1 // indirect
748748
github.com/grafana/regexp v0.0.0-20250905093917-f7b3be9d1853 // indirect
749749
github.com/graph-gophers/graphql-go v1.10.2 // indirect
@@ -864,6 +864,7 @@ require (
864864
github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e // indirect
865865
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 // indirect
866866
github.com/magefile/mage v1.15.0 // indirect
867+
github.com/martini-contrib/render v0.0.0-20150707142108-ec18f8345a11 // indirect
867868
github.com/masahiro331/go-disk v0.0.0-20240625071113-56c933208fee // indirect
868869
github.com/masahiro331/go-ext4-filesystem v0.0.0-20240620024024-ca14e6327bbd // indirect
869870
github.com/masahiro331/go-mvn-version v0.0.0-20250131095131-f4974fa13b8a // indirect
@@ -963,6 +964,7 @@ require (
963964
github.com/outcaste-io/ristretto v0.2.3 // indirect
964965
github.com/outscale/osc-sdk-go/v2 v2.34.0 // indirect
965966
github.com/ovh/go-ovh v1.9.0 // indirect
967+
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
966968
github.com/package-url/packageurl-go v0.1.3 // indirect
967969
github.com/packethost/packngo v0.1.1-0.20180711074735-b9cb5096f54c // indirect
968970
github.com/pandatix/go-cvss v0.6.2 // indirect
@@ -1012,7 +1014,6 @@ require (
10121014
github.com/shoenig/go-m1cpu v0.1.7 // indirect
10131015
github.com/shopspring/decimal v1.4.0 // indirect
10141016
github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c // indirect
1015-
github.com/smartystreets/assertions v1.1.0 // indirect
10161017
github.com/smira/go-ftp-protocol v0.0.0-20140829150050-066b75c2b70d // indirect
10171018
github.com/softlayer/softlayer-go v0.0.0-20180806151055-260589d94c7d // indirect
10181019
github.com/sony/gobreaker v0.5.0 // indirect

go.sum

Lines changed: 4 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)