mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
* added configmap data substitution for foreground mutate and validate * added configmap data substitution for foreground mutate and validate fmt * added configmap lookup for background * added comments to resource cache * added configmap data lookup in preConditions * added parse strings in In operator and configmap lookup docs * added configmap lookup docs * modified configmap lookup docs
45 lines
909 B
Go
45 lines
909 B
Go
package resourcecache
|
|
|
|
import (
|
|
"k8s.io/apimachinery/pkg/labels"
|
|
"k8s.io/apimachinery/pkg/runtime"
|
|
"k8s.io/client-go/tools/cache"
|
|
)
|
|
|
|
// TODO :- Implementation for mocking
|
|
|
|
type TestGVRCache struct {
|
|
}
|
|
|
|
func NewTestGVRCache() GVRCacheIface {
|
|
return &GVRCache{}
|
|
}
|
|
|
|
func (tg *TestGVRCache) StopInformer() {
|
|
|
|
}
|
|
func (tg *TestGVRCache) IsNamespaced() bool {
|
|
return true
|
|
}
|
|
|
|
func (tg *TestGVRCache) GetLister() cache.GenericLister {
|
|
return &TestLister{}
|
|
}
|
|
func (tg *TestGVRCache) GetNamespacedLister(namespace string) cache.GenericNamespaceLister {
|
|
return &TestLister{}
|
|
}
|
|
|
|
type TestLister struct {
|
|
}
|
|
|
|
func (tl *TestLister) List(selector labels.Selector) ([]runtime.Object, error) {
|
|
return []runtime.Object{}, nil
|
|
}
|
|
|
|
func (tl *TestLister) Get(name string) (runtime.Object, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (tl *TestLister) ByNamespace(namespace string) cache.GenericNamespaceLister {
|
|
return &TestLister{}
|
|
}
|