-
Create local cluster
kind create cluster
-
Barebones flux2 install for demo
flux install --components source-controller,helm-controller --export | kubectl apply -f -
-
Install Operator
kubectl apply -f https://raw.githubusercontent.com/fluxcd/helm-operator/1.2.0/deploy/crds.yaml kubectl create namespace flux kubectl apply -f https://raw.githubusercontent.com/fluxcd/helm-operator/1.2.0/deploy/rbac.yaml kubectl apply -f https://raw.githubusercontent.com/fluxcd/helm-operator/1.2.0/deploy/deployment.yaml kubectl patch -f https://raw.githubusercontent.com/fluxcd/helm-operator/1.2.0/deploy/deployment.yaml \ --type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value":"--enabled-helm-versions=v3"}]'
-
Install v1 Operator CR
$ echo 'apiVersion: helm.fluxcd.io/v1 kind: HelmRelease metadata: name: podinfo namespace: default spec: chart: repository: https://stefanprodan.github.io/podinfo name: podinfo version: 5.0.3 rollback: enable: true retries: true maxRetries: 5 values: replicaCount: 1' | k apply -f -
-
See the v1 Operator CR
$ k get helmreleases.helm.fluxcd.io NAME RELEASE PHASE STATUS MESSAGE AGE podinfo default-podinfo Succeeded deployed Release was successful for Helm release 'default-podinfo' in 'default'. 2m1s
-
See the release
$ helm ls NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION default-podinfo default 1 2020-11-13 13:35:27.5339046 +0000 UTC deployed podinfo-5.0.3 5.0.3
-
Scale down helm operator, so it stops syncing from v1 CRD
k -n flux scale deployment/helm-operator --replicas=0
-
Apply v2 helm repository
echo 'apiVersion: source.toolkit.fluxcd.io/v1beta1 kind: HelmRepository metadata: name: podinfo namespace: default spec: interval: 10m url: https://stefanprodan.github.io/podinfo' | k apply -f -
-
Describe helm repository to show it fetched the index:
k describe helmrepositories.source.toolkit.fluxcd.io
-
Apply v2 Controller CR
Note we set "releaseName: default-podinfo" to match operator namespace prefixing.
echo 'apiVersion: helm.toolkit.fluxcd.io/v2beta1 kind: HelmRelease metadata: name: podinfo namespace: default spec: interval: 5m releaseName: default-podinfo chart: spec: chart: podinfo version: 5.0.3 sourceRef: kind: HelmRepository name: podinfo install: remediation: retries: 3 upgrade: remediation: retries: 5 values: replicaCount: 1' | k apply -f -
* In future we will have conversion hooks for new CRD versions
-
See the v2 Controller CR
$ k get helmreleases.helm.toolkit.fluxcd.io NAME READY STATUS AGE podinfo True release reconciliation succeeded 6s
-
See there are now 2 helm release revisions
$ helm ls NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION default-podinfo default 2 2020-11-13 13:41:37.7153917 +0000 UTC deployed podinfo-5.0.3 5.0.3
-
Show reconciling
$ helm uninstall default-podinfo release "default-podinfo" uninstalled $ helm ls NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION $ flux reconcile helmrelease podinfo -n default ► annotating HelmRelease podinfo in default namespace ✔ HelmRelease annotated ◎ waiting for HelmRelease reconciliation ✔ HelmRelease reconciliation completed ✔ reconciled revision 5.0.3 $ helm ls NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION default-podinfo default 1 2020-11-13 13:44:29.4932623 +0000 UTC deployed podinfo-5.0.3 5.0.3
Reconciled!
-
Cleanup v1 Operator release CR
Finally delete the old operator CRD
k delete helmreleases.helm.fluxcd.io podinfo
* Repeat for each v1 release, one by one.
-
Uninstall v1 Operator, CRDs, and v1 namespace
Once all v1 releases have been migrated to v2, you may uninstall the v1 Operator. Note deleting the v1 CRDs removes any v1 CRs, so this should not be done until all releases have been migrated to v2.
kubectl delete -f https://raw.githubusercontent.com/fluxcd/helm-operator/1.2.0/deploy/deployment.yaml kubectl delete -f https://raw.githubusercontent.com/fluxcd/helm-operator/1.2.0/deploy/rbac.yaml kubectl delete -f https://raw.githubusercontent.com/fluxcd/helm-operator/1.2.0/deploy/crds.yaml kubectl delete namespace flux
-
Cleanup demo cluster
kind delete cluster
Last active
January 14, 2021 06:01
-
-
Save scottrigby/c2f34d2557113a1681acfc1fac969305 to your computer and use it in GitHub Desktop.
Demo: Flux Helm Operator -> Controller Migration
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment