-
Notifications
You must be signed in to change notification settings - Fork 994
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
Conversation
/assign @quinton-hoole |
Hey @Rui-Tang, TravisCI finished with status TravisBuddy Request Identifier: 30a15cb0-eb3b-11e9-b736-db238f783907 |
pkg/cli/job/common.go
Outdated
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. | ||
*/ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed it.
pkg/cli/job/common.go
Outdated
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") | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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
/approve Thanks for the fix :) |
[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 |
Hey @Rui-Tang, TravisCI finished with status TravisBuddy Request Identifier: b428ea60-eb42-11e9-b736-db238f783907 |
pkg/cli/job/common.go
Outdated
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does not exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks.
Please fix the Tests issues |
Hey @Rui-Tang, TravisCI finished with status TravisBuddy Request Identifier: 703953c0-ece2-11e9-9c72-6f1acdb8f3f3 |
Hey @Rui-Tang, TravisCI finished with status TravisBuddy Request Identifier: 33aa2230-ece3-11e9-9c72-6f1acdb8f3f3 |
@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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 :)
fix #448