Skip to content
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

Extend GetKubeconfig methods with args #471

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mjudeikis
Copy link

What type of PR is this?

/kind feature

What this PR does / why we need it:

When dealing with multi-cluster setup we ran into issue where we need to pass arguments into GetKubeconfig method.
Specific example in our case was --internal to kind so cluster can speak to different clusters.

This extends this so you can do things like:

internalKubeConfigOpts := kind.WithGetKubeConfigArgs("--internal")
		internalKubeConfig, err := kindEdgeCluster.WithOpts(internalKubeConfigOpts).GetLiveKubeconfig()
		if err != nil {
			log.Printf("Failed to get edge cluster kubeconfig: %s", err)
			return ctx, err
		}
		installCmd := fmt.Sprintf(
			`bash -c "KUBECONFIG=%s kubectl create secret generic edge-cluster-kubeconfig -n omni-operator-system  --from-file=kubeconfig=%s"`,
			kindMasterCluster.GetKubeconfig(),
			internalKubeConfig,
		)

Or similar pattern if you want to set this for all cluster object.
In addition to allow networking we did this:

os.Setenv("KIND_EXPERIMENTAL_DOCKER_NETWORK", "kind-test")
	testEnv.Setup(
		envfuncs.CreateCluster(kindMasterCluster, kindMasterClusterName),
		envfuncs.CreateNamespace(namespace),
		setupFunc,
		installDepsFunc,
		generateAndDeployFunc,
		envfuncs.CreateClusterWithConfig(kindEdgeCluster, kindEdgeClusterName, "edge-kind.yaml"), // must be after master cluster setup.
		joinMasterClusterPrerequisitesFunc,
	)

Im not super exited about naming of GetLiveKubeconfig so any suggestions are welcome

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Additional documentation e.g., Usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 3, 2025
@k8s-ci-robot k8s-ci-robot added the sig/testing Categorizes an issue or PR as relevant to SIG Testing. label Jan 3, 2025
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 3, 2025
support/kwok/kwok.go Outdated Show resolved Hide resolved
Co-authored-by: Dmitry Volodin <[email protected]>
@mjudeikis mjudeikis force-pushed the extend.kubeconfig.method branch from efafd0a to e5f5248 Compare January 7, 2025 12:35
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mjudeikis
Once this PR has been reviewed and has the lgtm label, please assign harshanarayana 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

@mjudeikis
Copy link
Author

/retest

@k8s-ci-robot
Copy link
Contributor

@mjudeikis: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-e2e-framework-test e5f5248 link true /test pull-e2e-framework-test

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@mjudeikis
Copy link
Author

failure somehow does not look related ?

@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants