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

check while ~/.kube/config is missing #478

Merged
merged 1 commit into from
Oct 19, 2019
Merged

check while ~/.kube/config is missing #478

merged 1 commit into from
Oct 19, 2019

Conversation

Rui-Tang
Copy link
Contributor

fix #448

@volcano-sh-bot volcano-sh-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 10, 2019
@Rui-Tang
Copy link
Contributor Author

/assign @quinton-hoole

@TravisBuddy
Copy link

Hey @Rui-Tang,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 30a15cb0-eb3b-11e9-b736-db238f783907

cmd.Flags().StringVarP(&cf.Kubeconfig, "kubeconfig", "k", filepath.Join(home, ".kube", "config"), "(optional) absolute path to the kubeconfig file")
/*
Default kubeconfig file is located in $HOME/.kube/config . In case this file is not exist, it will look for $KUBECONFIG instead.
*/
Copy link
Collaborator

Choose a reason for hiding this comment

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

In volcano, // comments this is the recommended comment format.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have changed it.

cmd.Flags().StringVarP(&cf.Kubeconfig, "kubeconfig", "k", defaultKubeConfigFile, "(optional) absolute path to the kubeconfig file")
} else if kubeConfig := kubeConfig(); kubeConfig != "" {
cmd.Flags().StringVarP(&cf.Kubeconfig, "kubeconfig", "k", kubeConfig, "(optional) absolute path to the kubeconfig file")
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The priority orders should be: --kubeconfig >KUBECONFIG > $HOME/.kube/config

Copy link
Contributor

Choose a reason for hiding this comment

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

It's possible that we end up missing the Kubeconfig option if the if statement on line 39 is missed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have reordered code and it should fix this problem.

Copy link
Collaborator

@hzxuzhonghu hzxuzhonghu 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 the fix

@k82cn
Copy link
Member

k82cn commented Oct 10, 2019

/approve

Thanks for the fix :)

@volcano-sh-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: k82cn, Rui-Tang

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

@volcano-sh-bot volcano-sh-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 10, 2019
@TravisBuddy
Copy link

Hey @Rui-Tang,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: b428ea60-eb42-11e9-b736-db238f783907

@@ -31,7 +31,14 @@ func initFlags(cmd *cobra.Command, cf *commonFlags) {
cmd.Flags().StringVarP(&cf.Master, "master", "s", "", "the address of apiserver")

if home := homeDir(); home != "" {
cmd.Flags().StringVarP(&cf.Kubeconfig, "kubeconfig", "k", filepath.Join(home, ".kube", "config"), "(optional) absolute path to the kubeconfig file")
/*
Default kubeconfig file is located in $HOME/.kube/config . In case this file is not exist, it will look for $KUBECONFIG instead.
Copy link
Contributor

Choose a reason for hiding this comment

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

does not exist

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks.

@TommyLike
Copy link
Contributor

Please fix the Tests issues

@TravisBuddy
Copy link

Hey @Rui-Tang,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 703953c0-ece2-11e9-9c72-6f1acdb8f3f3

@TravisBuddy
Copy link

Hey @Rui-Tang,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 33aa2230-ece3-11e9-9c72-6f1acdb8f3f3

@Rui-Tang
Copy link
Contributor Author

@TommyLike I don't know why e2e test failed. Can you please look at it and tell me how to fix it?

cmd.Flags().StringVarP(&cf.Kubeconfig, "kubeconfig", "k", defaultKubeConfigFile, "(optional) absolute path to the kubeconfig file")
} else if kubeConfig := kubeConfig(); kubeConfig != "" {
//Default kubeconfig file is located in $HOME/.kube/config . In case this file does not exist, it will look for $KUBECONFIG instead.
cmd.Flags().StringVarP(&cf.Kubeconfig, "kubeconfig", "k", kubeConfig, "(optional) absolute path to the kubeconfig file")
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Rui-Tang The e2e failure is related to this. And the e2e in test/e2e/vcctl.go should be updated accordingly.
I would suggest the following orders

1. --kubeconfig=/path/to/.kube/config flag

2. KUBECONFIG  ENV

3. $HOME/.kube/config 

Copy link
Member

Choose a reason for hiding this comment

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

I merged this PR forcefully; @hzxuzhonghu , please help to fix e2e error :)

@k82cn k82cn merged commit afc20c7 into volcano-sh:master Oct 19, 2019
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. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vcctl only reads the ~/.kube/config and neglects $KUBECONFIG
7 participants