Skip to content

🐛 Fixes creation kind cluster if missing before preload. - #553

Merged
pdettori merged 3 commits into
rossoctl:mainfrom
rubambiza:fix-image-preload-with-no-kind-cluster
Jan 29, 2026
Merged

pdettori merged 3 commits into
rossoctl:mainfrom
rubambiza:fix-image-preload-with-no-kind-cluster

Conversation

@rubambiza

@rubambiza rubambiza commented Jan 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR fixes the bug where a local kind cluster does exist, but it is not kagenti.

In other words, the context is set to an existing kind cluster, which short-circuits the first check for kind cluster because kubectl_api.rc does, in fact, return 0. The alternative was to force the user to create the cluster manually, but I wanted to make this frictionless such that the kagenti cluster is automatically created for the user before preloading.

Related issue(s)

Fixes #491

This catches the peculiar case where a local kind cluster does exist, but it is not kagenti.

In other words, the context is set to an existing kind cluster, which short-circuits the first check for kind cluster because kubectl_api.rc does return 0.

Signed-off-by: Gloire Rubambiza <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes a bug where the Ansible installer would proceed with the wrong kind cluster when kubectl is already configured to access a non-kagenti kind cluster. The issue occurred because the original logic checked kubectl_api.rc != 0 to determine if cluster creation was needed, but this returns 0 (success) when connected to any cluster, including the wrong one.

Changes:

  • Removed the kubectl_api.rc != 0 condition from the cluster setup block, ensuring the kagenti cluster is created and the context is verified whenever create_kind_cluster=true
  • Added context switching and verification logic to ensure kubectl points to the kagenti cluster
  • Added cluster creation logic to the preload block to handle scenarios where create_kind_cluster=false but preloading is enabled

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

@pdettori

Copy link
Copy Markdown
Member

@rubambiza thanks ! would it be ok for you to address copilot's comments ?

@rubambiza

Copy link
Copy Markdown
Contributor Author

@pdettori Yes, I plan to address them shortly.

@pdettori pdettori left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@pdettori
pdettori merged commit e6fcc1e into rossoctl:main Jan 29, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from In review / Needs Testing to Done in Rossoctl Issue Prioritization Jan 29, 2026
@rubambiza
rubambiza deleted the fix-image-preload-with-no-kind-cluster branch January 29, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

🐛 Installer proceeds with no kagenti kind cluster

3 participants