mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
[Federation][Kubefed] Bug fix - kubeconfig path not updated properly when supplied through --kubeconfig flag in kubefed init
This commit is contained in:
parent
a57967f47b
commit
c71fd73251
@ -326,7 +326,7 @@ func (i *initFederation) Run(cmdOut io.Writer, config util.AdminConfig) error {
|
|||||||
|
|
||||||
// 8. Write the federation API server endpoint info, credentials
|
// 8. Write the federation API server endpoint info, credentials
|
||||||
// and context to kubeconfig
|
// 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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -890,8 +890,9 @@ func printSuccess(cmdOut io.Writer, ips, hostnames []string, svc *api.Service) e
|
|||||||
return err
|
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 := config.PathOptions()
|
||||||
|
po.LoadingRules.ExplicitPath = kubeConfigPath
|
||||||
kubeconfig, err := po.GetStartingConfig()
|
kubeconfig, err := po.GetStartingConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -114,8 +114,8 @@ func TestInitFederation(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
federation: "union",
|
federation: "union",
|
||||||
kubeconfigGlobal: fakeKubeFiles[0],
|
kubeconfigGlobal: fakeKubeFiles[1],
|
||||||
kubeconfigExplicit: "",
|
kubeconfigExplicit: fakeKubeFiles[2],
|
||||||
dnsZoneName: "example.test.",
|
dnsZoneName: "example.test.",
|
||||||
lbIP: lbIP,
|
lbIP: lbIP,
|
||||||
apiserverServiceType: v1.ServiceTypeLoadBalancer,
|
apiserverServiceType: v1.ServiceTypeLoadBalancer,
|
||||||
|
Loading…
Reference in New Issue
Block a user