Skip to content

Commit

Permalink
Update single node etcd migration code
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna Blendermann committed Jan 5, 2022
1 parent 34a349d commit 6613f07
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
12 changes: 0 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,6 @@ func initLogs(c *cli.Context, cfg rancher.Options) {
logserver.StartServerWithDefaults()
}

func migrateETCDlocal() {
if _, err := os.Stat("etcd"); err != nil {
return
}

// Purposely ignoring errors
_ = os.Mkdir("management-state", 0700)
_ = os.Symlink("../etcd", "management-state/etcd")
}

func run(cli *cli.Context, cfg rancher.Options) error {
logrus.Infof("Rancher version %s is starting", version.FriendlyVersion())
logrus.Infof("Rancher arguments %+v", cfg)
Expand All @@ -221,8 +211,6 @@ func run(cli *cli.Context, cfg rancher.Options) error {
logrus.Fatal("add-local flag must be set to 'true', see Rancher 2.5.0 release notes for more information")
}

migrateETCDlocal()

embedded, clientConfig, err := k8s.GetConfig(ctx, cfg.K8sMode, kubeConfig)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions package/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ if [ ! -e /run/secrets/kubernetes.io/serviceaccount ] && [ ! -e /dev/kmsg ]; the
exit 1
fi
rm -f /var/lib/rancher/k3s/server/cred/node-passwd
if [ -e /var/lib/rancher/etcd ] && [ ! -e /var/lib/rancher/k3s/server/db/etcd ]; then
if [ -e /var/lib/rancher/management-state/etcd ] && [ ! -e /var/lib/rancher/k3s/server/db/etcd ]; then
mkdir -p /var/lib/rancher/k3s/server/db
ln -sf /var/lib/rancher/etcd /var/lib/rancher/k3s/server/db/etcd
ln -sf /var/lib/rancher/management-state/etcd /var/lib/rancher/k3s/server/db/etcd
echo -n 'default' > /var/lib/rancher/k3s/server/db/etcd/name
fi
if [ -e /var/lib/rancher/k3s/server/db/etcd ]; then
Expand Down

0 comments on commit 6613f07

Please sign in to comment.