fdb-kubernetes-operator
fdb-kubernetes-operator copied to clipboard
Remove usage of maps
Like stated in this comment: https://github.com/FoundationDB/fdb-kubernetes-operator/pull/380#discussion_r525134130 we should remove maps where possible n the API.
I went through the CRD YAML files looking for occurrences of "additionalProperties", which seems to signal the use of a map type in the CRD. Most of the cases I found were either deprecated or coming from core Kubernetes types like the pod spec. Here are the cases I found that are active and coming from our types:
- cluster.spec.processes
- cluster.spec.sidecarVersions
Both of these could potentially be converted to lists of named sub-objects.
The sidecarVersions is already deprecated and only cluster.spec.processes is left. I think the best way to represent this and being conformant with the Kubernetes API guidelines is something like this:
type FoundationDBClusterSpec struct {
...
ProcessesConfigs []ProcessesConfig
...
}
type ProcessesConfig struct {
Class ProcessClass
settings ProcessSettings
}
I can try to squeeze that into my list of work items this week.
The change to the ProcessConfigs might be a good choice for the conversion: https://github.com/FoundationDB/fdb-kubernetes-operator/issues/1047