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

Fix profile list when there are multi node clusters #9996

Merged
merged 1 commit into from
Feb 2, 2021

Conversation

daehyeok
Copy link
Contributor

@daehyeok daehyeok commented Dec 18, 2020

Fix problem which ListProfiles return sub-nodes in Mult-Node clusters as
a part of inValidPs.

fixes #9772

before

❯ minikube profile list
|----------|-----------|---------|--------------|------|---------|---------|-------|
| Profile  | VM Driver | Runtime |      IP      | Port | Version | Status  | Nodes |
|----------|-----------|---------|--------------|------|---------|---------|-------|
| minikube | docker    | docker  | 192.168.49.2 | 8443 | v1.20.0 | Running |     2 |
|----------|-----------|---------|--------------|------|---------|---------|-------|
❗  Found 1 invalid profile(s) !
	 minikube-m02
💡  You can delete them using the following command(s):
	 $ minikube delete -p minikube-m02

after

❯ minikube profile list
|----------|-----------|---------|--------------|------|---------|---------|-------|
| Profile  | VM Driver | Runtime |      IP      | Port | Version | Status  | Nodes |
|----------|-----------|---------|--------------|------|---------|---------|-------|
| minikube | docker    | docker  | 192.168.49.2 | 8443 | v1.20.0 | Running |     2 |
|----------|-----------|---------|--------------|------|---------|---------|-------|
❗  Found 0 invalid profile(s) !
💡  You can delete them using the following command(s):

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 18, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @daehyeok. Thanks for your PR.

I'm waiting for a kubernetes 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.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 18, 2020
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 18, 2020
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@@ -242,6 +250,27 @@ func removeDupes(profiles []string) []string {
return result
}

// TODO: MachineName is copied from driver to avoid dependency cycle. Remove it or move to other module
// MachineName returns the name of the machine, as seen by the hypervisor given the cluster and node names
func MachineName(cc *ClusterConfig, n *Node) string {
Copy link
Member

@medyagh medyagh Dec 23, 2020

Choose a reason for hiding this comment

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

lets move this a package that everyone can use, and we could refactor all other existances of this function
this could be moved to maybe util package or drivers package

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Which package is good for new home of this func?

Copy link
Member

Choose a reason for hiding this comment

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

does it allow to put it in 'drivers" package ?

Copy link
Member

@medyagh medyagh Dec 31, 2020

Choose a reason for hiding this comment

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

or can we put it in the machine package?
so we could call it something like this

machine.NameFromConfig(cc *ClusterConfig, n *Node)

or simply

machine.Name(cc *ClusterConfig, n *Node)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you means pkg/minikube/machine package?
Unfortunately, it also depend on config.

Copy link
Member

Choose a reason for hiding this comment

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

how about we refactor the MachineName func to not depend on clusterConfig or Node ?

so we pass everything we want from it ?

machine.Name(name string, int nodes, controlPlane bool, ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function required following arguments,
Cluster name, Node name, number of node in cluster, is controlPlane or not
machine.Name(clusterName, nodeName string, int nodes, controlPlane bool).
Is it okay?

Copy link
Member

@medyagh medyagh Jan 7, 2021

Choose a reason for hiding this comment

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

@daehyeok sure that sounds like a good compromise

pkg/minikube/config/profile.go Show resolved Hide resolved
@@ -242,6 +250,27 @@ func removeDupes(profiles []string) []string {
return result
}

// TODO: MachineName is copied from driver to avoid dependency cycle. Remove it or move to other module
// MachineName returns the name of the machine, as seen by the hypervisor given the cluster and node names
func MachineName(cc *ClusterConfig, n *Node) string {
Copy link
Member

@medyagh medyagh Dec 31, 2020

Choose a reason for hiding this comment

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

or can we put it in the machine package?
so we could call it something like this

machine.NameFromConfig(cc *ClusterConfig, n *Node)

or simply

machine.Name(cc *ClusterConfig, n *Node)

@tstromberg
Copy link
Contributor

Any update here? I wonder if @medyagh 's suggestion will also result in a circular dependency.

@@ -242,6 +250,27 @@ func removeDupes(profiles []string) []string {
return result
}

// TODO: MachineName is copied from driver to avoid dependency cycle. Remove it or move to other module
// MachineName returns the name of the machine, as seen by the hypervisor given the cluster and node names
func MachineName(cc *ClusterConfig, n *Node) string {
Copy link
Member

Choose a reason for hiding this comment

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

how about we refactor the MachineName func to not depend on clusterConfig or Node ?

so we pass everything we want from it ?

machine.Name(name string, int nodes, controlPlane bool, ...)

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 9, 2021
@daehyeok daehyeok requested a review from medyagh January 14, 2021 19:57
@medyagh medyagh changed the title Remove cluster's subnodes from ListProfiles result. Fix profile list when there are multi node closers Jan 14, 2021
Copy link
Member

@medyagh medyagh 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 this PR
it looks good just one thing I request to add integation test for it.

we have a TestMultiNode https://github.com/medyagh/minikube/blob/89a8cdc794098f9ba0550fbb5eeb19bc3dd8774d/test/integration/multinode_test.go#L29
lets add a Profile List to that test
and ensure the Profile List Exits Normally
only check for exit code 0

		}{
			{"FreshStart2Nodes", validateMultiNodeStart},
			{"AddNode", validateAddNodeToMultiNode},
			{"StopNode", validateStopRunningNode},
			{"StartAfterStop", validateStartNodeAfterStop},
			{"DeleteNode", validateDeleteNodeFromMultiNode},
			{"StopMultiNode", validateStopMultiNodeCluster},
			{"RestartMultiNode", validateRestartMultiNodeCluster},

lets add profile list after "FreshStart2Nodes",

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 17, 2021
@daehyeok
Copy link
Contributor Author

Test added case to integration test.

@daehyeok daehyeok requested a review from medyagh January 17, 2021 05:16
@sharifelgamal
Copy link
Collaborator

Can we be sure that we don't show the "Found 0 invalid profiles" when there are no invalid profiles? When everything is ok, it should just show the table.

@daehyeok
Copy link
Contributor Author

Can we be sure that we don't show the "Found 0 invalid profiles" when there are no invalid profiles? When everything is ok, it should just show the table.

Oops my bad. I confused master brach also print warn. Please ignore my previous comment.

fixed it.

❯ minikube profile list
|----------|-----------|---------|--------------|------|---------|---------|-------|
| Profile  | VM Driver | Runtime |      IP      | Port | Version | Status  | Nodes |
|----------|-----------|---------|--------------|------|---------|---------|-------|
| minikube | docker    | docker  | 192.168.49.2 | 8443 | v1.20.0 | Stopped |     1 |
|----------|-----------|---------|--------------|------|---------|---------|-------|

Fix prolbem which ListProfiles return subnodes in Mult-Node clusters as
a part of inValidPs.
@sharifelgamal sharifelgamal changed the title Fix profile list when there are multi node closers Fix profile list when there are multi node clusters Feb 1, 2021
@sharifelgamal
Copy link
Collaborator

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 1, 2021
@medyagh medyagh merged commit ce8a7e8 into kubernetes:master Feb 2, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: daehyeok, medyagh

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

The pull request process is described 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

profile list for multi node shows error wrongfully
6 participants