Skip to content

SA get current namespace #543

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

Conversation

KPostOffice
Copy link
Collaborator

Issue link

supersedes #539

What changes have been made

add check for SA namespace as default

Verification steps

use RHOAI workbook, clone this branch and run pip install . see that the namespace retrieved is the same as the project that you are in

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • Testing is not required for this change

@openshift-ci openshift-ci bot requested review from Fiona-Waters and Maxusmusti May 21, 2024 19:33
@KPostOffice KPostOffice changed the title Kp get current namespace SA get current namespace May 21, 2024
@astefanutti
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 22, 2024
Copy link
Collaborator

@ChristianZaccaria ChristianZaccaria left a comment

Choose a reason for hiding this comment

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

Will we want to enable the following test as part of this fix, or address in a separate PR?
https://github.com/project-codeflare/codeflare-sdk/blob/main/src/codeflare_sdk/cluster/cluster.py#L724

https://github.com/project-codeflare/codeflare-sdk/blob/main/tests/unit_test.py#L579

Apart from the above question, all works as expected!

@ChristianZaccaria
Copy link
Collaborator

Wondering if it's a good idea to set something like this to all notebooks, further removing the need for user input:

cluster = Cluster(ClusterConfiguration(
    name='raytest',
    namespace= cluster.get_current_namespace(),

I think we would need to add the import too for usage:
from codeflare_sdk.cluster import cluster

@KPostOffice
Copy link
Collaborator Author

Wondering if it's a good idea to set something like this to all notebooks, further removing the need for user input:

cluster = Cluster(ClusterConfiguration(
    name='raytest',
    namespace= cluster.get_current_namespace(),

I think we would need to add the import too for usage: from codeflare_sdk.cluster import cluster

If config doesn't have a namespace set it should use the current working namespace

@KPostOffice
Copy link
Collaborator Author

Will we want to enable the following test as part of this fix, or address in a separate PR? https://github.com/project-codeflare/codeflare-sdk/blob/main/src/codeflare_sdk/cluster/cluster.py#L724

https://github.com/project-codeflare/codeflare-sdk/blob/main/tests/unit_test.py#L579

Apart from the above question, all works as expected!

I'm not sure what the test is testing exactly. Can we leave it out for now?

@ChristianZaccaria
Copy link
Collaborator

/lgtm just needs a rebase, thank you!

@Fiona-Waters
Copy link
Contributor

I ran a demo notebook without providing the namespace and the rhods-notebooks namespace was retrieved from /var/run/secrets/kubernetes.io/serviceaccount/namespace. Works as expected.
/approve

Copy link
Contributor

openshift-ci bot commented May 23, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Fiona-Waters

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

The pull request process is described 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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 23, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 7d758eb into project-codeflare:main May 23, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants