mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-07 22:25:03 +00:00
vendor: Update vendor logic
This commit is contained in:
parent
c6ac5cbc87
commit
4ca64b85f0
1540 changed files with 265304 additions and 91616 deletions
6
vendor/k8s.io/apiserver/pkg/registry/generic/OWNERS
generated
vendored
6
vendor/k8s.io/apiserver/pkg/registry/generic/OWNERS
generated
vendored
|
|
@ -17,20 +17,14 @@ reviewers:
|
|||
- saad-ali
|
||||
- janetkuo
|
||||
- pwittrock
|
||||
- roberthbailey
|
||||
- ncdc
|
||||
- eparis
|
||||
- jlowdermilk
|
||||
- piosz
|
||||
- dims
|
||||
- hongchaodeng
|
||||
- krousey
|
||||
- markturansky
|
||||
- fgrzadkowski
|
||||
- xiang90
|
||||
- resouer
|
||||
- mqliang
|
||||
- feihujiang
|
||||
- sdminonne
|
||||
- goltermann
|
||||
- enj
|
||||
|
|
|
|||
2
vendor/k8s.io/apiserver/pkg/registry/generic/options.go
generated
vendored
2
vendor/k8s.io/apiserver/pkg/registry/generic/options.go
generated
vendored
|
|
@ -47,6 +47,6 @@ type RESTOptionsGetter interface {
|
|||
// StoreOptions is set of configuration options used to complete generic registries.
|
||||
type StoreOptions struct {
|
||||
RESTOptions RESTOptionsGetter
|
||||
TriggerFunc storage.TriggerPublisherFunc
|
||||
TriggerFunc storage.IndexerFuncs
|
||||
AttrFunc storage.AttrFunc
|
||||
}
|
||||
|
|
|
|||
5
vendor/k8s.io/apiserver/pkg/registry/generic/registry/dryrun.go
generated
vendored
5
vendor/k8s.io/apiserver/pkg/registry/generic/registry/dryrun.go
generated
vendored
|
|
@ -52,7 +52,7 @@ func (s *DryRunnableStorage) Delete(ctx context.Context, key string, out runtime
|
|||
if err := preconditions.Check(key, out); err != nil {
|
||||
return err
|
||||
}
|
||||
return deleteValidation(out)
|
||||
return deleteValidation(ctx, out)
|
||||
}
|
||||
return s.Storage.Delete(ctx, key, out, preconditions, deleteValidation)
|
||||
}
|
||||
|
|
@ -90,6 +90,9 @@ func (s *DryRunnableStorage) GuaranteedUpdate(
|
|||
return err
|
||||
}
|
||||
rev, err := s.Versioner().ObjectResourceVersion(ptrToType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
out, _, err := tryUpdate(ptrToType, storage.ResponseMeta{ResourceVersion: rev})
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
38
vendor/k8s.io/apiserver/pkg/registry/generic/registry/storage_factory.go
generated
vendored
38
vendor/k8s.io/apiserver/pkg/registry/generic/registry/storage_factory.go
generated
vendored
|
|
@ -25,7 +25,7 @@ import (
|
|||
"k8s.io/apiserver/pkg/registry/generic"
|
||||
"k8s.io/apiserver/pkg/storage"
|
||||
cacherstorage "k8s.io/apiserver/pkg/storage/cacher"
|
||||
etcdstorage "k8s.io/apiserver/pkg/storage/etcd"
|
||||
"k8s.io/apiserver/pkg/storage/etcd3"
|
||||
"k8s.io/apiserver/pkg/storage/storagebackend"
|
||||
"k8s.io/apiserver/pkg/storage/storagebackend/factory"
|
||||
)
|
||||
|
|
@ -39,12 +39,15 @@ func StorageWithCacher(capacity int) generic.StorageDecorator {
|
|||
newFunc func() runtime.Object,
|
||||
newListFunc func() runtime.Object,
|
||||
getAttrsFunc storage.AttrFunc,
|
||||
triggerFunc storage.TriggerPublisherFunc) (storage.Interface, factory.DestroyFunc) {
|
||||
triggerFuncs storage.IndexerFuncs) (storage.Interface, factory.DestroyFunc, error) {
|
||||
|
||||
s, d := generic.NewRawStorage(storageConfig)
|
||||
s, d, err := generic.NewRawStorage(storageConfig)
|
||||
if err != nil {
|
||||
return s, d, err
|
||||
}
|
||||
if capacity <= 0 {
|
||||
klog.V(5).Infof("Storage caching is disabled for %T", newFunc())
|
||||
return s, d
|
||||
return s, d, nil
|
||||
}
|
||||
if klog.V(5) {
|
||||
klog.Infof("Storage caching is enabled for %T with capacity %v", newFunc(), capacity)
|
||||
|
|
@ -53,18 +56,21 @@ func StorageWithCacher(capacity int) generic.StorageDecorator {
|
|||
// TODO: we would change this later to make storage always have cacher and hide low level KV layer inside.
|
||||
// Currently it has two layers of same storage interface -- cacher and low level kv.
|
||||
cacherConfig := cacherstorage.Config{
|
||||
CacheCapacity: capacity,
|
||||
Storage: s,
|
||||
Versioner: etcdstorage.APIObjectVersioner{},
|
||||
ResourcePrefix: resourcePrefix,
|
||||
KeyFunc: keyFunc,
|
||||
NewFunc: newFunc,
|
||||
NewListFunc: newListFunc,
|
||||
GetAttrsFunc: getAttrsFunc,
|
||||
TriggerPublisherFunc: triggerFunc,
|
||||
Codec: storageConfig.Codec,
|
||||
CacheCapacity: capacity,
|
||||
Storage: s,
|
||||
Versioner: etcd3.APIObjectVersioner{},
|
||||
ResourcePrefix: resourcePrefix,
|
||||
KeyFunc: keyFunc,
|
||||
NewFunc: newFunc,
|
||||
NewListFunc: newListFunc,
|
||||
GetAttrsFunc: getAttrsFunc,
|
||||
IndexerFuncs: triggerFuncs,
|
||||
Codec: storageConfig.Codec,
|
||||
}
|
||||
cacher, err := cacherstorage.NewCacherFromConfig(cacherConfig)
|
||||
if err != nil {
|
||||
return nil, func() {}, err
|
||||
}
|
||||
cacher := cacherstorage.NewCacherFromConfig(cacherConfig)
|
||||
destroyFunc := func() {
|
||||
cacher.Stop()
|
||||
d()
|
||||
|
|
@ -75,7 +81,7 @@ func StorageWithCacher(capacity int) generic.StorageDecorator {
|
|||
// merges as that shuts down storage properly
|
||||
RegisterStorageCleanup(destroyFunc)
|
||||
|
||||
return cacher, destroyFunc
|
||||
return cacher, destroyFunc, nil
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
23
vendor/k8s.io/apiserver/pkg/registry/generic/registry/store.go
generated
vendored
23
vendor/k8s.io/apiserver/pkg/registry/generic/registry/store.go
generated
vendored
|
|
@ -44,7 +44,7 @@ import (
|
|||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
"k8s.io/apiserver/pkg/storage"
|
||||
storeerr "k8s.io/apiserver/pkg/storage/errors"
|
||||
"k8s.io/apiserver/pkg/storage/etcd/metrics"
|
||||
"k8s.io/apiserver/pkg/storage/etcd3/metrics"
|
||||
"k8s.io/apiserver/pkg/util/dryrun"
|
||||
|
||||
"k8s.io/klog"
|
||||
|
|
@ -342,7 +342,7 @@ func (e *Store) Create(ctx context.Context, obj runtime.Object, createValidation
|
|||
// at this point we have a fully formed object. It is time to call the validators that the apiserver
|
||||
// handling chain wants to enforce.
|
||||
if createValidation != nil {
|
||||
if err := createValidation(obj.DeepCopyObject()); err != nil {
|
||||
if err := createValidation(ctx, obj.DeepCopyObject()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
|
@ -504,7 +504,7 @@ func (e *Store) Update(ctx context.Context, name string, objInfo rest.UpdatedObj
|
|||
// at this point we have a fully formed object. It is time to call the validators that the apiserver
|
||||
// handling chain wants to enforce.
|
||||
if createValidation != nil {
|
||||
if err := createValidation(obj.DeepCopyObject()); err != nil {
|
||||
if err := createValidation(ctx, obj.DeepCopyObject()); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
}
|
||||
|
|
@ -546,7 +546,7 @@ func (e *Store) Update(ctx context.Context, name string, objInfo rest.UpdatedObj
|
|||
// at this point we have a fully formed object. It is time to call the validators that the apiserver
|
||||
// handling chain wants to enforce.
|
||||
if updateValidation != nil {
|
||||
if err := updateValidation(obj.DeepCopyObject(), existing.DeepCopyObject()); err != nil {
|
||||
if err := updateValidation(ctx, obj.DeepCopyObject(), existing.DeepCopyObject()); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
}
|
||||
|
|
@ -812,7 +812,7 @@ func (e *Store) updateForGracefulDeletionAndFinalizers(ctx context.Context, name
|
|||
false, /* ignoreNotFound */
|
||||
&preconditions,
|
||||
storage.SimpleUpdate(func(existing runtime.Object) (runtime.Object, error) {
|
||||
if err := deleteValidation(existing); err != nil {
|
||||
if err := deleteValidation(ctx, existing); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
graceful, pendingGraceful, err := rest.BeforeDelete(e.DeleteStrategy, ctx, existing, options)
|
||||
|
|
@ -1287,11 +1287,6 @@ func (e *Store) CompleteWithOptions(options *generic.StoreOptions) error {
|
|||
return e.KeyFunc(genericapirequest.NewContext(), accessor.GetName())
|
||||
}
|
||||
|
||||
triggerFunc := options.TriggerFunc
|
||||
if triggerFunc == nil {
|
||||
triggerFunc = storage.NoTriggerPublisher
|
||||
}
|
||||
|
||||
if e.DeleteCollectionWorkers == 0 {
|
||||
e.DeleteCollectionWorkers = opts.DeleteCollectionWorkers
|
||||
}
|
||||
|
|
@ -1310,15 +1305,19 @@ func (e *Store) CompleteWithOptions(options *generic.StoreOptions) error {
|
|||
|
||||
if e.Storage.Storage == nil {
|
||||
e.Storage.Codec = opts.StorageConfig.Codec
|
||||
e.Storage.Storage, e.DestroyFunc = opts.Decorator(
|
||||
var err error
|
||||
e.Storage.Storage, e.DestroyFunc, err = opts.Decorator(
|
||||
opts.StorageConfig,
|
||||
prefix,
|
||||
keyFunc,
|
||||
e.NewFunc,
|
||||
e.NewListFunc,
|
||||
attrFunc,
|
||||
triggerFunc,
|
||||
options.TriggerFunc,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.StorageVersioner = opts.StorageConfig.EncodeVersioner
|
||||
|
||||
if opts.CountMetricPollPeriod > 0 {
|
||||
|
|
|
|||
13
vendor/k8s.io/apiserver/pkg/registry/generic/storage_decorator.go
generated
vendored
13
vendor/k8s.io/apiserver/pkg/registry/generic/storage_decorator.go
generated
vendored
|
|
@ -21,7 +21,6 @@ import (
|
|||
"k8s.io/apiserver/pkg/storage"
|
||||
"k8s.io/apiserver/pkg/storage/storagebackend"
|
||||
"k8s.io/apiserver/pkg/storage/storagebackend/factory"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// StorageDecorator is a function signature for producing a storage.Interface
|
||||
|
|
@ -33,7 +32,7 @@ type StorageDecorator func(
|
|||
newFunc func() runtime.Object,
|
||||
newListFunc func() runtime.Object,
|
||||
getAttrsFunc storage.AttrFunc,
|
||||
trigger storage.TriggerPublisherFunc) (storage.Interface, factory.DestroyFunc)
|
||||
trigger storage.IndexerFuncs) (storage.Interface, factory.DestroyFunc, error)
|
||||
|
||||
// UndecoratedStorage returns the given a new storage from the given config
|
||||
// without any decoration.
|
||||
|
|
@ -44,17 +43,13 @@ func UndecoratedStorage(
|
|||
newFunc func() runtime.Object,
|
||||
newListFunc func() runtime.Object,
|
||||
getAttrsFunc storage.AttrFunc,
|
||||
trigger storage.TriggerPublisherFunc) (storage.Interface, factory.DestroyFunc) {
|
||||
trigger storage.IndexerFuncs) (storage.Interface, factory.DestroyFunc, error) {
|
||||
return NewRawStorage(config)
|
||||
}
|
||||
|
||||
// NewRawStorage creates the low level kv storage. This is a work-around for current
|
||||
// two layer of same storage interface.
|
||||
// TODO: Once cacher is enabled on all registries (event registry is special), we will remove this method.
|
||||
func NewRawStorage(config *storagebackend.Config) (storage.Interface, factory.DestroyFunc) {
|
||||
s, d, err := factory.Create(*config)
|
||||
if err != nil {
|
||||
klog.Fatalf("Unable to create storage backend: config (%v), err (%v)", config, err)
|
||||
}
|
||||
return s, d
|
||||
func NewRawStorage(config *storagebackend.Config) (storage.Interface, factory.DestroyFunc, error) {
|
||||
return factory.Create(*config)
|
||||
}
|
||||
|
|
|
|||
8
vendor/k8s.io/apiserver/pkg/registry/rest/OWNERS
generated
vendored
8
vendor/k8s.io/apiserver/pkg/registry/rest/OWNERS
generated
vendored
|
|
@ -13,22 +13,14 @@ reviewers:
|
|||
- nikhiljindal
|
||||
- gmarek
|
||||
- justinsb
|
||||
- roberthbailey
|
||||
- ncdc
|
||||
- eparis
|
||||
- dims
|
||||
- hongchaodeng
|
||||
- krousey
|
||||
- jszczepkowski
|
||||
- euank
|
||||
- markturansky
|
||||
- fgrzadkowski
|
||||
- fabioy
|
||||
- ingvagabund
|
||||
- david-mcmahon
|
||||
- jianhuiz
|
||||
- nhlfr
|
||||
- feihujiang
|
||||
- sdminonne
|
||||
- goltermann
|
||||
- enj
|
||||
|
|
|
|||
19
vendor/k8s.io/apiserver/pkg/registry/rest/create.go
generated
vendored
19
vendor/k8s.io/apiserver/pkg/registry/rest/create.go
generated
vendored
|
|
@ -92,9 +92,6 @@ func BeforeCreate(strategy RESTCreateStrategy, ctx context.Context, obj runtime.
|
|||
objectMeta.SetName(strategy.GenerateName(objectMeta.GetGenerateName()))
|
||||
}
|
||||
|
||||
// Initializers are a deprecated alpha field and should not be saved
|
||||
objectMeta.SetInitializers(nil)
|
||||
|
||||
// Ensure managedFields is not set unless the feature is enabled
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.ServerSideApply) {
|
||||
objectMeta.SetManagedFields(nil)
|
||||
|
|
@ -163,15 +160,23 @@ type NamespaceScopedStrategy interface {
|
|||
func AdmissionToValidateObjectFunc(admit admission.Interface, staticAttributes admission.Attributes, o admission.ObjectInterfaces) ValidateObjectFunc {
|
||||
validatingAdmission, ok := admit.(admission.ValidationInterface)
|
||||
if !ok {
|
||||
return func(obj runtime.Object) error { return nil }
|
||||
return func(ctx context.Context, obj runtime.Object) error { return nil }
|
||||
}
|
||||
return func(obj runtime.Object) error {
|
||||
return func(ctx context.Context, obj runtime.Object) error {
|
||||
name := staticAttributes.GetName()
|
||||
// in case the generated name is populated
|
||||
if len(name) == 0 {
|
||||
if metadata, err := meta.Accessor(obj); err == nil {
|
||||
name = metadata.GetName()
|
||||
}
|
||||
}
|
||||
|
||||
finalAttributes := admission.NewAttributesRecord(
|
||||
obj,
|
||||
staticAttributes.GetOldObject(),
|
||||
staticAttributes.GetKind(),
|
||||
staticAttributes.GetNamespace(),
|
||||
staticAttributes.GetName(),
|
||||
name,
|
||||
staticAttributes.GetResource(),
|
||||
staticAttributes.GetSubresource(),
|
||||
staticAttributes.GetOperation(),
|
||||
|
|
@ -182,6 +187,6 @@ func AdmissionToValidateObjectFunc(admit admission.Interface, staticAttributes a
|
|||
if !validatingAdmission.Handles(finalAttributes.GetOperation()) {
|
||||
return nil
|
||||
}
|
||||
return validatingAdmission.Validate(finalAttributes, o)
|
||||
return validatingAdmission.Validate(ctx, finalAttributes, o)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
6
vendor/k8s.io/apiserver/pkg/registry/rest/delete.go
generated
vendored
6
vendor/k8s.io/apiserver/pkg/registry/rest/delete.go
generated
vendored
|
|
@ -150,7 +150,7 @@ func AdmissionToValidateObjectDeleteFunc(admit admission.Interface, staticAttrib
|
|||
mutating := isMutatingAdmission && mutatingAdmission.Handles(staticAttributes.GetOperation())
|
||||
validating := isValidatingAdmission && validatingAdmission.Handles(staticAttributes.GetOperation())
|
||||
|
||||
return func(old runtime.Object) error {
|
||||
return func(ctx context.Context, old runtime.Object) error {
|
||||
if !mutating && !validating {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -169,12 +169,12 @@ func AdmissionToValidateObjectDeleteFunc(admit admission.Interface, staticAttrib
|
|||
staticAttributes.GetUserInfo(),
|
||||
)
|
||||
if mutating {
|
||||
if err := mutatingAdmission.Admit(finalAttributes, objInterfaces); err != nil {
|
||||
if err := mutatingAdmission.Admit(ctx, finalAttributes, objInterfaces); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if validating {
|
||||
if err := validatingAdmission.Validate(finalAttributes, objInterfaces); err != nil {
|
||||
if err := validatingAdmission.Validate(ctx, finalAttributes, objInterfaces); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
|||
8
vendor/k8s.io/apiserver/pkg/registry/rest/rest.go
generated
vendored
8
vendor/k8s.io/apiserver/pkg/registry/rest/rest.go
generated
vendored
|
|
@ -210,20 +210,20 @@ type UpdatedObjectInfo interface {
|
|||
// ValidateObjectFunc is a function to act on a given object. An error may be returned
|
||||
// if the hook cannot be completed. An ObjectFunc may NOT transform the provided
|
||||
// object.
|
||||
type ValidateObjectFunc func(obj runtime.Object) error
|
||||
type ValidateObjectFunc func(ctx context.Context, obj runtime.Object) error
|
||||
|
||||
// ValidateAllObjectFunc is a "admit everything" instance of ValidateObjectFunc.
|
||||
func ValidateAllObjectFunc(obj runtime.Object) error {
|
||||
func ValidateAllObjectFunc(ctx context.Context, obj runtime.Object) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ValidateObjectUpdateFunc is a function to act on a given object and its predecessor.
|
||||
// An error may be returned if the hook cannot be completed. An UpdateObjectFunc
|
||||
// may NOT transform the provided object.
|
||||
type ValidateObjectUpdateFunc func(obj, old runtime.Object) error
|
||||
type ValidateObjectUpdateFunc func(ctx context.Context, obj, old runtime.Object) error
|
||||
|
||||
// ValidateAllObjectUpdateFunc is a "admit everything" instance of ValidateObjectUpdateFunc.
|
||||
func ValidateAllObjectUpdateFunc(obj, old runtime.Object) error {
|
||||
func ValidateAllObjectUpdateFunc(ctx context.Context, obj, old runtime.Object) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
10
vendor/k8s.io/apiserver/pkg/registry/rest/update.go
generated
vendored
10
vendor/k8s.io/apiserver/pkg/registry/rest/update.go
generated
vendored
|
|
@ -104,10 +104,6 @@ func BeforeUpdate(strategy RESTUpdateStrategy, ctx context.Context, obj, old run
|
|||
}
|
||||
objectMeta.SetGeneration(oldMeta.GetGeneration())
|
||||
|
||||
// Initializers are a deprecated alpha field and should not be saved
|
||||
oldMeta.SetInitializers(nil)
|
||||
objectMeta.SetInitializers(nil)
|
||||
|
||||
// Ensure managedFields state is removed unless ServerSideApply is enabled
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.ServerSideApply) {
|
||||
oldMeta.SetManagedFields(nil)
|
||||
|
|
@ -259,9 +255,9 @@ func (i *wrappedUpdatedObjectInfo) UpdatedObject(ctx context.Context, oldObj run
|
|||
func AdmissionToValidateObjectUpdateFunc(admit admission.Interface, staticAttributes admission.Attributes, o admission.ObjectInterfaces) ValidateObjectUpdateFunc {
|
||||
validatingAdmission, ok := admit.(admission.ValidationInterface)
|
||||
if !ok {
|
||||
return func(obj, old runtime.Object) error { return nil }
|
||||
return func(ctx context.Context, obj, old runtime.Object) error { return nil }
|
||||
}
|
||||
return func(obj, old runtime.Object) error {
|
||||
return func(ctx context.Context, obj, old runtime.Object) error {
|
||||
finalAttributes := admission.NewAttributesRecord(
|
||||
obj,
|
||||
old,
|
||||
|
|
@ -278,6 +274,6 @@ func AdmissionToValidateObjectUpdateFunc(admit admission.Interface, staticAttrib
|
|||
if !validatingAdmission.Handles(finalAttributes.GetOperation()) {
|
||||
return nil
|
||||
}
|
||||
return validatingAdmission.Validate(finalAttributes, o)
|
||||
return validatingAdmission.Validate(ctx, finalAttributes, o)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue