Skip to content

Conversation

@redpinecube
Copy link
Contributor

@redpinecube redpinecube commented Aug 4, 2025

Summary

Implements CountKubeflexControlPlaneContexts to count the number of control plane contexts.

Related issue(s)

#388
redpinecube#22

@kubestellar-prow kubestellar-prow bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Aug 4, 2025
@kubestellar-prow
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign dumb0002 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 4, 2025
@kubestellar-prow
Copy link
Contributor

Hi @redpinecube. Thanks for your PR.

I'm waiting for a kubestellar member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubestellar-prow kubestellar-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 4, 2025
@redpinecube
Copy link
Contributor Author

@rxinui

Comment on lines +304 to +329
func CountKubeflexControlPlaneContexts(kconf clientcmdapi.Config) int {
count := 0

for _, ctx := range kconf.Contexts {
ext := ctx.Extensions
if ext == nil {
continue
}

runtimeObj, ok := ext[ExtensionKubeflexKey]
if !ok {
continue
}

var extData RuntimeKubeflexExtension
if err := ConvertRuntimeObjectToRuntimeExtension(runtimeObj, &extData); err != nil {
continue
}

if cpName, ok := extData.Data[ExtensionControlPlaneName]; ok && cpName != "" {
count++
}
}

return count
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please review all comments listed on this PR #493

Copy link
Contributor

@rxinui rxinui left a comment

Choose a reason for hiding this comment

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

Changes to do

return DiagnosisStatusOK
}

func CountKubeflexControlPlaneContexts(kconf clientcmdapi.Config) int {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the point of counting cp?

@pdettori
Copy link
Contributor

pdettori commented Sep 8, 2025

@redpinecube can you please confirm we need to merge this set of PRs in the following order:

#495 (this one)
#496
#497
#498

Could you also please look into rebasing ?

@redpinecube
Copy link
Contributor Author

@redpinecube can you please confirm we need to merge this set of PRs in the following order:

#495 (this one) #496 #497 #498

Could you also please look into rebasing ?

I'll put all updates in one PR. It should close the parent issue

@MikeSpreitzer
Copy link
Contributor

@redpinecube: are you still working on this?

@vedansh-5
Copy link

@redpinecube do you wish to continue working on this?

@MikeSpreitzer
Copy link
Contributor

Isn't context counting already available from the output of kflex ctx list ?

@clubanderson clubanderson added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jan 12, 2026
@clubanderson
Copy link
Contributor

/ok-to-test

@kubestellar-prow kubestellar-prow bot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 12, 2026
@clubanderson
Copy link
Contributor

Hi @redpinecube 👋

This PR has merge conflicts that need to be resolved. You can do this with:

git fetch origin
git rebase origin/main
# Resolve any conflicts in your editor
git add .
git rebase --continue
git push --force-with-lease

Once rebased, the CI checks will run again. Let us know if you need any help!

@kubestellar-prow
Copy link
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubestellar-prow kubestellar-prow bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 12, 2026
@clubanderson clubanderson added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. kind/feature Categorizes issue or PR as related to a new feature. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants