-
Notifications
You must be signed in to change notification settings - Fork 32
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
Wip/fix get harvester kubeconfig #1628
Wip/fix get harvester kubeconfig #1628
Conversation
Signed-off-by: Moritz Röhrich <moritz.rohrich@suse.com>
Fix generate kubeconfig function: fix oder of keyword parameters. Add debug logging (use with pytest `-v -s` options) Signed-off-by: Moritz Röhrich <moritz.rohrich@suse.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all changes are not harmful, but could you ask QAs to review PR rather than engineers next time?
and also cc @khushboo-rancher for your PR would be nice.
@@ -67,19 +67,27 @@ def __repr__(self): | |||
|
|||
def _get(self, path, **kwargs): | |||
url = urljoin(self.endpoint, path) | |||
return self.session.get(url, **kwargs) | |||
resp = self.session.get(url, **kwargs) | |||
print(f"{resp.request.method} {resp.request.url}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove the test output.
@@ -678,6 +678,7 @@ def delete(self, name, *, raw=False): | |||
|
|||
class ClusterManager(BaseManager): | |||
PATH_fmt = "v3/cluster/{uid}" | |||
PATH1_fmt = "v3/clusters/{uid}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks we didn't use this, is there any reason to add it?
@@ -15,7 +15,9 @@ def __init__(self): | |||
|
|||
def _storage_net_configured(self): | |||
code, data = self.settings.get('storage-network') | |||
if (cs := data.get('status', {}).get('conditions')): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assignment expressions (:=
) is introduced in python 3.8, which is the version we targeting to support, is there any reason to replace it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not supported in Python 3.6. We maintain a Python 3.6 environment in our tox config. Either we drop that as well, or we stick to Python 3.6 compatibility.
@@ -130,7 +130,14 @@ def harvester_mgmt_cluster(api_client, rancher_api_client, unique_name, polling_ | |||
@pytest.fixture(scope='module') | |||
def harvester_cloud_credential(api_client, rancher_api_client, | |||
harvester_mgmt_cluster, unique_name): | |||
harvester_kubeconfig = api_client.generate_kubeconfig() | |||
code, data = rancher_api_client.clusters.generate_kubeconfig( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the two configurations are same, could you check with @albinsun about the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not the same. One uses Rancher's API endpoint and authenticates with a Rancher token and the other one uses Harvester's API endpoint directly.
For these tests we need to use Rancher's API endpoint.
Please read the issue linked up top.
Your review was requested nearly a week ago. |
Which issue(s) this PR fixes:
Issue # #1627
What this PR does / why we need it:
Creating a cloud credential from a kubeconfig file that has not been created through Rancher is wrong, because then Rancher can't determine the expiration date of that kubeconfig and will return an error.
To fix this, the test suite needs to create the kubeconfig file through Rancher
Special notes for your reviewer:
Additional documentation or context