stackabletech / issues

This repository is only for issues that concern multiple repositories or don't fit into any specific repository
2 stars 0 forks source link

Tech-debt: The `Configuration` trait on the Role configs has no access to resolved properties #338

Open fhennig opened 1 year ago

fhennig commented 1 year ago

This ticket was triggered by a bug that surfaced in the Druid Operator.


The Configuration trait is implemented for Role config structs, to derive product configuration settings from the Role config, this has been in place already for a while.

It turns out, a lot of role config settings need to be set based on information that is only resolved later, as the reconcile function is resolving discovery ConfigMaps or AuthenticationClasses. This has led to role configuration being set in the controller with switch statements like in the Druid Operator.

This is not great, because it leads to inconsistencies across Operators, but worse it breaks the Override functionality for any setting that is set here. Overrides are applied by the framework, inside the transform_all_roles_to_config function. This function returns a value of this type

HashMap<String, HashMap<String, HashMap<PropertyNameKind, BTreeMap<String, Option<String>>>>>

After validating it, we get

HashMap<String, HashMap<String, HashMap<PropertyNameKind, BTreeMap<String, String>>>>

Any changes that need to made to the configuration now have to be made on this structure. This is very painful, and every Operator does it differently. it involves parsing role names back into enums, looking up stuff with enum switches etc. etc.

fhennig commented 1 year ago

Related: https://github.com/stackabletech/operator-rs/issues/362