Skip to content

Add kdm setting#2657

Merged
khushboo-rancher merged 1 commit into
harvester:mainfrom
khushboo-rancher:test_kdm
May 26, 2026
Merged

Add kdm setting#2657
khushboo-rancher merged 1 commit into
harvester:mainfrom
khushboo-rancher:test_kdm

Conversation

@khushboo-rancher
Copy link
Copy Markdown
Collaborator

  1. Added kdm setting
    a. Default - no change
    b. custom url - the global setting rke2 metadata will be updated in Rancher
  2. Added Gateway in IPPool creation
  3. Added logs about charts verisons
  4. Removed repeated methods from Rancher modules
  5. Replaced suprocess.run with _run_kubectl in Rancher crd file

Copilot AI review requested due to automatic review settings May 18, 2026 21:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 gateway support 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_endpoint is 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 thread harvester_robot_tests/keywords/rancher.resource Outdated
Comment thread harvester_robot_tests/libs/rancher/rest.py Outdated
Comment thread harvester_robot_tests/libs/rancher/rest.py Outdated
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 thread harvester_robot_tests/libs/rancher/crd.py Outdated
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}")

Comment thread harvester_robot_tests/libs/rancher/base.py Outdated
Comment thread harvester_robot_tests/keywords/rancher.resource Outdated
Comment thread harvester_robot_tests/libs/rancher/rest.py Outdated
Comment thread harvester_robot_tests/libs/rancher/rest.py
Comment thread harvester_robot_tests/keywords/rancher.resource Outdated
Comment thread harvester_robot_tests/libs/network/rest.py
@khushboo-rancher
Copy link
Copy Markdown
Collaborator Author

Screenshot 2026-05-20 at 3 40 59 PM Screenshot 2026-05-20 at 3 38 36 PM

Signed-off-by: Khushboo <fnu.khushboo@suse.com>
Copy link
Copy Markdown
Contributor

@irishgordo irishgordo left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Copy Markdown
Contributor

@albinsun albinsun left a comment

Choose a reason for hiding this comment

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

LGTM

@khushboo-rancher khushboo-rancher merged commit 9188364 into harvester:main May 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants