lokanadham100
lokanadham100

Reputation: 1283

How helm rollback works in kubernetes?

While going through the helm documentation, i came across rollback feature. Its a cool feature, but i have some doubts about the implementation of that feature.

How they have implemented it? If they might have used some datastore to preserve old release config, what datastore it is?

Is there any upper limit on consecutive rollbacks? If so, Upto how many rollbacks will it support? Can we change this limit?

Upvotes: 6

Views: 4754

Answers (2)

Anshul Singhal
Anshul Singhal

Reputation: 2201

Helm 3 changed the default release information storage to Secrets in the namespace of the release. Following helm documentation should provide some of the details in this regard:

https://helm.sh/docs/topics/advanced/#storage-backends

For example (only for illustration purpose here) -

$ helm install test-release-1 .
NAME: test-release-1
LAST DEPLOYED: Sun Feb 20 13:27:53 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None

We can now see history and secret information for above release as follows:

$ helm history test-release-1
REVISION        UPDATED                         STATUS          CHART                                   APP VERSION     DESCRIPTION
1               Sun Feb 20 13:27:53 2022        deployed        fleetman-helm-chart-test-1-0.1.0        1.16.0          Install complete
$ kubectl get secrets
NAME                                   TYPE                                  DATA   AGE
sh.helm.release.v1.test-release-1.v1   helm.sh/release.v1                    1      41s
$ kubectl describe secrets sh.helm.release.v1.test-release-1.v1
Name:         sh.helm.release.v1.test-release-1.v1
Namespace:    default
Labels:       modifiedAt=1645363673
              name=test-release-1
              owner=helm
              status=deployed
              version=1
Annotations:  <none>

Type:  helm.sh/release.v1

Data
====
release:  1924 bytes

Now, it is upgraded to a new version as follows:

$ helm upgrade test-release-1 .
Release "test-release-1" has been upgraded. Happy Helming!
NAME: test-release-1
LAST DEPLOYED: Sun Feb 20 13:30:26 2022
NAMESPACE: default
STATUS: deployed
REVISION: 2
TEST SUITE: None

Following is the updated information in Kubernetes Secrets:

$ kubectl get secrets
NAME                                   TYPE                                  DATA   AGE
sh.helm.release.v1.test-release-1.v1   helm.sh/release.v1                    1      2m53s
sh.helm.release.v1.test-release-1.v2   helm.sh/release.v1                    1      20s

Upvotes: 1

Amrit
Amrit

Reputation: 2072

As the documentation says, it rolls back the entire release. Helm generally stores release metadata in its own configmaps. Every-time you release changes, it appends that to the existing data. Your changes can have new deployment image, new configmaps, storages, etc. On rollback, everything goes to the previous version.

Upvotes: 2

Related Questions