postgres-operator
postgres-operator copied to clipboard
Feature: Inherit annotation from label (or the other way around)
Please, answer some short questions which should help us to understand your problem / question better?
- Which image of the operator are you using? no idea
- Where do you run it - cloud or metal? Kubernetes or OpenShift? AWS K8s
- Are you running Postgres Operator in production? yes
- Type of issue? feature request
Status quo
The Postgres Operator configuration already has options inherited_annotations and inherited_labels, which both work in a similar way: An annotation or label on the Postgresql resource gets copied to a same-named annotation/label on the child resources which it creates (e.g. statefulsets and pods).
At Zalando, we are using inherited labels component,environment,team-id, and inherited annotation zalando.org/owning-application (instead of inheriting the application label, that instead is set to a fixed value).
So users are currently asked to set both the application label and the zalando.org/owning-application annotation on their Postgresql resource to the same value, where one of them should be enough.
Feature request
There should be a way of defining an inheritance of an annotation from a label (and the other way around, for completeness).
Potential configuration syntax:
kubernetes:
inherited_annotations:
- "zalando.org/owning-application"
inherited_labels:
- component
- environment
inherited_annotations_from_labels:
- annotation: "zalando.org/owning-application"
from_label: "application"
conflict_priority: -1
inherited_labels_from_annotations:
- label: "example"
from_annotation: "example.org/example-label"
conflict_priority: 3
The conflict priority would be used in case there are multiple sources for one label/annotation (with the ones coming from inherited_annotations/labels having priority 0). Of course we could also just say that it's an error if there are conflicting sources for the same annotation/label, might be simpler.