From db2ca014cb930dc09c4a985de10acb3153a553ff Mon Sep 17 00:00:00 2001 From: Bort Verwilst Date: Thu, 12 Dec 2019 18:24:32 +0100 Subject: [PATCH] Add Helm 3.x support (#5441) * Add Helm 3.x support * tiller enabled when helm < 3.0.0 --- docs/vars.md | 4 ++++ roles/download/defaults/main.yml | 4 ++-- roles/kubernetes-apps/helm/tasks/main.yml | 10 +++++++++- tests/files/packet_debian10-containerd.yml | 3 +++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/docs/vars.md b/docs/vars.md index 57decb2ea..383a5c70c 100644 --- a/docs/vars.md +++ b/docs/vars.md @@ -177,6 +177,10 @@ in the form of dicts of key-value pairs of configuration parameters that will be * *kube_kubeadm_controller_extra_args* * *kube_kubeadm_scheduler_extra_args* +## App variables + +* *helm_version* - Defaults to v2.x, set to a v3 version (e.g. `v3.0.1` ) to install Helm 3.x (no more Tiller!). When changing this to 3 in an existing cluster, Tiller will be left alone and has to be removed manually. + ## User accounts By default, a user with admin rights is created, named `kube`. diff --git a/roles/download/defaults/main.yml b/roles/download/defaults/main.yml index 685f855a6..a442352c9 100644 --- a/roles/download/defaults/main.yml +++ b/roles/download/defaults/main.yml @@ -364,7 +364,7 @@ test_image_repo: "{{ docker_image_repo }}/library/busybox" test_image_tag: latest busybox_image_repo: "{{ docker_image_repo }}/library/busybox" busybox_image_tag: 1.29.2 -helm_version: "v2.16.0" +helm_version: "v2.16.1" helm_image_repo: "{{ docker_image_repo }}/lachlanevenson/k8s-helm" helm_image_tag: "{{ helm_version }}" tiller_image_repo: "{{ gcr_image_repo }}/kubernetes-helm/tiller" @@ -793,7 +793,7 @@ downloads: - kube-node tiller: - enabled: "{{ helm_enabled }}" + enabled: "{{ helm_enabled and helm_version is version('v3.0.0', '<') }}" container: true repo: "{{ tiller_image_repo }}" tag: "{{ tiller_image_tag }}" diff --git a/roles/kubernetes-apps/helm/tasks/main.yml b/roles/kubernetes-apps/helm/tasks/main.yml index da547bacd..db74c0b10 100644 --- a/roles/kubernetes-apps/helm/tasks/main.yml +++ b/roles/kubernetes-apps/helm/tasks/main.yml @@ -17,6 +17,7 @@ when: - dns_mode != 'none' - inventory_hostname == groups['kube-master'][0] + - helm_version is version('v3.0.0', '<') - name: Helm | Apply Helm Manifests (RBAC) kube: @@ -30,11 +31,14 @@ when: - dns_mode != 'none' - inventory_hostname == groups['kube-master'][0] + - helm_version is version('v3.0.0', '<') # Generate necessary certs for securing Helm and Tiller connection with TLS - name: Helm | Set up TLS include_tasks: "gen_helm_tiller_certs.yml" - when: tiller_enable_tls + when: + - tiller_enable_tls + - helm_version is version('v3.0.0', '<') - name: Helm | Install client on all masters command: > @@ -44,6 +48,8 @@ --client-only environment: "{{ proxy_env }}" changed_when: false + when: + - helm_version is version('v3.0.0', '<') # FIXME: https://github.com/helm/helm/issues/6374 - name: Helm | Install/upgrade helm @@ -67,6 +73,7 @@ register: install_helm when: - inventory_hostname == groups['kube-master'][0] + - helm_version is version('v3.0.0', '<') changed_when: false environment: "{{ proxy_env }}" @@ -91,6 +98,7 @@ changed_when: false when: - inventory_hostname == groups['kube-master'][0] + - helm_version is version('v3.0.0', '<') environment: "{{ proxy_env }}" - name: Make sure bash_completion.d folder exists diff --git a/tests/files/packet_debian10-containerd.yml b/tests/files/packet_debian10-containerd.yml index c39e1d908..0deb23963 100644 --- a/tests/files/packet_debian10-containerd.yml +++ b/tests/files/packet_debian10-containerd.yml @@ -8,3 +8,6 @@ container_manager: containerd etcd_deployment_type: host deploy_netchecker: true dns_min_replicas: 1 + +helm_enabled: true +helm_version: v3.0.1 \ No newline at end of file