From 3a2ac43f1debca19a64785776b65e309350fa79d Mon Sep 17 00:00:00 2001 From: Wolfgang Kulhanek Date: Tue, 12 Nov 2024 14:53:40 +0100 Subject: [PATCH] Add logic to annotate volumesnapshotclasses if so desired (#8792) Co-authored-by: Wolfgang Kulhanek --- .../defaults/main.yml | 6 ++++++ .../tasks/workload.yml | 19 +++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ansible/roles_ocp_workloads/ocp4_workload_kasten_k10/defaults/main.yml b/ansible/roles_ocp_workloads/ocp4_workload_kasten_k10/defaults/main.yml index 8e5d49bd8fd..3d6d19cc4cb 100644 --- a/ansible/roles_ocp_workloads/ocp4_workload_kasten_k10/defaults/main.yml +++ b/ansible/roles_ocp_workloads/ocp4_workload_kasten_k10/defaults/main.yml @@ -46,6 +46,12 @@ ocp4_workload_kasten_k10_authentication_type: openshift # - Set up authorization for normal users to use K10 ocp4_workload_kasten_k10_setup_demo: false +# Annotate volumesnapshotclasses as backup targets +# Set to empty array to not annotate any +ocp4_workload_kasten_k10_volumesnapshotclasses: +- ocs-external-storagecluster-rbdplugin-snapclass +- ocs-external-storagecluster-cephfsplugin-snapclass + # ObjectBucket properties ocp4_workload_kasten_k10_objectbucket_name: kastenbackups ocp4_workload_kasten_k10_objectbucket_storage_class: openshift-storage.noobaa.io diff --git a/ansible/roles_ocp_workloads/ocp4_workload_kasten_k10/tasks/workload.yml b/ansible/roles_ocp_workloads/ocp4_workload_kasten_k10/tasks/workload.yml index ea2f9d6792a..9ce50d7de04 100644 --- a/ansible/roles_ocp_workloads/ocp4_workload_kasten_k10/tasks/workload.yml +++ b/ansible/roles_ocp_workloads/ocp4_workload_kasten_k10/tasks/workload.yml @@ -56,10 +56,9 @@ # Jinja templates handle single/multi-user deployment - name: Set up Demo environment - when: ocp4_workload_kasten_k10_setup_demo + when: ocp4_workload_kasten_k10_setup_demo | bool kubernetes.core.k8s: state: present - # template: objectbucketclaim.yaml.j2 definition: "{{ lookup('template', resource | from_yaml) }}" loop: - namespace.yaml.j2 @@ -69,6 +68,22 @@ loop_control: loop_var: resource + - name: Annotate VolumeSnapshotClasses as backup targets + when: + - ocp4_workload_kasten_k10_setup_demo | bool + - ocp4_workload_kasten_k10_volumesnapshotclasses | default([]) | length > 0 + kubernetes.core.k8s: + state: patched + api_version: snapshot.storage.k8s.io/v1 + kind: VolumeSnapshotClass + name: "{{ volumesnapshotclass }}" + definition: + annotations: + k10.kasten.io/is-snapshot-class: "true" + loop: "{{ ocp4_workload_kasten_k10_volumesnapshotclasses }}" + loop_control: + loop_var: volumesnapshotclass + - name: Save AgnosticD user information for single user when: - ocp4_workload_kasten_k10_setup_demo | bool