pull/351/head^2
iwilltry42 4 years ago
parent 6c784d9ff2
commit d7b25ac6ab
No known key found for this signature in database
GPG Key ID: 7BA57AD1CFF16110
  1. 4
      Makefile
  2. 4
      README.md
  3. 12
      cmd/cluster/clusterCreate.go
  4. 10
      cmd/cluster/clusterDelete.go
  5. 8
      cmd/cluster/clusterList.go
  6. 10
      cmd/cluster/clusterStart.go
  7. 8
      cmd/cluster/clusterStop.go
  8. 8
      cmd/image/imageImport.go
  9. 8
      cmd/kubeconfig/kubeconfigGet.go
  10. 10
      cmd/kubeconfig/kubeconfigMerge.go
  11. 10
      cmd/node/nodeCreate.go
  12. 8
      cmd/node/nodeDelete.go
  13. 8
      cmd/node/nodeList.go
  14. 6
      cmd/node/nodeStart.go
  15. 6
      cmd/node/nodeStop.go
  16. 14
      cmd/root.go
  17. 6
      cmd/util/completion.go
  18. 4
      cmd/util/filter.go
  19. 2
      cmd/util/plugins.go
  20. 2
      cmd/util/ports.go
  21. 2
      cmd/util/volumes.go
  22. 2
      go.mod
  23. 2
      main.go
  24. 12
      pkg/cluster/cluster.go
  25. 2
      pkg/cluster/clusterName.go
  26. 6
      pkg/cluster/host.go
  27. 4
      pkg/cluster/kubeconfig.go
  28. 4
      pkg/cluster/loadbalancer.go
  29. 4
      pkg/cluster/node.go
  30. 2
      pkg/runtimes/containerd/kubeconfig.go
  31. 2
      pkg/runtimes/containerd/node.go
  32. 2
      pkg/runtimes/containerd/util.go
  33. 2
      pkg/runtimes/docker/container.go
  34. 2
      pkg/runtimes/docker/kubeconfig.go
  35. 2
      pkg/runtimes/docker/network.go
  36. 2
      pkg/runtimes/docker/node.go
  37. 2
      pkg/runtimes/docker/translate.go
  38. 2
      pkg/runtimes/docker/translate_test.go
  39. 2
      pkg/runtimes/docker/util.go
  40. 2
      pkg/runtimes/docker/volume.go
  41. 6
      pkg/runtimes/runtime.go
  42. 8
      pkg/tools/tools.go

@ -57,7 +57,7 @@ PKG := $(shell go mod vendor)
TAGS :=
TESTS := ./...
TESTFLAGS :=
LDFLAGS := -w -s -X github.com/rancher/k3d/v3/version.Version=${GIT_TAG} -X github.com/rancher/k3d/v3/version.K3sVersion=${K3S_TAG}
LDFLAGS := -w -s -X github.com/rancher/k3d/v4/version.Version=${GIT_TAG} -X github.com/rancher/k3d/v4/version.K3sVersion=${K3S_TAG}
GCFLAGS :=
GOFLAGS :=
BINDIR := $(CURDIR)/bin
@ -66,7 +66,7 @@ BINARIES := k3d
# Set version of the k3d helper images for build
ifneq ($(K3D_HELPER_VERSION),)
$(info [INFO] Helper Image version set to ${K3D_HELPER_VERSION})
LDFLAGS += -X github.com/rancher/k3d/v3/version.HelperVersionOverride=${K3D_HELPER_VERSION}
LDFLAGS += -X github.com/rancher/k3d/v4/version.HelperVersionOverride=${K3D_HELPER_VERSION}
endif
# Rules for finding all go source files using 'DIRS' and 'REC_DIRS'

@ -4,7 +4,7 @@
[![License](https://img.shields.io/github/license/rancher/k3d?style=flat-square)](./LICENSE.md)
![Downloads](https://img.shields.io/github/downloads/rancher/k3d/total.svg?style=flat-square)
[![Go Module](https://img.shields.io/badge/Go%20Module-github.com%2Francher%2Fk3d%2Fv3-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/rancher/k3d/v3)
[![Go Module](https://img.shields.io/badge/Go%20Module-github.com%2Francher%2Fk3d%2Fv3-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/rancher/k3d/v4)
[![Go version](https://img.shields.io/github/go-mod/go-version/rancher/k3d?logo=go&logoColor=white&style=flat-square)](./go.mod)
[![Go Report Card](https://goreportcard.com/badge/github.com/rancher/k3d?style=flat-square)](https://goreportcard.com/report/github.com/rancher/k3d)
@ -64,7 +64,7 @@ or...
## Build
1. Clone this repo, e.g. via `git clone git@github.com:rancher/k3d.git` or `go get github.com/rancher/k3d/v3@main`
1. Clone this repo, e.g. via `git clone git@github.com:rancher/k3d.git` or `go get github.com/rancher/k3d/v4@main`
2. Inside the repo run
- 'make install-tools' to make sure required go packages are installed
3. Inside the repo run one of the following commands

@ -30,12 +30,12 @@ import (
"github.com/spf13/cobra"
cliutil "github.com/rancher/k3d/v3/cmd/util"
"github.com/rancher/k3d/v3/pkg/cluster"
k3dCluster "github.com/rancher/k3d/v3/pkg/cluster"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v3/version"
cliutil "github.com/rancher/k3d/v4/cmd/util"
"github.com/rancher/k3d/v4/pkg/cluster"
k3dCluster "github.com/rancher/k3d/v4/pkg/cluster"
"github.com/rancher/k3d/v4/pkg/runtimes"
k3d "github.com/rancher/k3d/v4/pkg/types"
"github.com/rancher/k3d/v4/version"
log "github.com/sirupsen/logrus"
)

@ -26,11 +26,11 @@ import (
"os"
"path"
"github.com/rancher/k3d/v3/cmd/util"
"github.com/rancher/k3d/v3/pkg/cluster"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3dutil "github.com/rancher/k3d/v3/pkg/util"
"github.com/rancher/k3d/v4/cmd/util"
"github.com/rancher/k3d/v4/pkg/cluster"
"github.com/rancher/k3d/v4/pkg/runtimes"
k3d "github.com/rancher/k3d/v4/pkg/types"
k3dutil "github.com/rancher/k3d/v4/pkg/util"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"

@ -28,10 +28,10 @@ import (
"os"
"strings"
"github.com/rancher/k3d/v3/cmd/util"
k3cluster "github.com/rancher/k3d/v3/pkg/cluster"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v4/cmd/util"
k3cluster "github.com/rancher/k3d/v4/pkg/cluster"
"github.com/rancher/k3d/v4/pkg/runtimes"
k3d "github.com/rancher/k3d/v4/pkg/types"
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"

@ -24,13 +24,13 @@ package cluster
import (
"time"
"github.com/rancher/k3d/v3/cmd/util"
"github.com/rancher/k3d/v3/pkg/cluster"
"github.com/rancher/k3d/v3/pkg/runtimes"
"github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v4/cmd/util"
"github.com/rancher/k3d/v4/pkg/cluster"
"github.com/rancher/k3d/v4/pkg/runtimes"
"github.com/rancher/k3d/v4/pkg/types"
"github.com/spf13/cobra"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
)

@ -24,10 +24,10 @@ package cluster
import (
"github.com/spf13/cobra"
"github.com/rancher/k3d/v3/cmd/util"
"github.com/rancher/k3d/v3/pkg/cluster"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v4/cmd/util"
"github.com/rancher/k3d/v4/pkg/cluster"
"github.com/rancher/k3d/v4/pkg/runtimes"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
)

@ -26,10 +26,10 @@ import (
"github.com/spf13/cobra"
"github.com/rancher/k3d/v3/cmd/util"
"github.com/rancher/k3d/v3/pkg/runtimes"
"github.com/rancher/k3d/v3/pkg/tools"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v4/cmd/util"
"github.com/rancher/k3d/v4/pkg/runtimes"
"github.com/rancher/k3d/v4/pkg/tools"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
)

@ -25,10 +25,10 @@ import (
"fmt"
"os"
"github.com/rancher/k3d/v3/cmd/util"
"github.com/rancher/k3d/v3/pkg/cluster"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v4/cmd/util"
"github.com/rancher/k3d/v4/pkg/cluster"
"github.com/rancher/k3d/v4/pkg/runtimes"
k3d "github.com/rancher/k3d/v4/pkg/types"
"github.com/spf13/cobra"
log "github.com/sirupsen/logrus"

@ -27,11 +27,11 @@ import (
"path"
"strings"
"github.com/rancher/k3d/v3/cmd/util"
"github.com/rancher/k3d/v3/pkg/cluster"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3dutil "github.com/rancher/k3d/v3/pkg/util"
"github.com/rancher/k3d/v4/cmd/util"
"github.com/rancher/k3d/v4/pkg/cluster"
"github.com/rancher/k3d/v4/pkg/runtimes"
k3d "github.com/rancher/k3d/v4/pkg/types"
k3dutil "github.com/rancher/k3d/v4/pkg/util"
"github.com/spf13/cobra"
"k8s.io/client-go/tools/clientcmd"

@ -27,11 +27,11 @@ import (
"github.com/spf13/cobra"
"github.com/rancher/k3d/v3/cmd/util"
k3dc "github.com/rancher/k3d/v3/pkg/cluster"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v3/version"
"github.com/rancher/k3d/v4/cmd/util"
k3dc "github.com/rancher/k3d/v4/pkg/cluster"
"github.com/rancher/k3d/v4/pkg/runtimes"
k3d "github.com/rancher/k3d/v4/pkg/types"
"github.com/rancher/k3d/v4/version"
log "github.com/sirupsen/logrus"
)

@ -22,10 +22,10 @@ THE SOFTWARE.
package node
import (
"github.com/rancher/k3d/v3/cmd/util"
"github.com/rancher/k3d/v3/pkg/cluster"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v4/cmd/util"
"github.com/rancher/k3d/v4/pkg/cluster"
"github.com/rancher/k3d/v4/pkg/runtimes"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

@ -28,10 +28,10 @@ import (
"strings"
"github.com/liggitt/tabwriter"
"github.com/rancher/k3d/v3/cmd/util"
"github.com/rancher/k3d/v3/pkg/cluster"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v4/cmd/util"
"github.com/rancher/k3d/v4/pkg/cluster"
"github.com/rancher/k3d/v4/pkg/runtimes"
k3d "github.com/rancher/k3d/v4/pkg/types"
"github.com/spf13/cobra"
log "github.com/sirupsen/logrus"

@ -22,9 +22,9 @@ THE SOFTWARE.
package node
import (
"github.com/rancher/k3d/v3/cmd/util"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v4/cmd/util"
"github.com/rancher/k3d/v4/pkg/runtimes"
k3d "github.com/rancher/k3d/v4/pkg/types"
"github.com/spf13/cobra"
log "github.com/sirupsen/logrus"

@ -22,11 +22,11 @@ THE SOFTWARE.
package node
import (
"github.com/rancher/k3d/v3/cmd/util"
"github.com/rancher/k3d/v3/pkg/runtimes"
"github.com/rancher/k3d/v4/cmd/util"
"github.com/rancher/k3d/v4/pkg/runtimes"
"github.com/spf13/cobra"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
)

@ -31,13 +31,13 @@ import (
"github.com/spf13/cobra"
"github.com/rancher/k3d/v3/cmd/cluster"
"github.com/rancher/k3d/v3/cmd/image"
"github.com/rancher/k3d/v3/cmd/kubeconfig"
"github.com/rancher/k3d/v3/cmd/node"
cliutil "github.com/rancher/k3d/v3/cmd/util"
"github.com/rancher/k3d/v3/pkg/runtimes"
"github.com/rancher/k3d/v3/version"
"github.com/rancher/k3d/v4/cmd/cluster"
"github.com/rancher/k3d/v4/cmd/image"
"github.com/rancher/k3d/v4/cmd/kubeconfig"
"github.com/rancher/k3d/v4/cmd/node"
cliutil "github.com/rancher/k3d/v4/cmd/util"
"github.com/rancher/k3d/v4/pkg/runtimes"
"github.com/rancher/k3d/v4/version"
log "github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/writer"
)

@ -25,9 +25,9 @@ import (
"context"
"strings"
k3dcluster "github.com/rancher/k3d/v3/pkg/cluster"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3dcluster "github.com/rancher/k3d/v4/pkg/cluster"
"github.com/rancher/k3d/v4/pkg/runtimes"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

@ -28,9 +28,9 @@ import (
log "github.com/sirupsen/logrus"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
"github.com/rancher/k3d/v3/pkg/util"
"github.com/rancher/k3d/v4/pkg/util"
"regexp"
)

@ -28,7 +28,7 @@ import (
"os/exec"
"strings"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
)
// HandlePlugin takes care of finding and executing a plugin based on the longest prefix

@ -27,7 +27,7 @@ import (
"strconv"
"strings"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
)

@ -26,7 +26,7 @@ import (
"os"
"strings"
"github.com/rancher/k3d/v3/pkg/runtimes"
"github.com/rancher/k3d/v4/pkg/runtimes"
log "github.com/sirupsen/logrus"
)

@ -1,4 +1,4 @@
module github.com/rancher/k3d/v3
module github.com/rancher/k3d/v4
go 1.14

@ -21,7 +21,7 @@ THE SOFTWARE.
*/
package main
import "github.com/rancher/k3d/v3/cmd"
import "github.com/rancher/k3d/v4/cmd"
func main() {
cmd.Execute()

@ -34,12 +34,12 @@ import (
gort "runtime"
"github.com/imdario/mergo"
k3drt "github.com/rancher/k3d/v3/pkg/runtimes"
"github.com/rancher/k3d/v3/pkg/runtimes/docker"
"github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v3/pkg/util"
"github.com/rancher/k3d/v3/version"
k3drt "github.com/rancher/k3d/v4/pkg/runtimes"
"github.com/rancher/k3d/v4/pkg/runtimes/docker"
"github.com/rancher/k3d/v4/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
"github.com/rancher/k3d/v4/pkg/util"
"github.com/rancher/k3d/v4/version"
log "github.com/sirupsen/logrus"
"golang.org/x/sync/errgroup"
)

@ -24,7 +24,7 @@ package cluster
import (
"fmt"
"github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v4/pkg/types"
)
// CheckName ensures that a cluster name is also a valid host name according to RFC 1123.

@ -29,9 +29,9 @@ import (
"regexp"
"runtime"
rt "github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v3/pkg/util"
rt "github.com/rancher/k3d/v4/pkg/runtimes"
k3d "github.com/rancher/k3d/v4/pkg/types"
"github.com/rancher/k3d/v4/pkg/util"
log "github.com/sirupsen/logrus"
)

@ -30,8 +30,8 @@ import (
"path"
"time"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v4/pkg/runtimes"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
"k8s.io/client-go/tools/clientcmd"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"

@ -26,8 +26,8 @@ import (
"fmt"
"strings"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v4/pkg/runtimes"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
)

@ -30,8 +30,8 @@ import (
"time"
"github.com/imdario/mergo"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v4/pkg/runtimes"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
"golang.org/x/sync/errgroup"
)

@ -26,7 +26,7 @@ import (
"context"
"io"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
)
// GetKubeconfig grabs the kubeconfig from inside a k3d node

@ -30,7 +30,7 @@ import (
"github.com/containerd/containerd"
"github.com/containerd/containerd/containers"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
)

@ -24,7 +24,7 @@ package containerd
import (
"context"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
)
// CopyToNode copies a file from the local FS to the selected node

@ -33,7 +33,7 @@ import (
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/client"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
)

@ -27,7 +27,7 @@ import (
"io"
"github.com/docker/docker/client"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
)

@ -30,7 +30,7 @@ import (
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/client"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
)

@ -33,7 +33,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/client"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
)

@ -31,7 +31,7 @@ import (
docker "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/network"
"github.com/docker/go-connections/nat"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
dockercliopts "github.com/docker/cli/opts"

@ -30,7 +30,7 @@ import (
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/network"
"github.com/docker/go-connections/nat"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
)
func TestTranslateNodeToContainer(t *testing.T) {

@ -29,7 +29,7 @@ import (
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/client"
"github.com/docker/docker/pkg/archive"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
)

@ -28,7 +28,7 @@ import (
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/volume"
"github.com/docker/docker/client"
k3d "github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v4/pkg/types"
log "github.com/sirupsen/logrus"
)

@ -29,9 +29,9 @@ import (
"net"
"time"
"github.com/rancher/k3d/v3/pkg/runtimes/containerd"
"github.com/rancher/k3d/v3/pkg/runtimes/docker"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v4/pkg/runtimes/containerd"
"github.com/rancher/k3d/v4/pkg/runtimes/docker"
k3d "github.com/rancher/k3d/v4/pkg/types"
)
// SelectedRuntime is a runtime (pun intended) variable determining the selected runtime

@ -30,10 +30,10 @@ import (
"sync"
"time"
k3dc "github.com/rancher/k3d/v3/pkg/cluster"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v3/version"
k3dc "github.com/rancher/k3d/v4/pkg/cluster"
"github.com/rancher/k3d/v4/pkg/runtimes"
k3d "github.com/rancher/k3d/v4/pkg/types"
"github.com/rancher/k3d/v4/version"
log "github.com/sirupsen/logrus"
)

Loading…
Cancel
Save