Skip to content

Conversation

@jferrazbr
Copy link

@jferrazbr jferrazbr commented Oct 22, 2025

Issue #51881

Prepare KDM CI and test scripts to work when KDM marks Prime-only Kubernetes versions. Same idea as PR #1822 for v2.9, adapted per branch.

Problem

KDM CI and test scripts needs to:

  • Detect when a selected Kubernetes version requires Prime.
  • Choose staging or production Prime registry.
  • Fail early with a clear message if Prime is required but no registry endpoint is available in the environment.
  • Keep non-Prime behavior unchanged.

Solution

  • Prime detection in scripts:

    • Read channels, compare the release item’s "minChannelServerVersion" with "LAST_COMMUNITY_RANCHER" to decide Prime.
    • Pick "staging" or "production" Prime based on the version tag pattern.
    • Set "PRIME_MODE" and "PRIME_REG_HOST" for downstream provisioning test.
  • Early guard:

    • If "PRIME_MODE" is 1 but no registry endpoint is present, stop with a user-friendly message that explains why.
  • Defaults and safety:

    • Respect an already set "CATTLE_AGENT_IMAGE" from the environment. Only set a default if it is empty.
    • Keep normal flow when Prime is not required.
  • Workflow integration:

    • Variables "LAST_COMMUNITY_RANCHER" and "PRIME_AGENT_IMAGE" are passed from the workflow env. Scripts keep safe defaults for local runs.

@jferrazbr jferrazbr force-pushed the add-prime-mode-support-to-v2.10-provisioning-tests branch 3 times, most recently from cdbb559 to 76f1116 Compare October 22, 2025 21:16
@jferrazbr
Copy link
Author

jferrazbr commented Oct 22, 2025

Green run with prime test from this commit ✔️

Copy link

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 adds Prime mode detection logic to the KDM provisioning test scripts for the v2.10 branch. It enables the test infrastructure to detect when a selected Kubernetes version requires Rancher Prime, select the appropriate registry (staging or production), and fail gracefully with clear messaging when Prime is required but registry credentials are unavailable.

Key Changes:

  • Implements semantic version comparison and channel metadata parsing utilities to detect Prime-only K8s versions
  • Adds prime-route script that determines Prime mode, selects registry environment, and configures agent images
  • Integrates Prime detection into provisioning tests with early validation and clear error messages

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
scripts/semver_g.awk AWK utility for semantic version comparison (major.minor.patch), ignoring pre-release suffixes
scripts/channels-pick-minchan-for-version.awk AWK utility to extract minChannelServerVersion from channels YAML for a specific K8s version
scripts/prime-route Main Prime detection logic that compares versions, selects staging/production registry, and configures agent image
scripts/provisioning-tests Integrates prime-route sourcing and validates registry availability when Prime mode is required
Dockerfile.dapper Exposes new environment variables (LAST_COMMUNITY_RANCHER, PRIME_AGENT_IMAGE, STAGE_REGISTRY_ENDPOINT) to Dapper
.github/workflows/provisioning-tests.yaml Adds Vault secret retrieval for registry endpoints and sets Prime configuration variables
docs/release.md Documents Prime configuration variables, when to update them, and related rancher/rancher workflow pin requirements

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +62 to +54
# If Prime is on and PRIME_AGENT_IMAGE is set, override CATTLE_AGENT_IMAGE
if [[ -n "${PRIME_AGENT_IMAGE:-}" ]]; then
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

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

The condition checks if PRIME_AGENT_IMAGE is set before overriding CATTLE_AGENT_IMAGE, but PRIME_AGENT_IMAGE always has a default value set at line 16-18. This means the override will always occur when in Prime mode, even if the user explicitly set CATTLE_AGENT_IMAGE in their environment. The description states "Respect an already set CATTLE_AGENT_IMAGE from the environment", but this logic doesn't check if CATTLE_AGENT_IMAGE was already set.

Suggested change
# If Prime is on and PRIME_AGENT_IMAGE is set, override CATTLE_AGENT_IMAGE
if [[ -n "${PRIME_AGENT_IMAGE:-}" ]]; then
# If Prime is on and PRIME_AGENT_IMAGE is set, override CATTLE_AGENT_IMAGE only if not already set
if [[ -n "${PRIME_AGENT_IMAGE:-}" && -z "${CATTLE_AGENT_IMAGE:-}" ]]; then

Copilot uses AI. Check for mistakes.
@jferrazbr jferrazbr force-pushed the add-prime-mode-support-to-v2.10-provisioning-tests branch from 76f1116 to 674386a Compare December 15, 2025 16:27
@jakefhyde jakefhyde requested a review from a team December 15, 2025 19:31
@jferrazbr jferrazbr force-pushed the add-prime-mode-support-to-v2.10-provisioning-tests branch from 674386a to ebe06dc Compare December 15, 2025 22:22
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.

3 participants