Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making powervc-certificate optional #86

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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: 10 additions & 7 deletions playbooks/roles/ocp-csi-driver/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,20 @@
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:
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)
- block:
- 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

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