# Upgrade

If you installed with a values file, you can upgrade with one command. If you
used `--set` flags, first create a values file with the same settings. Helm
renders every resource again during an upgrade, and omitted settings revert to
their defaults.

## Upgrade the chart

```bash
printf '%s' "$ZUPLO_REGISTRY_KEY" |
  helm registry login us-docker.pkg.dev -u _json_key_base64 --password-stdin

helm upgrade zuplo \
  oci://us-docker.pkg.dev/zuplo-customers/self-hosted/helm-charts/zuplo \
  --version "$NEW_CHART_VERSION" \
  --namespace zuplo \
  -f zuplo-values.yaml \
  -f zuplo-secrets.yaml
```

Pass both files, unchanged, with every upgrade. The chart creates its Kubernetes
Secrets from values, so omitting the credentials file on an upgrade empties the
registry Secrets and every subsequent image pull fails.

Check what changed before applying it:

```bash
helm diff upgrade zuplo \
  oci://us-docker.pkg.dev/zuplo-customers/self-hosted/helm-charts/zuplo \
  --version "$NEW_CHART_VERSION" \
  --namespace zuplo \
  -f zuplo-values.yaml -f zuplo-secrets.yaml
```

`helm diff` is the [helm-diff plugin](https://github.com/databus23/helm-diff),
installed with `helm plugin install https://github.com/databus23/helm-diff`.

## Verify the upgrade

Work through [Verify your install](./verify.md) again. The gateway deployments
already in the cluster keep serving through the upgrade; they are rebuilt only
when you deploy them.

```bash
kubectl wait --for=condition=Available deployment --all \
  -n zuplo-system --timeout=5m
helm history zuplo -n zuplo
```

## Roll back an upgrade

```bash
helm rollback zuplo <revision> -n zuplo
```

Rollback restores the workloads and configuration from the selected revision.
