Automatic labeling of pods by replicaset role (primary/secondary)
Hi, I think it would be great if the Operator could watch and automatically mark individual pods of statefulset with some label indicating whether the node is primary or secondary to be able to route service just to the primary instance (or load balance secondary instances for read-only access on one IP).
Currently I use a script that periodically checks roles and adds label "mongodb-replicaset-role": "primary" or "secondary" and a service that uses this as a selector.
EDIT: (I'm thinking about writing own operator for this instead of script; maybe it's the best way?)
Motivation: Linode (and possibly others') kubernetes nodebalancer costs $10/month each; if you want to make public access to the database and you have 3 nodes, it's better to just configure the service to use primary pod only and you don't need to expose all 3 nodes ($30)