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

Conversation

irapandey
Copy link

This PR is resolving issue #85
Made changes in documentation as well as powervc-certificate is optional

@ppc64le-cloud-bot
Copy link
Contributor

Welcome @irapandey! It looks like this is your first PR to ocp-power-automation/ocp4-playbooks-extras 🎉

@ppc64le-cloud-bot ppc64le-cloud-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 21, 2024
@irapandey irapandey force-pushed the powervc-cert-optional branch from bd85cfb to 41c3eac Compare October 21, 2024 07:36
@varad-ahirwadkar
Copy link
Contributor

/lgtm

@ppc64le-cloud-bot ppc64le-cloud-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 21, 2024
@yussufsh
Copy link
Contributor

/hold

@ppc64le-cloud-bot ppc64le-cloud-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 21, 2024
msg: "PowerVC certificate secret is not present!"
when: powervc_certificate.resources | length == 0

- fail:
- name: If powervc-certificate is empty
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This task will fail if the above condition is true.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran it on a cluster - it just gives a message

TASK [ocp-csi-driver : Check if the PowerVC certificate's secret is exists] *************************************************************************************************************************************************************************
ok: [localhost]

TASK [ocp-csi-driver : If the powervc-certificate does not exists in default namespace] *************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": "PowerVC certificate secret is not present!"
}

TASK [ocp-csi-driver : If powervc-certificate is empty] *********************************************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": "PowerVC certificate is empty! Please check the certificate's secret."
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed the name parameters and replaces fail with debug

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TASK [ocp-csi-driver : Check if the PowerVC certificate's secret is exists] *************************************************************************************************************************************************************************
ok: [localhost]

TASK [ocp-csi-driver : If the powervc-certificate does not exists in default namespace] *************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": "PowerVC certificate secret is not present!"
}

TASK [ocp-csi-driver : debug] ***********************************************************************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": "PowerVC certificate is empty! Please check the certificate's secret."
}

TASK [ocp-csi-driver : Create namespace for CSI driver validation] **********************************************************************************************************************************************************************************
ok: [localhost]

@ppc64le-cloud-bot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@ppc64le-cloud-bot ppc64le-cloud-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 21, 2024
@irapandey irapandey force-pushed the powervc-cert-optional branch from 58e8be6 to e0743c8 Compare October 21, 2024 09:32
@irapandey irapandey requested a review from yussufsh October 21, 2024 09:41
@irapandey
Copy link
Author

@varad-ahirwadkar - can you take a look?

msg: "PowerVC certificate secret is not present!"
when: powervc_certificate.resources | length == 0

- fail:
- debug:
msg: "PowerVC certificate is empty! Please check the certificate's secret."
when: >
(powervc_certificate.resources[0].data.certificate is not defined) or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add one more condition to validate only if the certificate is exists powervc_certificate.resources | length != 0 ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made the changes - can you review and let me know if that looks good

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe what meant is that the second debug task should only run if the PowerVC certificate secret exists. The current condition includes a redundant check (powervc_certificate.resources | length != 0), which is already covered in the first task. Adding a name attribute would also help clarify the task's purpose.

Suggested Fix:
The check powervc_certificate.resources | length != 0 should be applied first, to validate that the secret exists. Once confirmed, we can then check whether the certificate is either not defined or empty (certificate | length == 0).

@irapandey irapandey force-pushed the powervc-cert-optional branch 2 times, most recently from caf33f2 to 2cc1088 Compare December 2, 2024 11:06
@yussufsh
Copy link
Contributor

yussufsh commented Jan 9, 2025

/cc @aman4433

Signed-off-by: ira-pandey1 <[email protected]>
@irapandey irapandey force-pushed the powervc-cert-optional branch from 2cc1088 to cad6bbb Compare January 28, 2025 09:10
@ppc64le-cloud-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: irapandey
Once this PR has been reviewed and has the lgtm label, please assign yussufsh for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants