mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +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
|
||||
// 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
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user