Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix k3s issues #208

Merged
merged 2 commits into from
Oct 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pkg/kwrapper/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ package etcd

import (
"context"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"strings"
"time"

Expand All @@ -16,9 +18,10 @@ import (
"github.com/sirupsen/logrus"
)

func RunETCD(ctx context.Context) ([]string, error) {
func RunETCD(ctx context.Context, dataDir string) ([]string, error) {
endpoint := "http://localhost:2379"
go runEtcd(ctx, []string{"--data-dir=./etcd"})

go runEtcd(ctx, []string{"etcd", fmt.Sprintf("--data-dir=%s", filepath.Join(dataDir, "etcd"))})

if err := checkEtcd(endpoint); err != nil {
return nil, errors.Wrap(err, "waiting on etcd")
Expand Down
2 changes: 1 addition & 1 deletion pkg/kwrapper/k8s/embedded_none.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !k3s
// +build !k8s

package k8s

Expand Down
15 changes: 9 additions & 6 deletions pkg/kwrapper/k8s/k3s.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build k3s
// +build k8s

package k8s

Expand All @@ -13,25 +13,28 @@ import (
)

func getEmbedded(ctx context.Context) (bool, context.Context, *rest.Config, error) {
var (
err error
)

sc, ok := ctx.Value(serverConfig).(*server.ServerConfig)
if !ok {
ctx, sc, _, err = NewK3sConfig(ctx, "./k3s", nil)
ctx, sc, _, err = NewK3sConfig(ctx, "./management-state", nil)
if err != nil {
return false, ctx, nil, err
}
sc.NoScheduler = false
}

if len(sc.ETCDEndpoints) == 0 {
etcdEndpoints, err := etcd.RunETCD(ctx)
etcdEndpoints, err := etcd.RunETCD(ctx, sc.DataDir)
if err != nil {
return ctx, nil, nil, err
return false, ctx, nil, err
}
sc.ETCDEndpoints = etcdEndpoints
}

err := server.Server(ctx, sc)
if err != nil {
if err = server.Server(ctx, sc); err != nil {
return false, ctx, nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/kwrapper/k8s/tunnel_k3s.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build k3s
// +build k8s

package k8s

Expand Down
2 changes: 1 addition & 1 deletion pkg/kwrapper/k8s/tunnel_none.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !k3s
// +build !k8s

package k8s

Expand Down
2 changes: 1 addition & 1 deletion vendor.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# package
github.com/rancher/norman

k8s.io/kubernetes v1.12.1-lite5 https://github.com/ibuildthecloud/k3s.git transitive=true,staging=true
k8s.io/kubernetes v1.12.1-lite7 https://github.com/ibuildthecloud/k3s.git transitive=true,staging=true
github.com/maruel/panicparse c0182c169410cfa80c7e8f046dad208eaef91338
bitbucket.org/ww/goautoneg a547fc61f48d567d5b4ec6f8aee5573d8efce11d https://github.com/rancher/goautoneg.git
golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions vendor/github.com/mattn/go-sqlite3/.gitignore

This file was deleted.

19 changes: 0 additions & 19 deletions vendor/github.com/mattn/go-sqlite3/.travis.yml

This file was deleted.

21 changes: 0 additions & 21 deletions vendor/github.com/mattn/go-sqlite3/LICENSE

This file was deleted.

97 changes: 0 additions & 97 deletions vendor/github.com/mattn/go-sqlite3/README.md

This file was deleted.

85 changes: 0 additions & 85 deletions vendor/github.com/mattn/go-sqlite3/backup.go

This file was deleted.

Loading