Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non Watched Namespace Labeled selectors #515

Open
wants to merge 106 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
c3c1bfa
initial commit before code generation
jackstine Aug 17, 2022
9d2a486
solving generator problems
jackstine Aug 18, 2022
a8a66dd
updated the snahost emitter template, it now generates code.
jackstine Aug 18, 2022
ed99470
comment with added
jackstine Aug 18, 2022
acebcb8
update to testing snapshot emitter
jackstine Aug 18, 2022
c466f4d
added code for testing snapshot emitter
jackstine Aug 22, 2022
0f6b483
updated so that ClusterScoped resource snapshot emitters will work
jackstine Aug 22, 2022
16b5232
update the snapshot_emitter to call out to kube for the namespaces
jackstine Aug 22, 2022
e64c8f1
updates to testing and snapshot emitter
jackstine Aug 23, 2022
670cf7e
update for interface for ResourceNamespaces
jackstine Aug 25, 2022
95d8548
updated snapshot_emitter to filter namespaces by labels, and not reso…
jackstine Aug 25, 2022
86bca00
added client interface
jackstine Aug 25, 2022
90b86d2
left out some things
jackstine Aug 25, 2022
26216b5
get interface to work with expression selectors
jackstine Aug 25, 2022
0ef7be9
Merge refs/heads/master into labeled-selectors
soloio-bulldozer[bot] Aug 26, 2022
c829254
got it passing tests for namespaced labels
jackstine Aug 26, 2022
afc7fd2
Merge branch 'labeled-selectors' of ssh://github.com/solo-io/solo-kit…
jackstine Aug 26, 2022
b2ce0cf
snapshot does not contain deleted namespace resources
jackstine Aug 26, 2022
4cf797d
pass CI for non ClusterScoped
jackstine Aug 26, 2022
765bfc5
adding kube client resource namespace lister
jackstine Aug 29, 2022
36bccb7
added in map for watched namespaces
jackstine Aug 29, 2022
af6eb5d
updated snapshot emitter, delt with err channels and with deleting na…
jackstine Aug 30, 2022
644a6f9
clean up and reviews
jackstine Aug 30, 2022
4c4192f
add missing file generated
jackstine Aug 30, 2022
5c53707
change variable name
jackstine Aug 30, 2022
ac6124f
update with comments, and nits
jackstine Aug 30, 2022
3f60056
moving some functions
jackstine Aug 30, 2022
24ded9e
small change
jackstine Aug 30, 2022
8bd5ec5
closing the channels
jackstine Aug 30, 2022
2a9cf1c
updated the tests
jackstine Aug 30, 2022
20770ed
fix kube event loop error
jackstine Aug 30, 2022
835b2f9
update changelog
jackstine Aug 30, 2022
4c86983
to pass CI retro 1
jackstine Aug 30, 2022
62de6b8
fix
jackstine Aug 31, 2022
0d847d1
fix
jackstine Aug 31, 2022
feb1c79
race conditions, still working on fixing issues with deleted namespaces
jackstine Aug 31, 2022
c2377cf
fix issue with non Expression Selector emitters updating when namespa…
jackstine Sep 1, 2022
b806cfc
update fix problem with namespaces getting terminated, but not deleted
jackstine Sep 1, 2022
8587388
refactored the test code, to make it more easier to manage
jackstine Sep 1, 2022
148dc61
missing build solokit
jackstine Sep 1, 2022
576f2aa
fix issue with name5
jackstine Sep 1, 2022
1a0989a
fix name5
jackstine Sep 1, 2022
3aa046c
v1 alpha
jackstine Sep 1, 2022
f09e7e6
fix problems with parallel tests
jackstine Sep 1, 2022
217108b
update to fix notifications about snapshots
jackstine Sep 1, 2022
a1fb027
missing file updates
jackstine Sep 1, 2022
f1db36e
add updated go build comments
jackstine Sep 1, 2022
f6d374f
Merge ssh://github.com/solo-io/solo-kit into labeledSelectors
jackstine Sep 9, 2022
9aafe60
updated the controller to allow adding informers
jackstine Sep 11, 2022
e7371ca
register new namespace to cache
jackstine Sep 12, 2022
d3c5196
register new namespaces for the Resoruce Client Shared Informer Factory
jackstine Sep 12, 2022
ce03b28
Merge branch 'cache-changes' into labeled-selectors
jackstine Sep 12, 2022
1ae4371
added in Register Namespace to the Resouce client interface.
jackstine Sep 12, 2022
5e9f466
update resource clients
jackstine Sep 13, 2022
b72998b
Merge refs/heads/master into labeled-selectors
soloio-bulldozer[bot] Sep 13, 2022
cb7159b
add rc template
jackstine Sep 13, 2022
e2b5868
Merge branch 'labeled-selectors' of ssh://github.com/solo-io/solo-kit…
jackstine Sep 13, 2022
d05edec
add in once functionality to register calls
jackstine Sep 13, 2022
0e2db70
rcf must start() if we are registering namespaces to it
jackstine Sep 13, 2022
2ad5399
possible race condition fix
jackstine Sep 13, 2022
e9c3539
fix registering issue
jackstine Sep 13, 2022
7af3b64
fix reconciler
jackstine Sep 13, 2022
7b1e280
change test so that the kube cache does not panic
jackstine Sep 13, 2022
b334e28
update the client interface
jackstine Sep 13, 2022
f3597e0
better mutex control
jackstine Sep 13, 2022
6988153
fix race condition in test
jackstine Sep 13, 2022
0641785
add comment
jackstine Sep 13, 2022
2f06f41
allow new namespaces in the kube resouce client
jackstine Sep 13, 2022
57873d6
clean up
jackstine Sep 13, 2022
b9cbb91
added in a test for when namespaces are deleted
jackstine Sep 13, 2022
8bb2c03
fix cache test
jackstine Sep 13, 2022
c074097
fix cache test again
jackstine Sep 13, 2022
f3aa04a
Adding changelog file to new location
Sep 14, 2022
ea8b754
Deleting changelog file from old location
Sep 14, 2022
9894a78
Merge branch 'master' into labeled-selectors
jackstine Sep 15, 2022
39072d5
fix merge conflict issue
jackstine Sep 15, 2022
50578c7
finish todos, add logs for registered namespaces, fixed issue with Re…
jackstine Sep 16, 2022
7b30788
update tests
jackstine Sep 16, 2022
24c3941
fixed issue with test, and cleaned up tests a little
jackstine Sep 19, 2022
93642d1
fix error with kube emitter
jackstine Sep 19, 2022
a047e22
Adding changelog file to new location
Sep 21, 2022
2353077
Deleting changelog file from old location
Sep 21, 2022
f8e908c
Kube Cache now requires a boolean for creating the namespace lister
jackstine Sep 21, 2022
ed44661
Merge branch 'labeled-selectors' of ssh://github.com/solo-io/solo-kit…
jackstine Sep 21, 2022
57e4976
Merge branch 'master' into labeled-selectors
jackstine Sep 21, 2022
8d91464
update to fix merge conflict
jackstine Sep 21, 2022
4c7db7f
when namespaces is set to "" then create the namespace lister
jackstine Sep 21, 2022
1c1fa6c
condition on namespace lister
jackstine Sep 21, 2022
66ddd96
delete failing mock_custom spec hash resource
jackstine Sep 22, 2022
eee5ed2
some touch ups. Errors are now logged in the list and watch functions…
jackstine Sep 22, 2022
53176bf
move changelog
jackstine Sep 22, 2022
b6afc93
Merge refs/heads/master into labeled-selectors
soloio-bulldozer[bot] Sep 28, 2022
548a0c9
Merge refs/heads/master into labeled-selectors
soloio-bulldozer[bot] Sep 29, 2022
d2f6b4d
Merge refs/heads/master into labeled-selectors
soloio-bulldozer[bot] Sep 29, 2022
c3b1510
Adding changelog file to new location
Feb 13, 2023
879f457
Deleting changelog file from old location
Feb 13, 2023
3e2718b
Adding changelog file to new location
May 19, 2023
26bac9d
Deleting changelog file from old location
May 19, 2023
e6f69d4
Adding changelog file to new location
Jul 21, 2023
c0ea174
Deleting changelog file from old location
Jul 21, 2023
f8db291
Adding changelog file to new location
Dec 5, 2023
ebcbbd9
Deleting changelog file from old location
Dec 5, 2023
9f7df5e
Adding changelog file to new location
May 28, 2024
5100636
Deleting changelog file from old location
May 28, 2024
9f20d56
Adding changelog file to new location
Sep 11, 2024
b560d27
Deleting changelog file from old location
Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ $(OUTPUT_DIR)/.clientset: $(GENERATED_PROTO_FILES) $(SOURCES)
.PHONY: generated-code
generated-code: $(OUTPUT_DIR)/.generated-code update-licenses

.PHONY: generate-all
generate-all: generated-code

SUBDIRS:=pkg test
$(OUTPUT_DIR)/.generated-code:
mkdir -p ${OUTPUT_DIR}
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# solo-kit
A collection of code generation and libraries to for API development.

### Testing
To generate tests set `SkipGeneratedTests` to false in the `generate.go` file. This will use the test templates
to generate the code for the tests. This will allow generation of templates such as `pkg/code-generator/codegen/templates/snapshot_emitter_test_template.go`

### Description:
- Define your declarative API in `.proto` files
- APIs are defined by top-level protobuf messages in `.proto` files
Expand Down
10 changes: 10 additions & 0 deletions changelog/v0.37.0/namespace-selectors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
changelog:
- type: BREAKING_CHANGE
issueLink: https://github.com/solo-io/gloo/issues/5868
resolvesIssue: false
description: |
Added the ability to watch namespaces given by Expression Selectors in the Watch Opts.
Watched Namespaces work as normally. When Expression Selectors are set the snapshot
emitter will watch, in addition to the watched namespaces, namespaces that
are labeled and meet the criteria of the Expression Selector. All resource
clients will watch these namespaces, if set, via the snapshot emitters.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ func ToKubeCustomResourceDefinition(resource resources.Resource) (*v1.CustomReso

var _ clients.ResourceClient = &customResourceDefinitionResourceClient{}

func (rc *customResourceDefinitionResourceClient) RegisterNamespace(namespace string) error {
return nil
}

func (rc *customResourceDefinitionResourceClient) Read(namespace, name string, opts clients.ReadOpts) (resources.Resource, error) {
if err := resources.ValidateName(name); err != nil {
return nil, errors.Wrapf(err, "validation error")
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/external/kubernetes/deployment/resource_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ func ToKubeDeployment(resource resources.Resource) (*appsv1.Deployment, error) {

var _ clients.ResourceClient = &deploymentResourceClient{}

func (rc *deploymentResourceClient) RegisterNamespace(namespace string) error {
return nil
}

func (rc *deploymentResourceClient) Read(namespace, name string, opts clients.ReadOpts) (resources.Resource, error) {
if err := resources.ValidateName(name); err != nil {
return nil, errors.Wrapf(err, "validation error")
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/external/kubernetes/job/resource_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ func ToKubeJob(resource resources.Resource) (*batchv1.Job, error) {

var _ clients.ResourceClient = &jobResourceClient{}

func (rc *jobResourceClient) RegisterNamespace(namespace string) error {
return nil
}

func (rc *jobResourceClient) Read(namespace, name string, opts clients.ReadOpts) (resources.Resource, error) {
if err := resources.ValidateName(name); err != nil {
return nil, errors.Wrapf(err, "validation error")
Expand Down
11 changes: 9 additions & 2 deletions pkg/api/external/kubernetes/namespace/resource_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
kubev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes"
)
Expand Down Expand Up @@ -65,6 +64,10 @@ func ToKubeNamespace(resource resources.Resource) (*kubev1.Namespace, error) {
return &namespace, nil
}

func (rc *namespaceResourceClient) RegisterNamespace(namespace string) error {
return rc.cache.RegisterNewNamespaceCache(namespace)
}

func (rc *namespaceResourceClient) Read(namespace, name string, opts clients.ReadOpts) (resources.Resource, error) {
if err := resources.ValidateName(name); err != nil {
return nil, eris.Wrapf(err, "validation error")
Expand Down Expand Up @@ -173,7 +176,11 @@ func (rc *namespaceResourceClient) List(namespace string, opts clients.ListOpts)
return nil, eris.New("to list namespaces you must watch all namespaces")
}

namespaceObjList, err := rc.cache.NamespaceLister().List(labels.SelectorFromSet(opts.Selector))
listOptions, err := clients.GetLabelSelector(opts)
if err != nil {
return nil, err
}
namespaceObjList, err := rc.cache.NamespaceLister().List(listOptions)
if err != nil {
return nil, eris.Wrapf(err, "listing namespaces level")
}
Expand Down
185 changes: 185 additions & 0 deletions pkg/api/external/kubernetes/namespace/resource_namespace.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
package namespace

import (
"bytes"

"github.com/pkg/errors"
"github.com/solo-io/solo-kit/pkg/api/v1/clients"
"github.com/solo-io/solo-kit/pkg/api/v1/clients/kube/cache"
"github.com/solo-io/solo-kit/pkg/api/v1/resources"
skkube "github.com/solo-io/solo-kit/pkg/api/v1/resources/common/kubernetes"
kubev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kubewatch "k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/kubernetes"
)

var _ resources.ResourceNamespaceLister = &kubeResourceNamespaceLister{}
var _ resources.ResourceNamespaceLister = &kubeClientResourceNamespaceLister{}

// NewKubeClientCacheResourceNamespaceLister will create a new resource namespace lister that requires the kubernestes
// client and cache.
func NewKubeClientCacheResourceNamespaceLister(kube kubernetes.Interface, cache cache.KubeCoreCache) resources.ResourceNamespaceLister {
return &kubeResourceNamespaceLister{
client: NewNamespaceClient(kube, cache),
}
}

// NewKubeClientResourceNamespaceLister will create a new resource namespace lister that requires the kubernetes client
// interface.
func NewKubeClientResourceNamespaceLister(kube kubernetes.Interface) resources.ResourceNamespaceLister {
return &kubeClientResourceNamespaceLister{
kube: kube,
}
}
jackstine marked this conversation as resolved.
Show resolved Hide resolved

type kubeResourceNamespaceLister struct {
client skkube.KubeNamespaceClient
}

// GetResourceNamespaceList is the kubernetes implementation that returns the list of namespaces
func (kns *kubeResourceNamespaceLister) GetResourceNamespaceList(opts resources.ResourceNamespaceListOptions, filtered resources.ResourceNamespaceList) (resources.ResourceNamespaceList, error) {
namespaces, err := kns.client.List(clients.TranslateResourceNamespaceListToListOptions(opts))
if err != nil {
return nil, err
}
converted := convertNamespaceListToResourceNamespace(namespaces)
return kns.filter(converted, filtered), nil
}

// GetResourceNamespaceWatch returns a watch for events that occur on kube namespaces returning a list of all the namespaces
func (kns *kubeResourceNamespaceLister) GetResourceNamespaceWatch(opts resources.ResourceNamespaceWatchOptions, filtered resources.ResourceNamespaceList) (chan resources.ResourceNamespaceList, <-chan error, error) {
ctx := opts.Ctx
wopts := clients.TranslateResourceNamespaceListToWatchOptions(opts)
namespaceChan, errorChan, err := kns.client.Watch(wopts)
if err != nil {
return nil, nil, err
}

resourceNamespaceChan := make(chan resources.ResourceNamespaceList)
go func() {
defer close(resourceNamespaceChan)
for {
select {
case namespaceList := <-namespaceChan:
select {
case resourceNamespaceChan <- kns.filter(convertNamespaceListToResourceNamespace(namespaceList), filtered):
case <-ctx.Done():
return
}
case <-ctx.Done():
return
}
}
}()
return resourceNamespaceChan, errorChan, nil
}

func (kns *kubeResourceNamespaceLister) filter(namespaces resources.ResourceNamespaceList, filter resources.ResourceNamespaceList) resources.ResourceNamespaceList {
filteredList := resources.ResourceNamespaceList{}
for _, ns := range namespaces {
add := true
for _, wns := range filter {
if ns.Name == wns.Name {
add = false
break
}
}
if add {
filteredList = append(filteredList, ns)
}
}
return filteredList
}

func convertNamespaceListToResourceNamespace(namespaces skkube.KubeNamespaceList) resources.ResourceNamespaceList {
l := make(resources.ResourceNamespaceList, len(namespaces))
for i, ns := range namespaces {
l[i] = resources.ResourceNamespace{Name: ns.ObjectMeta.Name}
}
return l
}

type kubeClientResourceNamespaceLister struct {
kube kubernetes.Interface
}

// GetResourceNamespaceList is the kubernetes implementation that returns the list of namespaces
func (client *kubeClientResourceNamespaceLister) GetResourceNamespaceList(opts resources.ResourceNamespaceListOptions, filtered resources.ResourceNamespaceList) (resources.ResourceNamespaceList, error) {
excludeNamespaces := client.getExcludeFieldSelector(filtered)
namespaceList, err := client.kube.CoreV1().Namespaces().List(opts.Ctx, metav1.ListOptions{FieldSelector: excludeNamespaces, LabelSelector: opts.ExpressionSelector})
if err != nil {
return nil, err
}
return convertNamespaceListToResourceNamespaceList(namespaceList), nil
}

// GetResourceNamespaceWatch returns a watch for events that occur on kube namespaces returning a list of all the namespaces
func (client *kubeClientResourceNamespaceLister) GetResourceNamespaceWatch(opts resources.ResourceNamespaceWatchOptions, filtered resources.ResourceNamespaceList) (chan resources.ResourceNamespaceList, <-chan error, error) {
excludeNamespaces := client.getExcludeFieldSelector(filtered)
namespaceWatcher, err := client.kube.CoreV1().Namespaces().Watch(opts.Ctx, metav1.ListOptions{FieldSelector: excludeNamespaces, LabelSelector: opts.ExpressionSelector})
if err != nil {
return nil, nil, err
}
namespaceChan := namespaceWatcher.ResultChan()
resourceNamespaceChan := make(chan resources.ResourceNamespaceList)
errorChannel := make(chan error)
go func() {
defer func() {
close(resourceNamespaceChan)
close(errorChannel)
}()
Comment on lines +128 to +131
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing the channels here when an error occurs.

for {
select {
case <-opts.Ctx.Done():
return
case event, ok := <-namespaceChan:
if !ok {
return
}
switch event.Type {
case kubewatch.Error:
errorChannel <- errors.Errorf("error with the event from watching namespaces: %v", event)
return
default:
resourceNamespaceList, err := client.GetResourceNamespaceList(resources.ResourceNamespaceListOptions{
Ctx: opts.Ctx,
ExpressionSelector: opts.ExpressionSelector,
}, filtered)
if err != nil {
errorChannel <- errors.Wrap(err, "error getting the list of resource namespaces while watching")
return
}
resourceNamespaceChan <- resourceNamespaceList
}
}
}
}()
return resourceNamespaceChan, errorChannel, nil
}

func (client *kubeClientResourceNamespaceLister) getExcludeFieldSelector(filtered resources.ResourceNamespaceList) string {
// you can filter the namespaces by using metadata.name for more information on field selectors
// https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/
var buffer bytes.Buffer
for i, rns := range filtered {
ns := rns.Name
if ns != "" {
buffer.WriteString("metadata.name!=")
buffer.WriteString(ns)
if i < len(filtered)-1 {
buffer.WriteByte(',')
}
}
}
return buffer.String()
}

func convertNamespaceListToResourceNamespaceList(namespaceList *kubev1.NamespaceList) resources.ResourceNamespaceList {
resourceNamespaces := make(resources.ResourceNamespaceList, len(namespaceList.Items))
for i, item := range namespaceList.Items {
ns := item.Name
resourceNamespaces[i] = resources.ResourceNamespace{Name: ns}
}
return resourceNamespaces
}
4 changes: 4 additions & 0 deletions pkg/api/external/kubernetes/pod/resource_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ func ToKubePod(resource resources.Resource) (*kubev1.Pod, error) {

var _ clients.ResourceClient = &podResourceClient{}

func (rc *podResourceClient) RegisterNamespace(namespace string) error {
return rc.cache.RegisterNewNamespaceCache(namespace)
}

func (rc *podResourceClient) Read(namespace, name string, opts clients.ReadOpts) (resources.Resource, error) {
if err := resources.ValidateName(name); err != nil {
return nil, errors.Wrapf(err, "validation error")
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/external/kubernetes/service/resource_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ func ToKubeService(resource resources.Resource) (*kubev1.Service, error) {

var _ clients.ResourceClient = &serviceResourceClient{}

func (rc *serviceResourceClient) RegisterNamespace(namespace string) error {
return rc.cache.RegisterNewNamespaceCache(namespace)
}

func (rc *serviceResourceClient) Read(namespace, name string, opts clients.ReadOpts) (resources.Resource, error) {
if err := resources.ValidateName(name); err != nil {
return nil, errors.Wrapf(err, "validation error")
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/v1/clients/apiclient/resource_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ func (rc *ResourceClient) Register() error {
return nil
}

func (rc *ResourceClient) RegisterNamespace(namespace string) error {
return nil
}

func (rc *ResourceClient) Read(namespace, name string, opts clients.ReadOpts) (resources.Resource, error) {
if err := resources.ValidateName(name); err != nil {
return nil, errors.Wrapf(err, "validation error")
Expand Down
1 change: 1 addition & 0 deletions pkg/api/v1/clients/client_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type ResourceClient interface {
NewResource() resources.Resource
// Deprecated: implemented only by the kubernetes resource client. Will be removed from the interface.
Register() error
RegisterNamespace(namespace string) error
Read(namespace, name string, opts ReadOpts) (resources.Resource, error)
Write(resource resources.Resource, opts WriteOpts) (resources.Resource, error)
Delete(namespace, name string, opts DeleteOpts) error
Expand Down
6 changes: 2 additions & 4 deletions pkg/api/v1/clients/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ func KubeResourceWatch(cache cache.Cache, listFunc ResourceListFunc, namespace s
// prevent flooding the channel with duplicates
var previous *resources.ResourceList
updateResourceList := func() {
list, err := listFunc(namespace, clients.ListOpts{
Ctx: opts.Ctx,
Selector: opts.Selector,
})
lopts := clients.TranslateWatchOptsIntoListOpts(opts)
list, err := listFunc(namespace, lopts)
if err != nil {
errs <- err
return
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/v1/clients/configmap/resource_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func NewResourceClientWithConverter(kube kubernetes.Interface, resourceType reso

var _ clients.ResourceClient = &ResourceClient{}

func (rc *ResourceClient) RegisterNamespace(namespace string) error {
return rc.cache.RegisterNewNamespaceCache(namespace)
}

func (rc *ResourceClient) Read(namespace, name string, opts clients.ReadOpts) (resources.Resource, error) {
if err := resources.ValidateName(name); err != nil {
return nil, errors.Wrapf(err, "validation error")
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/v1/clients/consul/resource_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func (rc *ResourceClient) Register() error {
return nil
}

func (rc *ResourceClient) RegisterNamespace(ns string) error {
return nil
}

func (rc *ResourceClient) Read(namespace, name string, opts clients.ReadOpts) (resources.Resource, error) {
if err := resources.ValidateName(name); err != nil {
return nil, errors.Wrapf(err, "validation error")
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/v1/clients/file/resource_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ func (rc *ResourceClient) Register() error {
return nil
}

func (rc *ResourceClient) RegisterNamespace(namespace string) error {
return nil
}

func (rc *ResourceClient) Read(namespace, name string, opts clients.ReadOpts) (resources.Resource, error) {
if err := resources.ValidateName(name); err != nil {
return nil, errors.Wrapf(err, "validation error")
Expand Down
Loading