I am currently creating a Kubernetes operator (using kubebuilder). My operator reaches out to an external API to manage resources. Upon creation, I get back an ID from the external service that would be useful to retain in Kubernetes.
I need a way to store that external ID to Kubernetes resource mapping. The ways I can think of are:
- Storing it as an annotation on the resource
- Storing it as a status of the resource
- Creating a new resource to track it (ConfigMap, Secret, etc.)
- Patching the CRD resource (like some EBS controllers patch PVs)
- Maybe use etcd? Not sure if it's possible from the controller's context
I can think of some pros/cons to each method, but I'm not sure if there's some recommended best practices for this type of thing.