Writing hooks in the Guestbook Helm chart
As you may recall, the Guestbook Helm chart uses a Redis database to persist messages created by the user. Using Helm hooks, we can create a process that performs simple backup and restore processes of the Redis database at various points of the chart’s life cycle. Let’s take a look at the two hooks that we will create in this section:
- The first hook will occur in the
pre-upgrade
lifecycle phase. This phase takes place immediately after thehelm-upgrade
command is run, but before any Kubernetes resources have been modified. This hook will be used to take a data snapshot of the Redis database before the upgrade is performed, ensuring that the database is backed up in case any errors occur during the upgrade. - The second hook will occur in the pre-rollback lifecycle phase. This phase takes place immediately after the
helm-rollback
command is run, but before any Kubernetes resources are reverted. This hook will restore...