Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions playbooks/roles/ocp-csi-driver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ Requirements

- Running OCP 4.x cluster is needed.
- Cluster must not contain default StorageClass.
- A secret with PowerVC certificate in the `default` namespace.
Secret name must be `powervc-certificate` and must contains `certificate` field.
- Optional :
- A secret with PowerVC certificate in the `default` namespace
Secret name should be `powervc-certificate` and must contains `certificate` field.
eg.

```
Expand Down
17 changes: 11 additions & 6 deletions playbooks/roles/ocp-csi-driver/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,22 @@
name: powervc-certificate
namespace: default
register: powervc_certificate
ignore_errors: yes

- name: Fail if the powervc-certificate does not exists in default namespace
fail:
- name: If the powervc-certificate does not exists in default namespace
debug:
msg: "PowerVC certificate secret is not present!"
when: powervc_certificate.resources | length == 0

- fail:
- name: Debug if the PowerVC certificate is empty or missing
debug:
msg: "PowerVC certificate is empty! Please check the certificate's secret."
when: >
(powervc_certificate.resources[0].data.certificate is not defined) or
(powervc_certificate.resources[0].data.certificate | length == 0)
when:
powervc_certificate.resources | length != 0 and
(
powervc_certificate.resources[0].data.certificate is not defined or
powervc_certificate.resources[0].data.certificate | length == 0
)

- name: Create namespace for CSI driver validation
k8s:
Expand Down