Add kdm setting#2657
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the Harvester/Rancher robot test libraries and keywords to support (a) overriding Rancher’s KDM source via rke-metadata-config, (b) specifying an IPPool gateway, and (c) logging the deployed chart versions during test runs, while also refactoring some VM-related keywords to use the existing VM keyword library.
Changes:
- Add KDM URL configuration flow (variable + keyword + Rancher library methods) and a polling helper to wait for refreshed RKE2 versions.
- Add
gatewaysupport to IPPool creation across Network libraries and Robot keywords. - Add chart-version introspection and a DaemonSet-based helper to write cloud-provider config onto guest-cluster nodes before installing charts.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| harvester_robot_tests/libs/rancher/rest.py | Adds REST implementations for KDM setting update, deployed chart version lookup, and cloud-config hostPath writer DaemonSet. |
| harvester_robot_tests/libs/rancher/rancher.py | Exposes new Rancher wrapper methods (KDM config, deployed chart version, cloud-config writer). |
| harvester_robot_tests/libs/rancher/crd.py | Switches RKE2 version discovery to kubectl/raw, adds CRD implementations for KDM config, deployed chart version lookup, and cloud-config writer DaemonSet. |
| harvester_robot_tests/libs/rancher/base.py | Extends Rancher interface with KDM config + chart version getter + cloud-config writer; removes VM methods from interface. |
| harvester_robot_tests/libs/network/rest.py | Adds gateway to IPPool REST creation payload. |
| harvester_robot_tests/libs/network/network.py | Plumbs gateway through the Network component wrapper. |
| harvester_robot_tests/libs/network/crd.py | Adds gateway to IPPool CRD creation payload. |
| harvester_robot_tests/libs/network/base.py | Updates abstract IPPool creation signature/docs to include gateway. |
| harvester_robot_tests/libs/keywords/rancher_keywords.py | Adds keyword wrappers for KDM config, deployed chart version, and cloud-config writer. |
| harvester_robot_tests/libs/keywords/network_keywords.py | Updates keyword wrapper to pass gateway during IPPool creation. |
| harvester_robot_tests/keywords/variables.resource | Adds ${KDM_URL} and ${IP_POOL_GATEWAY} variables. |
| harvester_robot_tests/keywords/rancher.resource | Adds KDM configuration keywords + chart-version logging + cloud-config writer usage + updated VM lifecycle keywords. |
| harvester_robot_tests/keywords/network.resource | Updates Robot keyword signature/call sites for IPPool creation with gateway. |
Comments suppressed due to low confidence (1)
harvester_robot_tests/libs/rancher/crd.py:625
rancher_endpointis no longer used in this implementation (authentication and endpoint are derived from configured credentials/kubeconfig), but it’s still documented as an input. Either remove it from the signature/docs or explicitly note it’s ignored/kept only for backward compatibility to avoid misleading callers.
def get_all_rke2_versions(self, rancher_endpoint, max_versions=None):
"""
Get all available RKE2 versions from Rancher.
Args:
rancher_endpoint: Rancher server endpoint
max_versions: Maximum number of versions to return (None = all)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+2089
to
+2092
| { | ||
| "name": "host-root", | ||
| "hostPath": {"path": "/"} | ||
| } |
Comment on lines
+2115
to
+2145
| # Wait until all scheduled nodes have the initContainer completed | ||
| import time as _time | ||
| end_time = _time.time() + 300 | ||
| while _time.time() < end_time: | ||
| code, ds_data = self._rancher_proxy_request( | ||
| "GET", cluster_id, | ||
| f"apis/apps/v1/namespaces/{namespace}/daemonsets/{ds_name}" | ||
| ) | ||
| if code == 200 and ds_data: | ||
| status = ds_data.get("status", {}) | ||
| desired = status.get("desiredNumberScheduled", 0) | ||
| ready = status.get("numberReady", 0) | ||
| if desired > 0 and desired == ready: | ||
| logging(f"All {ready}/{desired} nodes configured") | ||
| break | ||
| _time.sleep(10) | ||
| else: | ||
| raise Exception( | ||
| "Timed out waiting for cloud-config writer DaemonSet to finish" | ||
| ) | ||
|
|
||
| # Clean up the DaemonSet | ||
| code, _ = self._rancher_proxy_request( | ||
| "DELETE", cluster_id, | ||
| f"apis/apps/v1/namespaces/{namespace}/daemonsets/{ds_name}" | ||
| ) | ||
| if code not in [200, 204]: | ||
| logging(f"Warning: failed to delete DaemonSet {ds_name}: {code}") | ||
| else: | ||
| logging(f"Deleted DaemonSet {ds_name}") | ||
|
|
Comment on lines
+2510
to
+2513
| { | ||
| "name": "host-root", | ||
| "hostPath": {"path": "/"} | ||
| } |
Comment on lines
+2534
to
+2563
| end_time = _time.time() + 300 | ||
| while _time.time() < end_time: | ||
| rc, stdout, stderr = self._run_kubectl_guest( | ||
| cluster_id, | ||
| ["get", "daemonset", ds_name, "-n", namespace, | ||
| "-o", "jsonpath={.status.desiredNumberScheduled}" | ||
| "/{.status.numberReady}"] | ||
| ) | ||
| if rc == 0 and "/" in stdout: | ||
| desired, ready = stdout.strip().split("/") | ||
| if desired == ready and int(desired) > 0: | ||
| logging(f"All {ready}/{desired} nodes configured") | ||
| break | ||
| _time.sleep(10) | ||
| else: | ||
| raise Exception( | ||
| "Timed out waiting for cloud-config writer DaemonSet to finish" | ||
| ) | ||
|
|
||
| # Clean up the DaemonSet | ||
| rc, stdout, stderr = self._run_kubectl_guest( | ||
| cluster_id, | ||
| ["delete", "daemonset", ds_name, "-n", namespace, | ||
| "--ignore-not-found"] | ||
| ) | ||
| if rc != 0: | ||
| logging(f"Warning: failed to delete DaemonSet {ds_name}: {stderr}") | ||
| else: | ||
| logging(f"Deleted DaemonSet {ds_name}") | ||
|
|
6707099 to
0d75c5d
Compare
irishgordo
reviewed
May 19, 2026
albinsun
reviewed
May 19, 2026
0d75c5d to
93c0608
Compare
Collaborator
Author
93c0608 to
a552968
Compare
Signed-off-by: Khushboo <fnu.khushboo@suse.com>
a552968 to
aea3a05
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


a. Default - no change
b. custom url - the global setting
rke2 metadatawill be updated in Ranchersuprocess.runwith_run_kubectlin Rancher crd file