ianlewis / memcached-operator

A Kubernetes operator for memcached
Apache License 2.0
152 stars 18 forks source link

Immutable configmaps #13

Closed ianlewis closed 6 years ago

ianlewis commented 6 years ago

I should use immutable ConfigMaps. Each change to mcrouter's configuration should generate a new ConfigMap and trigger a rolling-update on the mcrouter Deployment. ConfigMaps should be garbage collected so they don't accumulate.

  1. ConfigMap is created with owner reference pointing to the owning MemcachedProxy. That way if the MemcachedProxy is deleted before any action is taken by the controller, the built-in garbage collector will garbage collect the ConfigMap
  2. The new ConfigMap name is set to the Deployment triggering a rolling-update
  3. Once a new ReplicaSet is created for the Deployment the owner reference for the ConfigMap is changed from the MemcachedProxy to the ReplicaSet. That way the ConfigMap is garbage collected by the built-in garbage collector when the ConfigMap is not needed by any ReplicaSet. How long data stays around can be adjusted using the Deployment's clean up policy