Skip to content

Commit

Permalink
Fix startup with missing etcd static pod manifest
Browse files Browse the repository at this point in the history
Seems like the intent was to ignore the file not found error, but
apparently someone forgot that a bare return would use the err
value returned by ReadFile, not the default nil from the named return.

Signed-off-by: Brad Davidson <[email protected]>
  • Loading branch information
brandond committed Nov 6, 2020
1 parent 0dcc727 commit 06d7fa0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/podexecutor/staticpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"io/ioutil"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"net/http"
"os"
"os/exec"
Expand All @@ -21,6 +20,7 @@ import (
"github.com/rancher/rke2/pkg/staticpod"
"github.com/sirupsen/logrus"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
auditv1 "k8s.io/apiserver/pkg/apis/audit/v1"
"k8s.io/apiserver/pkg/authentication/authenticator"
"sigs.k8s.io/yaml"
Expand Down Expand Up @@ -187,7 +187,7 @@ func (s *StaticPodConfig) ControllerManager(apiReady <-chan struct{}, args []str
func (s *StaticPodConfig) CurrentETCDOptions() (opts executor.InitialOptions, err error) {
bytes, err := ioutil.ReadFile(filepath.Join(s.ManifestsDir, "etcd.yaml"))
if os.IsNotExist(err) {
return
return opts, nil
}

pod := &v1.Pod{}
Expand All @@ -200,7 +200,7 @@ func (s *StaticPodConfig) CurrentETCDOptions() (opts executor.InitialOptions, er
return opts, json.NewDecoder(strings.NewReader(v)).Decode(&opts)
}

return
return opts, nil
}

// ETCD starts the etcd static pod.
Expand Down

0 comments on commit 06d7fa0

Please sign in to comment.