everettraven / everettraven/telescopia

Allow users to configure whether or not the `ScopedCache` should automatically terminate informers

Open
#5 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
0
Forks
2
PR merge metrics
No merged PRs in 30d

Description

## Description

Currently the dynamic cache will automatically terminate informers at the namespace level if the operator/controller loses the permissions to operate in that namespace. It does not automatically do this for informers at the cluster level. The existing logic can be seen in a few places:
- https://github.com/everettraven/telescopia/blob/main/pkg/cache/cache.go#L161-L174
- https://github.com/everettraven/telescopia/blob/main/pkg/cache/cache.go#L261-L275
- https://github.com/everettraven/telescopia/blob/main/pkg/cache/namespace_cache.go#L174-L179

We should expose a way for operator authors to configure whether or not the dynamic cache should automatically terminate informers at both the namespace and cluster level. These should be two separate configuration values - one for the namespace level and one for the cluster level.

To do this we would likely need to add a couple new boolean fields to the `ScopedCache` as well as a new boolean field in the `ClusterScopedCache` and `NamespaceScopedCache` structs.

We should also add a couple new `ScopedCacheOption` functions for configuring these new boolean fields.

After that we need to update any logic that handles termination of informers to work according to the configuration values.

## Acceptance Criteria
- Add new fields as appropriate to `ScopedCache`, `ClusterScopedCache`, and `NamespaceScopedCache` structs
- Add new `ScopedCacheOption` implementations for configuring the new fields
- Add/Update informer termination logic to respect the new configuration values
- Unit tests

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.