Skip to content

Commit 70dbb48

Browse files
mrajagopalCopilot
andauthored
Update pkg/jobs/common_job_list.go
Changed from DiscoveryClient.ServerPreferredResources() to Discovery().ServerPreferredResources(). This change suggests the interface was updated, but ensure that Discovery() returns the same type as DiscoveryClient to maintain compatibility. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 4ff0cc7 commit 70dbb48

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/jobs/common_job_list.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,14 @@ func CommonJobList() []Job {
146146
Execute: func(dc *data_collector.DataCollector, ctx context.Context, ch chan JobResult) {
147147
jobResult := JobResult{Files: make(map[string][]byte), Error: nil}
148148
for _, namespace := range dc.Namespaces {
149-
result, err := dc.K8sCoreClientSet.Discovery().ServerPreferredResources()
149+
discoveryClient, ok := dc.K8sCoreClientSet.Discovery().(interface {
150+
ServerPreferredResources() ([]*metav1.APIResourceList, error)
151+
})
152+
if !ok {
153+
dc.Logger.Printf("\tDiscovery() does not implement ServerPreferredResources for namespace %s\n", namespace)
154+
continue
155+
}
156+
result, err := discoveryClient.ServerPreferredResources()
150157
if err != nil {
151158
dc.Logger.Printf("\tCould not retrieve API resources list %s: %v\n", namespace, err)
152159
} else {

0 commit comments

Comments
 (0)