Skip to content

Commit

Permalink
Run kubectl with explicit kubeconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
ingvagabund committed Sep 21, 2018
1 parent 2895459 commit 515d25b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/aws-actuator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ func bootstrapCommand() *cobra.Command {
return true, nil
})

log.Infof("Running kubectl config set-cluster kubernetes --server=https://%v:8443", masterMachinePublicDNS)
if _, err := cmdRun("kubectl", "config", "set-cluster", "kubernetes", fmt.Sprintf("--server=https://%v:8443", masterMachinePublicDNS)); err != nil {
log.Infof("Running kubectl --kubeconfig=kubeconfig config set-cluster kubernetes --server=https://%v:8443", masterMachinePublicDNS)
if _, err := cmdRun("kubectl", "--kubeconfig=kubeconfig", "config", "set-cluster", "kubernetes", fmt.Sprintf("--server=https://%v:8443", masterMachinePublicDNS)); err != nil {
return err
}

Expand Down Expand Up @@ -516,7 +516,7 @@ func bootstrapCommand() *cobra.Command {

err = wait.Poll(pollInterval, timeoutPoolAWSInterval, func() (bool, error) {
log.Info("Deploying cluster-api server")
if output, err := cmdRun("kubectl", "apply", fmt.Sprintf("-f=%v", path.Join(manifestsDir, "cluster-api-server.yaml")), "--validate=false"); err != nil {
if output, err := cmdRun("kubectl", "--kubeconfig=kubeconfig", "apply", fmt.Sprintf("-f=%v", path.Join(manifestsDir, "cluster-api-server.yaml")), "--validate=false"); err != nil {
log.Infof("Unable to apply %v manifest: %v\n%v", path.Join(manifestsDir, "cluster-api-server.yaml"), err, string(output))
return false, nil
}
Expand All @@ -526,7 +526,7 @@ func bootstrapCommand() *cobra.Command {

err = wait.Poll(pollInterval, timeoutPoolAWSInterval, func() (bool, error) {
log.Info("Deploying cluster-api controllers")
if output, err := cmdRun("kubectl", "apply", fmt.Sprintf("-f=%v", path.Join(manifestsDir, "provider-components.yml"))); err != nil {
if output, err := cmdRun("kubectl", "--kubeconfig=kubeconfig", "apply", fmt.Sprintf("-f=%v", path.Join(manifestsDir, "provider-components.yml"))); err != nil {
log.Infof("Unable to apply %v manifest: %v\n%v", path.Join(manifestsDir, "provider-components.yml"), err, string(output))
return false, nil
}
Expand Down

0 comments on commit 515d25b

Please sign in to comment.