Recommended ways of handling external state in a Kubernetes operator?

188 Views Asked by At

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:

  1. Storing it as an annotation on the resource
  2. Storing it as a status of the resource
  3. Creating a new resource to track it (ConfigMap, Secret, etc.)
  4. Patching the CRD resource (like some EBS controllers patch PVs)
  5. 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.

0

There are 0 best solutions below