upgrade go-sdk (#916)
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Failing after 1m0s
Post / coverage (push) Failing after 22m33s
Post / images (arm64) (push) Failing after 2m31s
Post / images (amd64) (push) Failing after 24m48s
Post / image manifest (push) Has been skipped
Post / trigger clusteradm e2e (push) Has been skipped

Signed-off-by: Wei Liu <liuweixa@redhat.com>
This commit is contained in:
Wei Liu
2025-03-28 09:10:15 +08:00
committed by GitHub
parent 241a3eaaa3
commit 29c42b997d
8 changed files with 22 additions and 13 deletions

2
go.mod
View File

@@ -37,7 +37,7 @@ require (
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6
open-cluster-management.io/addon-framework v0.12.0
open-cluster-management.io/api v0.16.1
open-cluster-management.io/sdk-go v0.16.1-0.20250327030116-e8c524c1a85b
open-cluster-management.io/sdk-go v0.16.1-0.20250327091909-6bd6228a47ad
sigs.k8s.io/cluster-inventory-api v0.0.0-20240730014211-ef0154379848
sigs.k8s.io/controller-runtime v0.19.3
sigs.k8s.io/kube-storage-version-migrator v0.0.6-0.20230721195810-5c8923c5ff96

4
go.sum
View File

@@ -491,8 +491,8 @@ open-cluster-management.io/addon-framework v0.12.0 h1:5j7mpyk2ij0SLUZkwWk0KkNTWt
open-cluster-management.io/addon-framework v0.12.0/go.mod h1:eReMWXrEHqtilwz5wzEpUrWw9Vfz0HJCH9pi3gOTZns=
open-cluster-management.io/api v0.16.1 h1:mS+4UGxHLPQd7CRM0gdFQdVaz139Lo2bkLfqSE0CDNU=
open-cluster-management.io/api v0.16.1/go.mod h1:9erZEWEn4bEqh0nIX2wA7f/s3KCuFycQdBrPrRzi0QM=
open-cluster-management.io/sdk-go v0.16.1-0.20250327030116-e8c524c1a85b h1:MjK6LuPi6kPMG40kMfzV2c7lffmwscUmspXmNGyezV4=
open-cluster-management.io/sdk-go v0.16.1-0.20250327030116-e8c524c1a85b/go.mod h1:TyOjZC5YxyM5BRNgwTmLuTbHXX6xXqzYBXllrfoVp9w=
open-cluster-management.io/sdk-go v0.16.1-0.20250327091909-6bd6228a47ad h1:37f9TEwX/U8esBjSJvPleDM3rcFpk9NY5e2ItjO6PcQ=
open-cluster-management.io/sdk-go v0.16.1-0.20250327091909-6bd6228a47ad/go.mod h1:TyOjZC5YxyM5BRNgwTmLuTbHXX6xXqzYBXllrfoVp9w=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 h1:2770sDpzrjjsAtVhSeUFseziht227YAWYHLGNM8QPwY=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
sigs.k8s.io/cluster-inventory-api v0.0.0-20240730014211-ef0154379848 h1:WYPi2PdQyZwZkHG648v2jQl6deyCgyjJ0fkLYgUJ618=

2
vendor/modules.txt vendored
View File

@@ -1777,7 +1777,7 @@ open-cluster-management.io/api/operator/v1
open-cluster-management.io/api/utils/work/v1/workapplier
open-cluster-management.io/api/work/v1
open-cluster-management.io/api/work/v1alpha1
# open-cluster-management.io/sdk-go v0.16.1-0.20250327030116-e8c524c1a85b
# open-cluster-management.io/sdk-go v0.16.1-0.20250327091909-6bd6228a47ad
## explicit; go 1.22.0
open-cluster-management.io/sdk-go/pkg/apis/cluster/v1alpha1
open-cluster-management.io/sdk-go/pkg/apis/cluster/v1beta1

View File

@@ -20,7 +20,7 @@ type BaseClientWatchStore[T generic.ResourceObject] struct {
}
// List the resources from the store with the list options
func (s *BaseClientWatchStore[T]) List(namespace string, opts metav1.ListOptions) ([]T, error) {
func (s *BaseClientWatchStore[T]) List(namespace string, opts metav1.ListOptions) (*ResourceList[T], error) {
s.RLock()
defer s.RUnlock()
@@ -29,7 +29,7 @@ func (s *BaseClientWatchStore[T]) List(namespace string, opts metav1.ListOptions
return nil, err
}
return resources, nil
return &ResourceList[T]{Items: resources}, nil
}
// Get a resource from the store

View File

@@ -16,6 +16,15 @@ import (
const syncedPollPeriod = 100 * time.Millisecond
// ResourceList is a collection of resources.
type ResourceList[T generic.ResourceObject] struct {
// ListMeta describes list metadata
metav1.ListMeta
// Items is a list of resources.
Items []T
}
// StoreInitiated is a function that can be used to determine if a store has initiated.
type StoreInitiated func() bool
@@ -40,7 +49,7 @@ type ClientWatcherStore[T generic.ResourceObject] interface {
Delete(resource runtime.Object) error
// List returns the resources from store for a given namespace with list options
List(namespace string, opts metav1.ListOptions) ([]T, error)
List(namespace string, opts metav1.ListOptions) (*ResourceList[T], error)
// ListAll list all of the resources from store
ListAll() ([]T, error)

View File

@@ -34,7 +34,7 @@ func (l *AgentWatcherStoreLister[T]) List(options types.ListOptions) ([]T, error
return nil, err
}
return list, nil
return list.Items, nil
}
// SourceWatcherStoreLister list the resources from a ClientWatcherStore on a source.
@@ -55,5 +55,5 @@ func (l *SourceWatcherStoreLister[T]) List(options types.ListOptions) ([]T, erro
return nil, err
}
return list, nil
return list.Items, nil
}

View File

@@ -103,11 +103,11 @@ func (c *ManifestWorkAgentClient) List(ctx context.Context, opts metav1.ListOpti
generic.IncreaseWorkProcessedCounter("list", metav1.StatusSuccess)
items := []workv1.ManifestWork{}
for _, work := range works {
for _, work := range works.Items {
items = append(items, *work)
}
return &workv1.ManifestWorkList{Items: items}, nil
return &workv1.ManifestWorkList{ListMeta: works.ListMeta, Items: items}, nil
}
func (c *ManifestWorkAgentClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {

View File

@@ -212,11 +212,11 @@ func (c *ManifestWorkSourceClient) List(ctx context.Context, opts metav1.ListOpt
generic.IncreaseWorkProcessedCounter("list", metav1.StatusSuccess)
items := []workv1.ManifestWork{}
for _, work := range works {
for _, work := range works.Items {
items = append(items, *work)
}
return &workv1.ManifestWorkList{Items: items}, nil
return &workv1.ManifestWorkList{ListMeta: works.ListMeta, Items: items}, nil
}
func (c *ManifestWorkSourceClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {