mirror of
https://github.com/kubernetes/sample-controller.git
synced 2025-01-31 17:02:52 +08:00
Merge pull request #118455 from linxiulei/managedFields
Trim managedFields in controller-manager Kubernetes-commit: 1acd489dca47a4be0301330cbfcf4e8f9d98f7c0
This commit is contained in:
commit
e6c6a2fcf2
16
go.mod
16
go.mod
@ -5,10 +5,10 @@ module k8s.io/sample-controller
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
k8s.io/api v0.0.0-20230807202504-d11dea4516ea
|
||||
k8s.io/apimachinery v0.0.0-20230807201405-8071e5f05ff1
|
||||
k8s.io/client-go v0.0.0-20230807204204-49410bfbbcf9
|
||||
k8s.io/code-generator v0.0.0-20230807201020-acb52e329a7f
|
||||
k8s.io/api v0.0.0-20230810042731-2f6eec10c476
|
||||
k8s.io/apimachinery v0.0.0-20230815235016-14436eb53afd
|
||||
k8s.io/client-go v0.0.0-20230816000758-856e847bb7cb
|
||||
k8s.io/code-generator v0.0.0-20230815234323-164b07cd93ea
|
||||
k8s.io/klog/v2 v2.100.1
|
||||
)
|
||||
|
||||
@ -58,8 +58,8 @@ require (
|
||||
)
|
||||
|
||||
replace (
|
||||
k8s.io/api => k8s.io/api v0.0.0-20230807202504-d11dea4516ea
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20230807201405-8071e5f05ff1
|
||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20230807204204-49410bfbbcf9
|
||||
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20230807201020-acb52e329a7f
|
||||
k8s.io/api => k8s.io/api v0.0.0-20230810042731-2f6eec10c476
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20230815235016-14436eb53afd
|
||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20230816000758-856e847bb7cb
|
||||
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20230815234323-164b07cd93ea
|
||||
)
|
||||
|
16
go.sum
16
go.sum
@ -143,14 +143,14 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/api v0.0.0-20230807202504-d11dea4516ea h1:1IjoJXclbOUWuIkoxE1+p/7hQvNqXiTnAikqG+h+B54=
|
||||
k8s.io/api v0.0.0-20230807202504-d11dea4516ea/go.mod h1:RFi7MZgMNqcWc0azfutkpPR/OdHWZjnTAwdFHTKjAUQ=
|
||||
k8s.io/apimachinery v0.0.0-20230807201405-8071e5f05ff1 h1:NElIwKgvUTGJ2/PZEctXR9JmNzUbb8q38ojfC5guWeU=
|
||||
k8s.io/apimachinery v0.0.0-20230807201405-8071e5f05ff1/go.mod h1:X0xh/chESs2hP9koe+SdIAcXWcQ+RM5hy0ZynB+yEvw=
|
||||
k8s.io/client-go v0.0.0-20230807204204-49410bfbbcf9 h1:/wXosf3IlbuvLQQBDkBY+lSOmJGaTB5931MVjn3Zq5A=
|
||||
k8s.io/client-go v0.0.0-20230807204204-49410bfbbcf9/go.mod h1:NbnWu9sTxFULr211okLOk4jiLYAyWn+kFzXmCLu2pK4=
|
||||
k8s.io/code-generator v0.0.0-20230807201020-acb52e329a7f h1:1CAH9BKC3/h1amX1Gj/5TSQnxF5kIEAQ+GZenTMgSb8=
|
||||
k8s.io/code-generator v0.0.0-20230807201020-acb52e329a7f/go.mod h1:ueeSJZJ61NHBa0ccWLey6mwawum25vX61nRZ6WOzN9A=
|
||||
k8s.io/api v0.0.0-20230810042731-2f6eec10c476 h1:1LpPoqkYurARQ/TQ0U3DRAclyCkM7hMCMCUVymCR3jM=
|
||||
k8s.io/api v0.0.0-20230810042731-2f6eec10c476/go.mod h1:RFi7MZgMNqcWc0azfutkpPR/OdHWZjnTAwdFHTKjAUQ=
|
||||
k8s.io/apimachinery v0.0.0-20230815235016-14436eb53afd h1:x//MctFnLnU7WIEUEorfJtI5RkFptZADuNKPFxZBdbg=
|
||||
k8s.io/apimachinery v0.0.0-20230815235016-14436eb53afd/go.mod h1:X0xh/chESs2hP9koe+SdIAcXWcQ+RM5hy0ZynB+yEvw=
|
||||
k8s.io/client-go v0.0.0-20230816000758-856e847bb7cb h1:QLY5cHaZwawHP6394w6miAQAaJ2fwlA/TfRHXmG4U3M=
|
||||
k8s.io/client-go v0.0.0-20230816000758-856e847bb7cb/go.mod h1:xt/XQN6z9voSDnQ/uCIJ3a5n5sk2lhhnwzWGeuDhsvE=
|
||||
k8s.io/code-generator v0.0.0-20230815234323-164b07cd93ea h1:3WnCOKP05rMRNEVxS6nac/AZCQ01G7dkrAl7lLeMjTM=
|
||||
k8s.io/code-generator v0.0.0-20230815234323-164b07cd93ea/go.mod h1:ueeSJZJ61NHBa0ccWLey6mwawum25vX61nRZ6WOzN9A=
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d h1:U9tB195lKdzwqicbJvyJeOXV7Klv+wNAWENRnXEGi08=
|
||||
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
|
||||
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
|
||||
|
@ -42,6 +42,7 @@ type sharedInformerFactory struct {
|
||||
lock sync.Mutex
|
||||
defaultResync time.Duration
|
||||
customResync map[reflect.Type]time.Duration
|
||||
transform cache.TransformFunc
|
||||
|
||||
informers map[reflect.Type]cache.SharedIndexInformer
|
||||
// startedInformers is used for tracking which informers have been started.
|
||||
@ -80,6 +81,14 @@ func WithNamespace(namespace string) SharedInformerOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WithTransform sets a transform on all informers.
|
||||
func WithTransform(transform cache.TransformFunc) SharedInformerOption {
|
||||
return func(factory *sharedInformerFactory) *sharedInformerFactory {
|
||||
factory.transform = transform
|
||||
return factory
|
||||
}
|
||||
}
|
||||
|
||||
// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces.
|
||||
func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory {
|
||||
return NewSharedInformerFactoryWithOptions(client, defaultResync)
|
||||
@ -184,6 +193,7 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal
|
||||
}
|
||||
|
||||
informer = newFunc(f.client, resyncPeriod)
|
||||
informer.SetTransform(f.transform)
|
||||
f.informers[informerType] = informer
|
||||
|
||||
return informer
|
||||
|
Loading…
Reference in New Issue
Block a user