> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-delivery/use-continuous-delivery/deploy-services-on-different-platforms/kubernetes/cd-k8s-ref/kubernetes-releases-and-versioning.md). Agents can also search and read this documentation through its [MCP server](https://developer.harness.io/~gitbook/mcp).

# Kubernetes releases and versioning for deployments (configmaps secrets)

How Harness tracks Kubernetes releases and versions.

This topic describes how Harness tracks releases and versions for Kubernetes deployments.

Every Harness deployment creates a new release with an incrementally increasing number. Release history is stored in the Kubernetes cluster in a ConfigMap or Secret. ConfigMap or Secret are essential for release tracking, versioning, and rollback.

By default, all ConfigMaps and Secrets are versioned by Harness. The corresponding references for these ConfigMaps and Secrets in other manifest objects are also updated (for example, managed workloads like Deployment, and so on). Versioning does not change how you use ConfigMaps or Secrets. You need not reference the release numbers when using ConfigMaps or Secrets.

You can see the use of release numbers and versioning in the logs of the **deployment** in the **prepare** section of the logs, (`Current release number is 7`, `Previous Successful Release is 6`):

```
Manifests processed. Found following resources: 

Kind                Name                                    Versioned 
Secret              harness-v1                              true      
Secret              harness-v1-dckrcfg                      false     
ConfigMap           harness-v1                              true      
Service             harness-v1-svc                          false     
Deployment          harness-v1-deployment                   false     
Ingress             harness-v1-ingress                      false     
IngressRoute        harness-v1-ingress-rt                   false     

Current release number is: 7

Previous Successful Release is 6
```

In some cases, you might want to skip versioning. For example, skip versioning for:

* ImagePullSecret because it never changes.
* TLS certs if they are referred in a Kubernetes container command or arguments.

For cases where versioning is not required, it can be skipped by using these two ways:

* Annotate the manifest provided in the Harness service's **Manifests** section with `harness.io/skip-versioning: "true"`.
* In the Harness service's **Manifest Configuration** page, select **Manifests** > **Advanced**, and then select the **Skip Versioning** checkbox.

{% hint style="info" %}
**INFO**

By default, Harness does not version ConfigMaps and Secrets when declarative rollback is enabled for a manifest.

If the feature flag `CDS_K8S_DEFAULT_DECLARATIVE_ROLLBACK` is enabled for your account, you can turn versioning back on for a declarative manifest using the **Enable Resource Versioning** checkbox. Go to [Resource versioning with declarative rollback by default](#resource-versioning-with-declarative-rollback-by-default) for more information.
{% endhint %}

### Resource versioning with declarative rollback by default <a href="#resource-versioning-with-declarative-rollback-by-default" id="resource-versioning-with-declarative-rollback-by-default"></a>

When the feature flag `CDS_K8S_DEFAULT_DECLARATIVE_ROLLBACK` is enabled and a manifest has **Enable Resource Versioning** selected, Harness versions ConfigMaps and Secrets the same way it does for imperative rollback: it appends the release number to the resource name (`name-N`), and updates references to that ConfigMap or Secret in workload objects (for example, Deployment, StatefulSet, DaemonSet).

Keep the following in mind:

* This behavior applies to **Rolling deployments only**. Canary, Progressive Canary, and Blue/Green deployments are unaffected, whether or not **Enable Resource Versioning** is selected.
* After a successful deployment, Harness deletes the previous version of a versioned ConfigMap or Secret, whether or not pruning is enabled for the step.
* Annotate a ConfigMap or Secret with `harness.io/skip-versioning: "true"` to keep its name unchanged, the same as with imperative rollback.
* Harness only updates references to versioned ConfigMaps and Secrets from workload objects. References from non-workload objects, such as an Ingress TLS section, are not rewritten and can break if you rely on resource versioning for those references.
* Resource versioning with declarative rollback requires delegate version 904xx or later. If the delegate running the deployment is older, Harness deploys using declarative rollback without applying versioning.

### Release Name <a href="#release-name" id="release-name"></a>

Harness also uses a release name for tracking releases. These release names should be unique for your deployments and pipelines.

{% hint style="info" %}
Do not change the **release name value** between deployments unless absolutely necessary. The release name is used by Harness for tracking releases of app versions and rollback. If you change the release name value between deployments, this will reset the versioning number and will stop rollbacks up to that point (breaking the versioning chain)
{% endhint %}

{% hint style="warning" %}
Not having a unique release name could affect licensing. Ensure your release names are unique.
{% endhint %}

You can supply a release name in a stage's infrastructure **Release Name** setting.

![](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-4bd13c72ed247f5283bb1413e0b7d39c6eddeb6a%2Fk8s-infraReleaseName.png?alt=media)

During deployment Harness creates a ConfigMap listing the resources of the release and uses the Release name for tracking them. You can see this within your Kubernetes cluster, in the namespace if you run `kubectl get configmap`

```
> $ kubectl get configmap
NAME                    DATA   AGE
kube-root-ca.crt        1      176d
release-78a47e          2      176d
release-05ea23          7      176d
```

Harness suggests utilizing a Release Name which is formed from a combination of `release-` and a unique string created using the Harness expression `<+INFRA_KEY>`.

The release name must be unique across the cluster. `release-<+INFRA_KEY>` ensures a unique name.

If the name is not defined properly, and is not unique across the cluster, there is a danger of collision in the versioning between the two different deployments.

For example, Pipeline A can increment the versioning of Pipeline B's configmap/secrets and add its own versions to the same series if the release name is not unique. This will cause a break in the versions and will cause issues in rollbacks.

{% hint style="info" %}
**INFO**

When declarative rollback is enabled, the corresponding Secret name format is `harness.release.<release-name>.<release-number>`.
{% endhint %}

Release name is used to create the corresponding Harness release ConfigMap or Secret. Therefore, the provided release name should be a valid [DNS subdomain name](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names).

{% @harness-feedback/feedback %}
