[Federation][Kubefed] Bug fix - kubeconfig path not updated properly when supplied through --kubeconfig flag in kubefed init

This commit is contained in:
Irfan Ur Rehman 2017-02-14 20:10:24 +05:30
parent a57967f47b
commit c71fd73251
2 changed files with 5 additions and 4 deletions

View File

@ -326,7 +326,7 @@ func (i *initFederation) Run(cmdOut io.Writer, config util.AdminConfig) error {
// 8. Write the federation API server endpoint info, credentials
// and context to kubeconfig
err = updateKubeconfig(config, i.commonOptions.Name, endpoint, entKeyPairs, i.options.dryRun)
err = updateKubeconfig(config, i.commonOptions.Name, endpoint, i.commonOptions.Kubeconfig, entKeyPairs, i.options.dryRun)
if err != nil {
return err
}
@ -890,8 +890,9 @@ func printSuccess(cmdOut io.Writer, ips, hostnames []string, svc *api.Service) e
return err
}
func updateKubeconfig(config util.AdminConfig, name, endpoint string, entKeyPairs *entityKeyPairs, dryRun bool) error {
func updateKubeconfig(config util.AdminConfig, name, endpoint, kubeConfigPath string, entKeyPairs *entityKeyPairs, dryRun bool) error {
po := config.PathOptions()
po.LoadingRules.ExplicitPath = kubeConfigPath
kubeconfig, err := po.GetStartingConfig()
if err != nil {
return err

View File

@ -114,8 +114,8 @@ func TestInitFederation(t *testing.T) {
},
{
federation: "union",
kubeconfigGlobal: fakeKubeFiles[0],
kubeconfigExplicit: "",
kubeconfigGlobal: fakeKubeFiles[1],
kubeconfigExplicit: fakeKubeFiles[2],
dnsZoneName: "example.test.",
lbIP: lbIP,
apiserverServiceType: v1.ServiceTypeLoadBalancer,