Comment 6 for bug 2021891

Revision history for this message
Ian Booth (wallyworld) wrote :

Starting and stopping the cluster does not cause pod churn though - the exact same pods/containers are running after the cluster restarts. This is different to actually asking k8s to delete a pod - a new pod with a different internal id is created to replace the deleted pod. This new pod has containers with fresh container filesystems which means that transient state info used by the unit agent is deleted. This state info includes the "charm modified version" which is used to track whether the charm upgrade hook needs to be run. So a brand new pod will run the upgrade-charm hook, allowing the charm to recreate any container local state it needs to run.

If you want to detect that a pod has been restarted (for whatever reason), can't you use the "start" hook which is run every time?