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 3d6d19cc4cb..d8cb5ae2b05 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,7 +46,14 @@ ocp4_workload_kasten_k10_authentication_type: openshift # - Set up authorization for normal users to use K10 ocp4_workload_kasten_k10_setup_demo: false +# Annotate storage classes to support block mode +# k10.kasten.io/sc-supports-block-mode-exports=true +# Set to empty array to not annotate any +ocp4_workload_kasten_k10_storageclasses: +- ocs-external-storagecluster-ceph-rbd + # Annotate volumesnapshotclasses as backup targets +# k10.kasten.io/is-snapshot-class=true # Set to empty array to not annotate any ocp4_workload_kasten_k10_volumesnapshotclasses: - ocs-external-storagecluster-rbdplugin-snapclass 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 d39463810eb..6b0877de611 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 @@ -57,57 +57,67 @@ # Jinja templates handle single/multi-user deployment - name: Set up Demo environment when: ocp4_workload_kasten_k10_setup_demo | bool - kubernetes.core.k8s: - state: present - definition: "{{ lookup('template', resource | from_yaml) }}" - loop: - - namespace.yaml.j2 - - objectbucketclaim.yaml.j2 - - clusterrolebinding.yaml.j2 - - rolebinding.yaml.j2 - - rolebinding-namespace.yaml.j2 - loop_control: - loop_var: resource + block: + - name: Set up ObjectBucketClaims and permissions + kubernetes.core.k8s: + state: present + definition: "{{ lookup('template', resource | from_yaml) }}" + loop: + - namespace.yaml.j2 + - objectbucketclaim.yaml.j2 + - clusterrolebinding.yaml.j2 + - rolebinding.yaml.j2 + - rolebinding-namespace.yaml.j2 + 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: Annotate VolumeSnapshotClasses as backup targets + when: 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 - - not ocp4_workload_kasten_k10_multi_user | bool - agnosticd_user_info: - data: - kasten_backup_bucket_name: "{{ ocp4_workload_kasten_k10_objectbucket_name }}" - kasten_backup_bucket_namespace: "{{ ocp4_workload_kasten_k10_objectbucket_namespace }}" - kasten_backup_bucket_host: s3.openshift-storage.svc - kasten_backup_bucket_port: 443 + - name: Annotate StorageClasses as block storage + when: ocp4_workload_kasten_k10_storageclasses | default([]) | length > 0 + kubernetes.core.k8s: + state: patched + api_version: storage.k8s.io/v1 + kind: StorageClass + name: "{{ storageclass }}" + definition: + annotations: + k10.kasten.io/sc-supports-block-mode-exports=true + loop: "{{ ocp4_workload_kasten_k10_storageclasses }}" + loop_control: + loop_var: storageclass - - name: Save AgnosticD user information for multi user - when: - - ocp4_workload_kasten_k10_setup_demo | bool - - ocp4_workload_kasten_k10_multi_user | bool - agnosticd_user_info: - user: "{{ ocp4_workload_kasten_k10_objectbucket_user_base }}{{ user_number }}" - data: - kasten_dashboard: "https://{{ r_kasten_route.resources[0].spec.host }}/k10/" - kasten_backup_bucket_name: "{{ ocp4_workload_kasten_k10_objectbucket_name }}" - kasten_backup_bucket_namespace: "{{ ocp4_workload_kasten_k10_objectbucket_namespace_base }}{{ user_number }}" - kasten_backup_bucket_host: s3.openshift-storage.svc - kasten_backup_bucket_port: 443 - loop: "{{ range(1, ocp4_workload_kasten_k10_num_users | int + 1) | list }}" - loop_control: - loop_var: user_number + - name: Save AgnosticD user information for single user + when: not ocp4_workload_kasten_k10_multi_user | bool + agnosticd_user_info: + data: + kasten_backup_bucket_name: "{{ ocp4_workload_kasten_k10_objectbucket_name }}" + kasten_backup_bucket_namespace: "{{ ocp4_workload_kasten_k10_objectbucket_namespace }}" + kasten_backup_bucket_host: s3.openshift-storage.svc + kasten_backup_bucket_port: 443 + + - name: Save AgnosticD user information for multi user + when: ocp4_workload_kasten_k10_multi_user | bool + agnosticd_user_info: + user: "{{ ocp4_workload_kasten_k10_objectbucket_user_base }}{{ user_number }}" + data: + kasten_dashboard: "https://{{ r_kasten_route.resources[0].spec.host }}/k10/" + kasten_backup_bucket_name: "{{ ocp4_workload_kasten_k10_objectbucket_name }}" + kasten_backup_bucket_namespace: "{{ ocp4_workload_kasten_k10_objectbucket_namespace_base }}{{ user_number }}" + kasten_backup_bucket_host: s3.openshift-storage.svc + kasten_backup_bucket_port: 443 + loop: "{{ range(1, ocp4_workload_kasten_k10_num_users | int + 1) | list }}" + loop_control: + loop_var: user_number