keda icon indicating copy to clipboard operation
keda copied to clipboard

Provide unified KEDA core configuration

Open arschles opened this issue 5 years ago • 14 comments

A clear and concise description of what you want to happen.

Use-Case

When you run KEDA in a 12-factor environment, it's sometimes easier to configure it with environment variables (not commandline flags), in other cases, a pre-canned config file is more useful, and of course, we already have commandline flags, so those are certainly more useful to some people

I think we should support all 3 ways of configuring the KEDA controller (not necessarily the metrics API, but that could be considered)

Specification

  • [ ] Change the stdlib flags package usage to use viper, or a similar library that can draw configuration values from multiple sources

arschles avatar Nov 13 '20 21:11 arschles

viper is more relevant to the CLI based apps, right? And since the operator should be long running, the modification to the configuration should happen not just via arguments on the startup. I was thinking about this before and the proper configuration for the operator is a ConfigMap that's being watched by the operator, user can modify the settings in the ConfiMap and KEDA will react to it properly.

zroubalik avatar Nov 16 '20 16:11 zroubalik

Not necessarily @zroubalik. I've used it in several server/daemon projects (most recent one. It's really good for allowing users to pass in configs from a variety of different sources. I've used it as part of a configuration hierarchy:

  • flags on the command line
  • env vars / config files (viper would come in and standardize the file and env var naming scheme)
  • ConfigMap to mount env vars (which viper would standardize)

arschles avatar Dec 04 '20 19:12 arschles

I agree that we should expose some unified endpoit for configuration. Flags or env Vars are nice to have to, but the solution should definitely provide a ConfigMap, that's being watched by the KEDA Operator and values are changed dynamically as they are changed in the CM.

zroubalik avatar Jan 04 '21 15:01 zroubalik

Agreed regarding the ConfigMap. Would it be appropriate to create a config system that can provide configuration values at any point in time while also allowing a subscriber to get notified when something changed (regardless of the configuration's source)?

arschles avatar Apr 27 '21 20:04 arschles

Yeah functionality like this would be nice. There are existing patterns for ConfigMap watchers in k8s ecosystem. We should reuse this, to not reinvent the wheel :)

zroubalik avatar Apr 29 '21 09:04 zroubalik

Rather than watching a ConfigMap directly, I think it would be better to mount it as a volume and watch the file. While we could use resourceNames to make a limited RBAC policy, letting the Kubelet do the API heavy lifting usually simplifies things and allows for a more complex deployment if someone wants to go off the rails ("make the config file however you want as long as you mount it here").

coderanger avatar Apr 29 '21 18:04 coderanger

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 14 '21 06:10 stale[bot]

@zroubalik @coderanger do you think something like this is still worth pursuing?

arschles avatar Oct 18 '21 22:10 arschles

@arschles yeah, I think we should do this.

zroubalik avatar Oct 19 '21 07:10 zroubalik

ok. how about I pursue adding unified file-based and/or environment variable based configuration? that way, people can put their configs in a ConfigMap and mount it in as a file, as @coderanger suggested. if someone chooses file-based and we allow configuration to be changed at any time, should the controller automatically detect the change and reload configs?

arschles avatar Oct 20 '21 22:10 arschles

+1 for the ConfigMap approach and automatic change detection with reload. Thanks for taking this!

zroubalik avatar Oct 21 '21 08:10 zroubalik

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 20 '21 08:12 stale[bot]

I clearly haven't gotten to this yet. If someone else wants to take it, feel free. I probably won't be able to work on it for a while.

arschles avatar Jan 28 '22 18:01 arschles

No worries Aaron!

tomkerkhove avatar Jan 30 '22 11:01 tomkerkhove