From 44ed48cb9ab71422bb1ecb67fcadfb5a5683160b Mon Sep 17 00:00:00 2001 From: sd109 Date: Wed, 29 Nov 2023 09:37:06 +0000 Subject: [PATCH] Switch to piraeus.io helm chart for CSI snapshot controller --- roles/velero/defaults/main.yml | 22 ++++++++++++++-------- roles/velero/tasks/install.yml | 27 +++++++++++---------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/roles/velero/defaults/main.yml b/roles/velero/defaults/main.yml index d5dcaacd..cc582a7c 100644 --- a/roles/velero/defaults/main.yml +++ b/roles/velero/defaults/main.yml @@ -29,14 +29,20 @@ velero_s3_creds_secret_name: velero-s3-config velero_aws_access_key_id: "{{ undef(hint='velero_aws_access_key_id and velero_aws_secret_access_key must be set to provide credentials for the target object store') }}" velero_aws_secret_access_key: "{{ undef(hint='velero_aws_access_key_id and velero_aws_secret_access_key must be set to provide credentials for the target object store') }}" - -# Kubernetes CSI Snapshot controller config - -# The source repo for the k8s snapshot controller -velero_k8s_snapshot_controller_repo: https://github.com/kubernetes-csi/external-snapshotter/ - -# The version of the snapshot controller to install -velero_k8s_snapshot_controller_git_version: release-6.2 +# Kubernetes CSI Snapshot Controller config +velero_csi_snapshot_controller_chart_name: snapshot-controller +velero_csi_snapshot_controller_chart_repo: https://piraeus.io/helm-charts/ +velero_csi_snapshot_controller_chart_version: 2.0.3 +velero_csi_snapshot_controller_release_namespace: kube-system +velero_csi_snapshot_controller_release_name: csi-snapshot-controller +velero_csi_snapshot_controller_wait_timeout: 10m +velero_csi_snapshot_controller_release_defaults: {} +velero_csi_snapshot_controller_release_overrides: {} +velero_csi_snapshot_controller_release_values: >- + {{- + velero_csi_snapshot_controller_release_defaults | + combine(velero_csi_snapshot_controller_release_overrides, recursive = True) + }} # The name to give to the installed volume snapshot class velero_k8s_cinder_snapshot_class_name: cinder-csi-snapshot diff --git a/roles/velero/tasks/install.yml b/roles/velero/tasks/install.yml index 36d774d4..07c96d6d 100644 --- a/roles/velero/tasks/install.yml +++ b/roles/velero/tasks/install.yml @@ -1,20 +1,15 @@ -- name: Check if CSI snapshot controller checkout exists - stat: - path: ~/external-snapshotter - register: external_snapshotter_checkout - -- name: Clone CSI snapshot controller repo - ansible.builtin.command: git clone "{{ velero_k8s_snapshot_controller_repo }}" external-snapshotter - when: not external_snapshotter_checkout.stat.exists - -- name: Ensure CSI snapshot controller is deployed - # Adapted from https://kubernetes-csi.github.io/docs/snapshot-controller.html - ansible.builtin.shell: | - cd ./external-snapshotter - git checkout "{{ velero_k8s_snapshot_controller_git_version }}" - kubectl kustomize client/config/crd | kubectl apply -f - - kubectl -n kube-system kustomize deploy/kubernetes/snapshot-controller | kubectl apply -f - +- name: Ensure CSI-snapshot-controller Helm chart is installed + kubernetes.core.helm: + chart_ref: "{{ velero_csi_snapshot_controller_chart_name }}" + chart_repo_url: "{{ velero_csi_snapshot_controller_chart_repo }}" + chart_version: "{{ velero_csi_snapshot_controller_chart_version }}" + release_namespace: "{{ velero_csi_snapshot_controller_release_namespace }}" + release_name: "{{ velero_csi_snapshot_controller_release_name }}" + release_values: "{{ velero_csi_snapshot_controller_release_values }}" + atomic: yes + wait: yes + wait_timeout: "{{ velero_csi_snapshot_controller_wait_timeout }}" - name: Template Cinder VolumeSnapshotClass definition onto host ansible.builtin.template: