Skip to content

Conversation

@aman4433
Copy link

This PR adds cleanup steps for COS instances and their keys. It also refactors the script to use functions for better readability and maintenance.

@ppc64le-cloud-bot ppc64le-cloud-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 11, 2025
@ppc64le-cloud-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aman4433
Once this PR has been reviewed and has the lgtm label, please assign rajalakshmi-girish for approval. For more information see the Kubernetes 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

@ppc64le-cloud-bot ppc64le-cloud-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 11, 2025
chmod +x /usr/local/bin/pvsadm
# Function to install pvsadm tool
install_pvsadm() {
wget -q -O /usr/local/bin/pvsadm https://github.com/ppc64le-cloud/pvsadm/releases/download/v0.1.1-alpha.7/pvsadm-linux-ppc64le
Copy link
Contributor

Choose a reason for hiding this comment

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

latest version of pvsadm is v0.1.21, please modify/test the script accordingly

# Function to run IBM Cloud CLI commands
cleanup_cos() {
ibmcloud login --apikey "$IBMCLOUD_API_KEY" -r jp-tok || exit 1
Copy link
Contributor

Choose a reason for hiding this comment

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

this command way expose your apikey into the logs if by chance we enable debugging, please avoid doing,
@Rajalakshmi-Girish lets find some other way..

for key in $(ibmcloud resource service-keys --instance-name "$instance" | awk 'NR>3 {print $1}'); do
ibmcloud resource service-key-delete "$key" -f || true
done
ibmcloud resource service-instance-delete "$instance" -f || true
Copy link
Contributor

Choose a reason for hiding this comment

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

you are blindly deleting these entries which seems to be risky for me, it will be great if you can delete them where this is initially getting created.

Copy link
Contributor

@srivastav-abhishek srivastav-abhishek left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I have provided few comments, please take a look.

chmod +x /usr/local/bin/pvsadm
# Function to install pvsadm tool
install_pvsadm() {
wget -q -O /usr/local/bin/pvsadm https://github.com/ppc64le-cloud/pvsadm/releases/download/v0.1.1-alpha.7/pvsadm-linux-ppc64le
Copy link
Contributor

Choose a reason for hiding this comment

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

Going forward, it's better to fetch latest pvsadm from script itself. That way we won't be modifying version here every time new version is released.

# Function to run IBM Cloud CLI commands
cleanup_cos() {
ibmcloud login --apikey "$IBMCLOUD_API_KEY" -r jp-tok || exit 1
Copy link
Contributor

Choose a reason for hiding this comment

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

There is an ask, not immediate, to move hypershift CI to US datacenters. We will have to change jp-tok to some other region. Please find a way to provide this value as an arg to the script and not hardcoding here.

Copy link
Contributor

Choose a reason for hiding this comment

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

or may be read from the file mounted from the secret

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants