# Upgrade the agent

> Move the LevelFour agent to a new chart version with Helm, Argo CD, Flux or Terraform, and the steps a breaking change needs first.

Source: https://docs.levelfour.ai/kubernetes/upgrade


Each chart version pins its own agent image, so an upgrade changes one value: the chart version you pin, with `image.tag` left unset. With Helm, `--reset-then-reuse-values` keeps your values, the token among them, and applies the new chart's defaults; it needs Helm 3.14 or later.

**Helm**

```bash
helm upgrade levelfour-agent oci://public.ecr.aws/levelfour/charts/levelfour-agent \
  --version 0.8.6 \
  --namespace levelfour --reset-then-reuse-values
```

**Argo CD**

Set `targetRevision` in the Application to the new version and commit it.

**Flux**

Set `ref.tag` in the OCIRepository to the new version and commit it.

**Terraform**

Set `version` in the `helm_release` to the new version and apply.

## Breaking changes

Breaking changes ship only in a minor version, such as 0.6.0, and each one has an entry below. Before you upgrade, read every entry between your version and the one you move to. A version with no entry upgrades with the command above alone. Every version runs on Kubernetes 1.23 or later.

### Upgrading to 0.6.0 or later

> **Warning: Affects automation turned on with chart 0.4.x**
>
> Chart 0.6.0 and later refuse the old automation keys, so the upgrade fails until you rename them in your values.

| Value in 0.4.x                      | Value from 0.6.0                        |
| ----------------------------------- | --------------------------------------- |
| `automation.namespaces`             | `automation.allowedNamespaces`          |
| `automation.limits.maxCPU: "8"`     | `automation.hardLimits.maximumCores: 8` |
| `automation.limits.maxMemory: 16Gi` | `automation.hardLimits.maximumGiB: 16`  |
| `automation.revert.allowEviction`   | `automation.revert.allowPodEviction`    |

With Helm, `--reset-then-reuse-values` brings the old keys back. Save your values to a file, rename the keys there, and upgrade from the file with no reuse flag:

```bash
helm get values levelfour-agent -n levelfour -o yaml > values.yaml
```

```bash
helm upgrade levelfour-agent \
  oci://public.ecr.aws/levelfour/charts/levelfour-agent \
  --version 0.8.6 --namespace levelfour -f values.yaml
```

The file holds the token, so delete it once the upgrade is done. With Argo CD, Flux or Terraform, rename the keys in the values you commit, in the same change as the new version.

## The latest version

| Version | What it adds                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | New permissions                                                                                                                                                                                          | What you do |
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| 0.8.6   | Who applies each NodePool, autoscaler, VPA and disruption budget, read from managedFields and the keys Helm, Argo CD and Flux add, so a change to a field declared in Git goes by pull request. Also the schedules of KEDA cron triggers, NodePool disruption budgets and CronJobs, EKS Auto Mode's resource optimization objects (in preview at AWS, on Kubernetes 1.36 or later), the admission webhooks, the custom resources the cluster serves, each pod's Ready condition and each disruption budget's unhealthy pod eviction policy, as [What it sends](/kubernetes/agent-permissions-and-data#what-it-sends) lists. 0.8.5 was not released; this version carries its changes | Read `clusterresourceoptimizationpolicies` and `resourceoptimizations` (`eks.amazonaws.com`), and `mutatingwebhookconfigurations` and `validatingwebhookconfigurations` (`admissionregistration.k8s.io`) | Nothing     |

[View the changelog](/kubernetes/changelog)
