mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: update kubernetes dep to 1.24.0
As kubernetes 1.24.0 is released, updating kubernetes dependencies to 1.24.0 updates: #3086 Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
fc1529f268
commit
c4f79d455f
40
vendor/k8s.io/client-go/discovery/discovery_client.go
generated
vendored
40
vendor/k8s.io/client-go/discovery/discovery_client.go
generated
vendored
@ -29,7 +29,7 @@ import (
|
||||
|
||||
//nolint:staticcheck // SA1019 Keep using module since it's still being maintained and the api of google.golang.org/protobuf/proto differs
|
||||
"github.com/golang/protobuf/proto"
|
||||
openapi_v2 "github.com/googleapis/gnostic/openapiv2"
|
||||
openapi_v2 "github.com/google/gnostic/openapiv2"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@ -39,6 +39,7 @@ import (
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apimachinery/pkg/version"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
"k8s.io/client-go/openapi"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
@ -46,7 +47,8 @@ const (
|
||||
// defaultRetries is the number of times a resource discovery is repeated if an api group disappears on the fly (e.g. CustomResourceDefinitions).
|
||||
defaultRetries = 2
|
||||
// protobuf mime type
|
||||
mimePb = "application/com.github.proto-openapi.spec.v2@v1.0+protobuf"
|
||||
openAPIV2mimePb = "application/com.github.proto-openapi.spec.v2@v1.0+protobuf"
|
||||
|
||||
// defaultTimeout is the maximum amount of time per request when no timeout has been set on a RESTClient.
|
||||
// Defaults to 32s in order to have a distinguishable length of time, relative to other timeouts that exist.
|
||||
defaultTimeout = 32 * time.Second
|
||||
@ -60,6 +62,7 @@ type DiscoveryInterface interface {
|
||||
ServerResourcesInterface
|
||||
ServerVersionInterface
|
||||
OpenAPISchemaInterface
|
||||
OpenAPIV3SchemaInterface
|
||||
}
|
||||
|
||||
// CachedDiscoveryInterface is a DiscoveryInterface with cache invalidation and freshness.
|
||||
@ -90,13 +93,6 @@ type ServerGroupsInterface interface {
|
||||
type ServerResourcesInterface interface {
|
||||
// ServerResourcesForGroupVersion returns the supported resources for a group and version.
|
||||
ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error)
|
||||
// ServerResources returns the supported resources for all groups and versions.
|
||||
//
|
||||
// The returned resource list might be non-nil with partial results even in the case of
|
||||
// non-nil error.
|
||||
//
|
||||
// Deprecated: use ServerGroupsAndResources instead.
|
||||
ServerResources() ([]*metav1.APIResourceList, error)
|
||||
// ServerGroupsAndResources returns the supported groups and resources for all groups and versions.
|
||||
//
|
||||
// The returned group and resource lists might be non-nil with partial results even in the
|
||||
@ -128,6 +124,10 @@ type OpenAPISchemaInterface interface {
|
||||
OpenAPISchema() (*openapi_v2.Document, error)
|
||||
}
|
||||
|
||||
type OpenAPIV3SchemaInterface interface {
|
||||
OpenAPIV3() openapi.Client
|
||||
}
|
||||
|
||||
// DiscoveryClient implements the functions that discover server-supported API groups,
|
||||
// versions and resources.
|
||||
type DiscoveryClient struct {
|
||||
@ -210,13 +210,6 @@ func (d *DiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (r
|
||||
return resources, nil
|
||||
}
|
||||
|
||||
// ServerResources returns the supported resources for all groups and versions.
|
||||
// Deprecated: use ServerGroupsAndResources instead.
|
||||
func (d *DiscoveryClient) ServerResources() ([]*metav1.APIResourceList, error) {
|
||||
_, rs, err := d.ServerGroupsAndResources()
|
||||
return rs, err
|
||||
}
|
||||
|
||||
// ServerGroupsAndResources returns the supported resources for all groups and versions.
|
||||
func (d *DiscoveryClient) ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) {
|
||||
return withRetries(defaultRetries, func() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) {
|
||||
@ -247,13 +240,6 @@ func IsGroupDiscoveryFailedError(err error) bool {
|
||||
return err != nil && ok
|
||||
}
|
||||
|
||||
// ServerResources uses the provided discovery interface to look up supported resources for all groups and versions.
|
||||
// Deprecated: use ServerGroupsAndResources instead.
|
||||
func ServerResources(d DiscoveryInterface) ([]*metav1.APIResourceList, error) {
|
||||
_, rs, err := ServerGroupsAndResources(d)
|
||||
return rs, err
|
||||
}
|
||||
|
||||
func ServerGroupsAndResources(d DiscoveryInterface) ([]*metav1.APIGroup, []*metav1.APIResourceList, error) {
|
||||
sgs, err := d.ServerGroups()
|
||||
if sgs == nil {
|
||||
@ -420,9 +406,9 @@ func (d *DiscoveryClient) ServerVersion() (*version.Info, error) {
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// OpenAPISchema fetches the open api schema using a rest client and parses the proto.
|
||||
// OpenAPISchema fetches the open api v2 schema using a rest client and parses the proto.
|
||||
func (d *DiscoveryClient) OpenAPISchema() (*openapi_v2.Document, error) {
|
||||
data, err := d.restClient.Get().AbsPath("/openapi/v2").SetHeader("Accept", mimePb).Do(context.TODO()).Raw()
|
||||
data, err := d.restClient.Get().AbsPath("/openapi/v2").SetHeader("Accept", openAPIV2mimePb).Do(context.TODO()).Raw()
|
||||
if err != nil {
|
||||
if errors.IsForbidden(err) || errors.IsNotFound(err) || errors.IsNotAcceptable(err) {
|
||||
// single endpoint not found/registered in old server, try to fetch old endpoint
|
||||
@ -443,6 +429,10 @@ func (d *DiscoveryClient) OpenAPISchema() (*openapi_v2.Document, error) {
|
||||
return document, nil
|
||||
}
|
||||
|
||||
func (d *DiscoveryClient) OpenAPIV3() openapi.Client {
|
||||
return openapi.NewClient(d.restClient)
|
||||
}
|
||||
|
||||
// withRetries retries the given recovery function in case the groups supported by the server change after ServerGroup() returns.
|
||||
func withRetries(maxRetries int, f func() ([]*metav1.APIGroup, []*metav1.APIResourceList, error)) ([]*metav1.APIGroup, []*metav1.APIResourceList, error) {
|
||||
var result []*metav1.APIResourceList
|
||||
|
Reference in New Issue
Block a user