Skip to content

Commit

Permalink
Making powervc-certificate optional
Browse files Browse the repository at this point in the history
Signed-off-by: ira-pandey1 <[email protected]>
  • Loading branch information
irapandey committed Oct 21, 2024
1 parent f78251e commit 41c3eac
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
37 changes: 19 additions & 18 deletions playbooks/roles/ocp-csi-driver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,25 @@ 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.
eg.

```
apiVersion: v1
kind: Secret
metadata:
name: powervc-certificate
namespace: default
type: Opaque
stringData:
certificate: |
-----BEGIN CERTIFICATE-----
IBAgwIBUCCAwIBAgIUn2gAbw0LWHtozBNiLdUtELvr1pyPAzcNAQYjAwDQYJKoZIhv
...
Un2gAIBAb -----END CERTIFICATE-----
```
- Optional :
- A secret with PowerVC certificate in the `default` namespace
Secret name should be `powervc-certificate` and must contains `certificate` field.
eg.

```
apiVersion: v1
kind: Secret
metadata:
name: powervc-certificate
namespace: default
type: Opaque
stringData:
certificate: |
-----BEGIN CERTIFICATE-----
IBAgwIBUCCAwIBAgIUn2gAbw0LWHtozBNiLdUtELvr1pyPAzcNAQYjAwDQYJKoZIhv
...
Un2gAIBAb -----END CERTIFICATE-----
```
Role Variables
--------------
Expand Down
8 changes: 5 additions & 3 deletions playbooks/roles/ocp-csi-driver/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,15 @@
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: If powervc-certificate is empty
debug:
msg: "PowerVC certificate is empty! Please check the certificate's secret."
when: >
(powervc_certificate.resources[0].data.certificate is not defined) or
Expand Down

0 comments on commit 41c3eac

Please sign in to comment.