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

No longer read kubernetes_config.cache_enabled config #5779

Merged

Conversation

israel-hdez
Copy link
Member

This small change will prevent reading (unmarshalling) the kubernetes_config.cache_enabled configuration from a YAML file (i.e. from a Kubernetes ConfigMap).

This effectively makes it impossible to disable Kiali's kube cache via the usual configuration mechanism. This will allow to write new code under the assumption that the kube cache is always enabled (i.e. no more if/else conditionals around this configuration variable).

The kube cache can still be disabled programmatically. This will allow to gradually update existing code to stop relying on the removed configuration (most notably, unit tests need to be adapted).

Related #5599

This small change will prevent reading (unmarshalling) the kubernetes_config.cache_enabled configuration from a YAML file (i.e. from a Kubernetes ConfigMap).

This effectively makes it impossible to disable Kiali's kube cache via the usual configuration mechanism. This will allow to write new code under the assumption that the kube cache is always enabled (i.e. no more if/else conditionals around this configuration variable).

The kube cache can still be disabled programmatically. This will allow to gradually update existing code to stop relying on the removed configuration (most notably, unit tests need to be adapted).

Related kiali#5599
Copy link
Contributor

@nrfox nrfox left a comment

Choose a reason for hiding this comment

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

LGTM

@israel-hdez israel-hdez merged commit 298daa9 into kiali:master Jan 31, 2023
@israel-hdez israel-hdez deleted the 5599-remove-option-to-disable-kube-cache branch January 31, 2023 17:18
@jshaughn
Copy link
Collaborator

Can you point to an example of how to disable it programmatically (for tests, I assume)?

@israel-hdez
Copy link
Member Author

Yes, basically you get the default configs, turn off the cache in the copy you get, and then set it to take effect. Here is a chunk of code from some of the tests:

kiali/handlers/apps_test.go

Lines 145 to 148 in 298daa9

func setupAppMetricsEndpoint(t *testing.T) (*httptest.Server, *prometheustest.PromAPIMock, *kubetest.K8SClientMock) {
conf := config.NewConfig()
conf.KubernetesConfig.CacheEnabled = false
config.Set(conf)

@matejnesuta matejnesuta added the test: n/a PR does not need test additions or updates label Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test: n/a PR does not need test additions or updates
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants