fdb-kubernetes-operator icon indicating copy to clipboard operation
fdb-kubernetes-operator copied to clipboard

Remove usage of maps

Open johscheuer opened this issue 5 years ago • 3 comments

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.

johscheuer avatar Nov 17 '20 15:11 johscheuer

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.

brownleej avatar Mar 22 '21 02:03 brownleej

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.

johscheuer avatar Nov 16 '21 06:11 johscheuer

The change to the ProcessConfigs might be a good choice for the conversion: https://github.com/FoundationDB/fdb-kubernetes-operator/issues/1047

johscheuer avatar Jan 19 '22 07:01 johscheuer