Skip to content

✨ Add support to clusterctl for inserting workload kubeconfig into an existing kubeconfig file #11942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dmvolod
Copy link
Member

@dmvolod dmvolod commented Mar 7, 2025

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #10133

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 7, 2025
@k8s-ci-robot k8s-ci-robot added the do-not-merge/needs-area PR is missing an area label label Mar 7, 2025
@k8s-ci-robot
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 fabriziopandini for approval. For more information see the Code Review Process.

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

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

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 7, 2025
@dmvolod
Copy link
Member Author

dmvolod commented Mar 7, 2025

/area clusterctl

@k8s-ci-robot k8s-ci-robot added area/clusterctl Issues or PRs related to clusterctl and removed do-not-merge/needs-area PR is missing an area label labels Mar 7, 2025
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 10, 2025
@dmvolod dmvolod force-pushed the issue-10133 branch 2 times, most recently from c014c6e to c43c52a Compare March 10, 2025 17:33
@dmvolod
Copy link
Member Author

dmvolod commented Mar 25, 2025

@fabriziopandini could you please to have a look at this PR when possible
Thanks in advance

Copy link
Member

@sivchari sivchari left a comment

Choose a reason for hiding this comment

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

I left one nits, but otherwise looks good.
/lgtm

}
}

const workloadKubeconfig = `apiVersion: v1
Copy link
Member

Choose a reason for hiding this comment

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

Let's separate to other file. We can embed these data to use go:embed.
It's more readable.

Copy link
Member Author

Choose a reason for hiding this comment

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

Totally agree with you and embed is my preferable way for big data values in tests.
But I can see, that most of the test approaches in the Cluster API tests are using constants.

Copy link
Member

Choose a reason for hiding this comment

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

Then, let's move constants to embedded way after it or asynchronously.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, please review

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 12, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 9989754b9f0d1c43516c96d2d986b122b165cc56

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 15, 2025
@k8s-ci-robot k8s-ci-robot requested a review from sivchari April 15, 2025 05:14
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

Copy link
Member

@sivchari sivchari left a comment

Choose a reason for hiding this comment

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

Thanks for updating. I left nits, PTAL 🙏

Comment on lines 28 to 35
//go:embed testdata/existsing-kubeconfig.yaml
var existingKubeconfig string

//go:embed testdata/workload-kubeconfig.yaml
var workloadKubeconfig string

//go:embed testdata/joined-kubeconfig.yaml
var joinedKubeconfig string
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
//go:embed testdata/existsing-kubeconfig.yaml
var existingKubeconfig string
//go:embed testdata/workload-kubeconfig.yaml
var workloadKubeconfig string
//go:embed testdata/joined-kubeconfig.yaml
var joinedKubeconfig string
var (
//go:embed testdata/existsing-kubeconfig.yaml
existingKubeconfig string
//go:embed testdata/workload-kubeconfig.yaml
workloadKubeconfig string
//go:embed testdata/joined-kubeconfig.yaml
joinedKubeconfig string
)

Just a bit easier to read.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, will fix

var existingKubeconfig string

//go:embed testdata/workload-kubeconfig.yaml
var workloadKubeconfig string
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var workloadKubeconfig string
var singleWorkloadKubeconfig string

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, will fix

var workloadKubeconfig string

//go:embed testdata/joined-kubeconfig.yaml
var joinedKubeconfig string
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var joinedKubeconfig string
var multipleWorkloadKubeconfig string

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, will fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/clusterctl Issues or PRs related to clusterctl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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.

clusterctl support for downloading kubeconfig as context within existing kubeconfig
3 participants