fix: uppercase abbreviation for endpointSlices
This commit is contained in:
parent
bce5d7541c
commit
1bdb178cb0
3 changed files with 8 additions and 8 deletions
|
@ -23,12 +23,12 @@ import (
|
|||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
type getEpssForServiceFunc = func(key string) ([]*discoveryv1.EndpointSlice, error)
|
||||
type getEPSsForServiceFunc = func(key string) ([]*discoveryv1.EndpointSlice, error)
|
||||
|
||||
// EndpointSliceLister makes a Store that lists Endpoints.
|
||||
type EndpointSliceLister struct {
|
||||
cache.Store
|
||||
endpointSliceIndex getEpssForServiceFunc
|
||||
endpointSliceIndex getEPSsForServiceFunc
|
||||
}
|
||||
|
||||
// MatchByKey returns the EndpointsSlices of the Service matching key in the local Endpoint Store.
|
||||
|
@ -44,7 +44,7 @@ func (s *EndpointSliceLister) MatchByKey(key string) ([]*discoveryv1.EndpointSli
|
|||
return epss, nil
|
||||
}
|
||||
|
||||
func epssIndexer() cache.Indexers {
|
||||
func newEPSsIndexer() cache.Indexers {
|
||||
return cache.Indexers{
|
||||
discoveryv1.LabelServiceName: func(obj interface{}) ([]string, error) {
|
||||
eps, ok := obj.(*discoveryv1.EndpointSlice)
|
||||
|
@ -67,7 +67,7 @@ func epssIndexer() cache.Indexers {
|
|||
}
|
||||
}
|
||||
|
||||
func epssForServiceFuncFromIndexer(indexer cache.Indexer) getEppsForServiceFunc {
|
||||
func getEPSsForServiceFuncFromIndexer(indexer cache.Indexer) getEPSsForServiceFunc {
|
||||
return func(key string) ([]*discoveryv1.EndpointSlice, error) {
|
||||
objs, err := indexer.ByIndex(discoveryv1.LabelServiceName, key)
|
||||
if err != nil {
|
||||
|
|
|
@ -29,11 +29,11 @@ func newEndpointSliceLister(t *testing.T) (*EndpointSliceLister, cache.Indexer)
|
|||
t.Helper()
|
||||
|
||||
store := cache.NewStore(cache.MetaNamespaceKeyFunc)
|
||||
indexer := cache.NewIndexer(cache.MetaNamespaceKeyFunc, epssIndexer())
|
||||
indexer := cache.NewIndexer(cache.MetaNamespaceKeyFunc, newEPSsIndexer())
|
||||
|
||||
return &EndpointSliceLister{
|
||||
Store: store,
|
||||
endpointSliceIndex: eppsForServiceFuncFromIndexer(indexer),
|
||||
endpointSliceIndex: getEPSsForServiceFuncFromIndexer(indexer),
|
||||
}, indexer
|
||||
}
|
||||
|
||||
|
|
|
@ -342,14 +342,14 @@ func New(
|
|||
|
||||
store.informers.EndpointSlice = infFactory.Discovery().V1().EndpointSlices().Informer()
|
||||
// Add new endpointslices indexer to markup epps upfront for fast pinpoint retrieval
|
||||
if err := store.informers.EndpointSlice.AddIndexers(epssIndexer()); err != nil {
|
||||
if err := store.informers.EndpointSlice.AddIndexers(newEPSsIndexer()); err != nil {
|
||||
// This error only occurs due to errors in code, this panic is not possible in runtime
|
||||
// if the underlying code is correct. Typically, this error signals conflicts in indexer
|
||||
panic(fmt.Sprintf("failed to add new index for endpointslices: %v", err))
|
||||
}
|
||||
|
||||
store.listers.EndpointSlice.Store = store.informers.EndpointSlice.GetStore()
|
||||
store.listers.EndpointSlice.endpointSliceIndex = eppsForServiceFuncFromIndexer(store.informers.EndpointSlice.GetIndexer())
|
||||
store.listers.EndpointSlice.endpointSliceIndex = getEPSsForServiceFuncFromIndexer(store.informers.EndpointSlice.GetIndexer())
|
||||
|
||||
store.informers.Secret = infFactorySecrets.Core().V1().Secrets().Informer()
|
||||
store.listers.Secret.Store = store.informers.Secret.GetStore()
|
||||
|
|
Loading…
Reference in a new issue