Managing Helm releases
Manage Helm deployments from the Codefresh UI
Codefresh has built-in integration for Helm that provides a unique view into your production Kubernetes cluster.
In Helm Releases, you can see the current status of your cluster, including the currently deployed releases, their previous revisions including change tracking, and even roll back to a previous release.
Codefresh also offers an environment view for Helm releases as well as a promotion dashboard.
View Helm releases and release information
View all the Helm releases in your cluster, and drill down into a specific release to see its services, deployed versions, manifests and more.
NOTE
Make sure you have connected your Kubernetes cluster to Codefresh.
- In the Codefresh UI, from DevOps Insights in the sidebar, select Helm Releases.
- To see details for a specific release, click the release name.
The History tab shows all previous releases.
You can further expand a release revision to see exactly what files were changed in this release.
There are other tabs that show you the chart used, the values as well as the final manifests that were actually deployed.
Add labels to Kubernetes services
For better visibility into services, add the recommended labels to your Kubernetes service.
To use the instance label for something different, you can also use a release label instead:
Add an upgrade message
Codefresh allows you to display a meaningful description for each release in the release history. This message can help show the main reason behind each release, or any other message that is convenient for you.
You can set this message for your Helm release in three ways:
- When you manually install a Helm release from the Helm charts screen, there is a field for this message.
- Set the property
commit_message
inside the notes.txt file of your chart. - By providing an environment variable called
COMMIT_MESSAGE
within your Helm pipeline step.
Roll back a Helm release
You can rollback to a previous revision of a release in the History tab.
- Click the Helm release for which to perform a rollback, and then click the History tab.
- To rollback to a specific release, click Rollback in the row.
NOTE
It takes time to complete rollback for a release, and the change in the cluster is not instantly updated in the Codefresh UI. If you also use a custom rollback pipeline, the delay between the cluster update and the UI refresh is even longer.
Helm UI actions
From the main release screen, you have some additional actions.
Select the row with the desired chart, and:
- Issue a Helm test by clicking on the ‘Run Test’ button.
- Delete a release by clicking on the ‘Delete’ button.
For deletion options, see the Helm delete documentation. For example, purge removes the revision from the release history.
Helm deployment badge
Similar to a build badge, you can also get a deployment badge for a Helm release.
- In the Codefresh UI, from the DevOps Insights section in the sidebar, select Helm Releases.
- In the row with the Helm release for which to add a deployment badge, click the Settings (gear) icon.
- To get deployment information, click Badge.
Codefresh provides the Markdown/HTML/Link segment that you can embed in README or other documents to show deployment information.
Overriding default Helm actions for releases
By default, when you take an action in the UI, Codefresh executes the native Helm command corresponding to that action:
helm test
for testing a charthelm rollback
for rollbackshelm delete
orhelm uninstall --keep-history
for deletehelm delete --purge
orhelm uninstall
for purging a release
You can override these actions for a specific Helm release by defining custom pipelines for each action. This way you can add your extra logic on top of these actions. For example your own Helm uninstall pipeline might also have a notification step that posts a message to a Slack channel after a release is removed.
NOTE
Only Codefresh admin users can override the default pipelines defined for a Helm release.
- In the Codefresh UI, from the DevOps Insights section in the sidebar, select Helm Releases.
- In the row with the Helm release for which to override default actions, click the Settings (gear) icon.
- Select the pipeline to use for the respective actions.
Environment variables for custom Helm commands
If you do override any of these actions, the following environment variables are available in the respective pipeline, so that you can use your own custom Helm command.
Helm Test pipeline
CF_HELM_RELEASE
: Name of releaseCF_HELM_KUBE_CONTEXT
:kubectl
context name of target cluster (cluster name from dashboard)CF_HELM_NAMESPACE
: Namespace where release is storedCF_HELM_TIMEOUT
: Time in seconds to wait for any individual Kubernetes operationCF_HELM_CLEANUP
: Delete test pods upon completion
Helm Rollback pipeline
CF_HELM_VERSION
: Helm version, ex.: 3.0.1, 2.7.0CF_HELM_RELEASE
: Name of release on clusterCF_HELM_REVISION
: Revision to use for rollbackCF_HELM_KUBE_CONTEXT
:kubectl
context name of target cluster (cluster name from dashboard)CF_HELM_NAMESPACE
: Namespace where release is stored
Helm Delete pipeline
CF_HELM_PURGE
: Boolean, delete release from storeCF_HELM_RELEASE
: Name of releaseCF_HELM_TIMEOUT
: Time in seconds to wait for any individual Kubernetes operationCF_HELM_HOOKS
: Prevent hooks from running during installCF_HELM_KUBE_CONTEXT
:kubectl
context name of target cluster (cluster name from dashboard)CF_HELM_VERSION
: Helm version, ex.: 3.0.1, 2.7.0CF_HELM_NAMESPACE
: Namespace where release is stored
Related articles
Using Helm in a Codefresh pipeline
Helm charts and repositories
Using a managed Helm repository
Promoting Helm Environments