Go Module: use v3 for go module compatibility

pull/287/head
iwilltry42 4 years ago
parent 83b84071f6
commit 76d90478f5
No known key found for this signature in database
GPG Key ID: 7BA57AD1CFF16110
  1. 2
      Makefile
  2. 2
      README.md
  3. 12
      cmd/create/createCluster.go
  4. 10
      cmd/create/createNode.go
  5. 8
      cmd/delete/deleteCluster.go
  6. 8
      cmd/delete/deleteNode.go
  7. 8
      cmd/get/getCluster.go
  8. 8
      cmd/get/getKubeconfig.go
  9. 8
      cmd/get/getNode.go
  10. 8
      cmd/load/loadImage.go
  11. 16
      cmd/root.go
  12. 10
      cmd/start/startCluster.go
  13. 6
      cmd/start/startNode.go
  14. 8
      cmd/stop/stopCluster.go
  15. 6
      cmd/stop/stopNode.go
  16. 6
      cmd/util/completion.go
  17. 2
      cmd/util/filter.go
  18. 2
      cmd/util/ports.go
  19. 2
      cmd/util/volumes.go
  20. 2
      go.mod
  21. 2
      main.go
  22. 10
      pkg/cluster/cluster.go
  23. 2
      pkg/cluster/clusterName.go
  24. 4
      pkg/cluster/kubeconfig.go
  25. 4
      pkg/cluster/loadbalancer.go
  26. 4
      pkg/cluster/node.go
  27. 2
      pkg/runtimes/containerd/kubeconfig.go
  28. 2
      pkg/runtimes/containerd/node.go
  29. 2
      pkg/runtimes/containerd/util.go
  30. 2
      pkg/runtimes/docker/container.go
  31. 2
      pkg/runtimes/docker/kubeconfig.go
  32. 2
      pkg/runtimes/docker/network.go
  33. 2
      pkg/runtimes/docker/node.go
  34. 2
      pkg/runtimes/docker/translate.go
  35. 2
      pkg/runtimes/docker/translate_test.go
  36. 2
      pkg/runtimes/docker/util.go
  37. 2
      pkg/runtimes/docker/volume.go
  38. 6
      pkg/runtimes/runtime.go
  39. 6
      pkg/tools/tools.go
  40. 4
      pkg/types/types.go

@ -55,7 +55,7 @@ PKG := $(shell go mod vendor)
TAGS :=
TESTS := .
TESTFLAGS :=
LDFLAGS := -w -s -X github.com/rancher/k3d/version.Version=${GIT_TAG} -X github.com/rancher/k3d/version.K3sVersion=${K3S_TAG}
LDFLAGS := -w -s -X github.com/rancher/k3d/v3/version.Version=${GIT_TAG} -X github.com/rancher/k3d/v3/version.K3sVersion=${K3S_TAG}
GCFLAGS :=
GOFLAGS :=
BINDIR := $(CURDIR)/bin

@ -56,7 +56,7 @@ or...
## Build
1. Clone this repo, e.g. via `go get -u github.com/rancher/k3d`
1. Clone this repo, e.g. via `git clone git@github.com:rancher/k3d.git` or `go get github.com/rancher/k3d/v3@master`
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/cmd/util"
"github.com/rancher/k3d/pkg/cluster"
k3dCluster "github.com/rancher/k3d/pkg/cluster"
"github.com/rancher/k3d/pkg/runtimes"
k3d "github.com/rancher/k3d/pkg/types"
"github.com/rancher/k3d/version"
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"
log "github.com/sirupsen/logrus"
)

@ -27,11 +27,11 @@ import (
"github.com/spf13/cobra"
"github.com/rancher/k3d/cmd/util"
k3dc "github.com/rancher/k3d/pkg/cluster"
"github.com/rancher/k3d/pkg/runtimes"
k3d "github.com/rancher/k3d/pkg/types"
"github.com/rancher/k3d/version"
"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"
log "github.com/sirupsen/logrus"
)

@ -22,10 +22,10 @@ THE SOFTWARE.
package delete
import (
"github.com/rancher/k3d/cmd/util"
"github.com/rancher/k3d/pkg/cluster"
"github.com/rancher/k3d/pkg/runtimes"
k3d "github.com/rancher/k3d/pkg/types"
"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"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"

@ -22,10 +22,10 @@ THE SOFTWARE.
package delete
import (
"github.com/rancher/k3d/cmd/util"
"github.com/rancher/k3d/pkg/cluster"
"github.com/rancher/k3d/pkg/runtimes"
k3d "github.com/rancher/k3d/pkg/types"
"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"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

@ -27,10 +27,10 @@ import (
"os"
"strings"
"github.com/rancher/k3d/cmd/util"
k3cluster "github.com/rancher/k3d/pkg/cluster"
"github.com/rancher/k3d/pkg/runtimes"
k3d "github.com/rancher/k3d/pkg/types"
"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/spf13/cobra"
log "github.com/sirupsen/logrus"

@ -25,10 +25,10 @@ import (
"fmt"
"os"
"github.com/rancher/k3d/cmd/util"
"github.com/rancher/k3d/pkg/cluster"
"github.com/rancher/k3d/pkg/runtimes"
k3d "github.com/rancher/k3d/pkg/types"
"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/spf13/cobra"
"k8s.io/client-go/tools/clientcmd"

@ -28,10 +28,10 @@ import (
"strings"
"github.com/liggitt/tabwriter"
"github.com/rancher/k3d/cmd/util"
"github.com/rancher/k3d/pkg/cluster"
"github.com/rancher/k3d/pkg/runtimes"
k3d "github.com/rancher/k3d/pkg/types"
"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/spf13/cobra"
log "github.com/sirupsen/logrus"

@ -24,10 +24,10 @@ package load
import (
"github.com/spf13/cobra"
"github.com/rancher/k3d/cmd/util"
"github.com/rancher/k3d/pkg/runtimes"
"github.com/rancher/k3d/pkg/tools"
k3d "github.com/rancher/k3d/pkg/types"
"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"
log "github.com/sirupsen/logrus"
)

@ -30,14 +30,14 @@ import (
"github.com/spf13/cobra"
"github.com/rancher/k3d/cmd/create"
"github.com/rancher/k3d/cmd/delete"
"github.com/rancher/k3d/cmd/get"
"github.com/rancher/k3d/cmd/load"
"github.com/rancher/k3d/cmd/start"
"github.com/rancher/k3d/cmd/stop"
"github.com/rancher/k3d/pkg/runtimes"
"github.com/rancher/k3d/version"
"github.com/rancher/k3d/v3/cmd/create"
"github.com/rancher/k3d/v3/cmd/delete"
"github.com/rancher/k3d/v3/cmd/get"
"github.com/rancher/k3d/v3/cmd/load"
"github.com/rancher/k3d/v3/cmd/start"
"github.com/rancher/k3d/v3/cmd/stop"
"github.com/rancher/k3d/v3/pkg/runtimes"
"github.com/rancher/k3d/v3/version"
log "github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/writer"

@ -24,13 +24,13 @@ package start
import (
"time"
"github.com/rancher/k3d/cmd/util"
"github.com/rancher/k3d/pkg/cluster"
"github.com/rancher/k3d/pkg/runtimes"
"github.com/rancher/k3d/pkg/types"
"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/spf13/cobra"
k3d "github.com/rancher/k3d/pkg/types"
k3d "github.com/rancher/k3d/v3/pkg/types"
log "github.com/sirupsen/logrus"
)

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

@ -24,10 +24,10 @@ package stop
import (
"github.com/spf13/cobra"
"github.com/rancher/k3d/cmd/util"
"github.com/rancher/k3d/pkg/cluster"
"github.com/rancher/k3d/pkg/runtimes"
k3d "github.com/rancher/k3d/pkg/types"
"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"
log "github.com/sirupsen/logrus"
)

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

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

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

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

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

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

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

@ -31,10 +31,10 @@ import (
"time"
"github.com/imdario/mergo"
k3drt "github.com/rancher/k3d/pkg/runtimes"
"github.com/rancher/k3d/pkg/types"
k3d "github.com/rancher/k3d/pkg/types"
"github.com/rancher/k3d/pkg/util"
k3drt "github.com/rancher/k3d/v3/pkg/runtimes"
"github.com/rancher/k3d/v3/pkg/types"
k3d "github.com/rancher/k3d/v3/pkg/types"
"github.com/rancher/k3d/v3/pkg/util"
log "github.com/sirupsen/logrus"
"golang.org/x/sync/errgroup"
)
@ -290,7 +290,7 @@ func CreateCluster(ctx context.Context, runtime k3drt.Runtime, cluster *k3d.Clus
// Create LB as a modified node with loadbalancerRole
lbNode := &k3d.Node{
Name: fmt.Sprintf("%s-%s-masterlb", k3d.DefaultObjectNamePrefix, cluster.Name),
Image: k3d.DefaultLBImage,
Image: k3d.DefaultLBImageRepo,
Ports: append(cluster.MasterLoadBalancer.Ports, fmt.Sprintf("%s:%s:%s/tcp", cluster.ExposeAPI.Host, cluster.ExposeAPI.Port, k3d.DefaultAPIPort)),
Env: []string{
fmt.Sprintf("SERVERS=%s", servers),

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

@ -30,8 +30,8 @@ import (
"path"
"time"
"github.com/rancher/k3d/pkg/runtimes"
k3d "github.com/rancher/k3d/pkg/types"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/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/pkg/runtimes"
k3d "github.com/rancher/k3d/pkg/types"
"github.com/rancher/k3d/v3/pkg/runtimes"
k3d "github.com/rancher/k3d/v3/pkg/types"
log "github.com/sirupsen/logrus"
)

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

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

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

@ -24,7 +24,7 @@ package containerd
import (
"context"
k3d "github.com/rancher/k3d/pkg/types"
k3d "github.com/rancher/k3d/v3/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/pkg/types"
k3d "github.com/rancher/k3d/v3/pkg/types"
log "github.com/sirupsen/logrus"
)

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

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

@ -32,7 +32,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/pkg/types"
k3d "github.com/rancher/k3d/v3/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/pkg/types"
k3d "github.com/rancher/k3d/v3/pkg/types"
log "github.com/sirupsen/logrus"
)

@ -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/pkg/types"
k3d "github.com/rancher/k3d/v3/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/pkg/types"
k3d "github.com/rancher/k3d/v3/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/pkg/types"
k3d "github.com/rancher/k3d/v3/pkg/types"
log "github.com/sirupsen/logrus"
)

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

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

@ -38,8 +38,8 @@ const DefaultClusterNameMaxLength = 32
// DefaultK3sImageRepo specifies the default image repository for the used k3s image
const DefaultK3sImageRepo = "docker.io/rancher/k3s"
// DefaultLBImage defines the default cluster load balancer image
const DefaultLBImage = "docker.io/iwilltry42/k3d-proxy:v0.0.3"
// DefaultLBImageRepo defines the default cluster load balancer image
const DefaultLBImageRepo = "docker.io/iwilltry42/k3d-proxy:v0.0.3"
// DefaultObjectNamePrefix defines the name prefix for every object created by k3d
const DefaultObjectNamePrefix = "k3d"

Loading…
Cancel
Save