Skip to content

Commit

Permalink
feat(autok3s): upgrade k3d version to v5.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
orangedeng authored and JacieChao committed Jan 4, 2023
1 parent 798896b commit f881cb7
Show file tree
Hide file tree
Showing 10 changed files with 469 additions and 1,505 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.dapper
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM registry.suse.com/bci/golang:1.19
ARG PROXY
ARG GOPROXY
RUN zypper -n install netcat wget curl
RUN zypper -n install netcat wget curl gawk
RUN zypper install -y -f docker
## install golangci-lint
RUN if [ "$(go env GOARCH)" = "amd64" ]; then \
Expand Down
2 changes: 1 addition & 1 deletion cmd/explorer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"github.com/cnrancher/autok3s/pkg/common"

k3dutil "github.com/rancher/k3d/v5/cmd/util"
k3dutil "github.com/k3d-io/k3d/v5/cmd/util"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 2 additions & 0 deletions docs/i18n/en_us/harvester/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Harvester Provider

> Harvester provider is only supported in autok3s <= v0.6.1.
## Introduction

This article provides users with the instructions to create and launch a K3s cluster using Harvester VMs, and to add nodes for an existing K3s cluster on Harvester VMs. In addition, this article provides guidance of advanced usages of running K3s on Harvester VM, such as setting up private registry, and enabling UI components.
Expand Down
226 changes: 82 additions & 144 deletions go.mod

Large diffs are not rendered by default.

1,680 changes: 340 additions & 1,340 deletions go.sum

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion hack/make-rules/autok3s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ function build() {
ui
go_generate
autok3s::log::info "building autok3s(${GIT_VERSION},${GIT_COMMIT},${GIT_TREE_STATE},${BUILD_DATE})..."
# TODO default k3s version in k3d should also get from k3d in
local K3D_VERSION=`go list -m all | grep k3d/v5 | awk '{print $2}'`
local K3S_TAG=`curl --silent --retry 3 "https://update.k3s.io/v1-release/channels/stable" | egrep -o '/v[^ ]+"' | sed -E 's/\/|\"//g' | sed -E 's/\+/\-/'`

local version_flags="
-X main.gitVersion=${GIT_VERSION}
Expand All @@ -77,7 +80,9 @@ function build() {
-X k8s.io/component-base/version.gitVersion=${GIT_VERSION}
-X k8s.io/component-base/version.gitCommit=${GIT_COMMIT}
-X k8s.io/component-base/version.gitTreeState=${GIT_TREE_STATE}
-X k8s.io/component-base/version.buildDate=${BUILD_DATE}"
-X k8s.io/component-base/version.buildDate=${BUILD_DATE}
-X github.com/k3d-io/k3d/v5/version.Version=${K3D_VERSION:-v5.4.4}
-X github.com/k3d-io/k3d/v5/version.K3sVersion=${K3S_TAG}"
local flags="
-w -s"
local ext_flags="
Expand Down
2 changes: 1 addition & 1 deletion pkg/common/explorer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os/exec"
"path/filepath"

k3dutil "github.com/rancher/k3d/v5/cmd/util"
k3dutil "github.com/k3d-io/k3d/v5/cmd/util"
"github.com/sirupsen/logrus"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/hosts/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
"github.com/docker/docker/client"
"github.com/docker/docker/pkg/ioutils"
dockerSig "github.com/docker/docker/pkg/signal"
dockerutils "github.com/k3d-io/k3d/v5/pkg/runtimes/docker"
k3dtypes "github.com/k3d-io/k3d/v5/pkg/types"
"github.com/moby/term"
dockerutils "github.com/rancher/k3d/v5/pkg/runtimes/docker"
k3dtypes "github.com/rancher/k3d/v5/pkg/types"
"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/util/wait"
)
Expand Down
33 changes: 18 additions & 15 deletions pkg/providers/k3d/k3d.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,38 @@ import (
dockertypes "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
dockerunits "github.com/docker/go-units"
cliutil "github.com/k3d-io/k3d/v5/cmd/util"
k3dutil "github.com/k3d-io/k3d/v5/cmd/util"
"github.com/k3d-io/k3d/v5/pkg/client"
"github.com/k3d-io/k3d/v5/pkg/config"
k3dtypes "github.com/k3d-io/k3d/v5/pkg/config/types"
k3dconf "github.com/k3d-io/k3d/v5/pkg/config/v1alpha4"
k3dlogger "github.com/k3d-io/k3d/v5/pkg/logger"
"github.com/k3d-io/k3d/v5/pkg/runtimes"
dockerutils "github.com/k3d-io/k3d/v5/pkg/runtimes/docker"
k3d "github.com/k3d-io/k3d/v5/pkg/types"
k3dversion "github.com/k3d-io/k3d/v5/version"
"github.com/moby/term"
cliutil "github.com/rancher/k3d/v5/cmd/util"
k3dutil "github.com/rancher/k3d/v5/cmd/util"
"github.com/rancher/k3d/v5/pkg/client"
"github.com/rancher/k3d/v5/pkg/config"
k3dtypes "github.com/rancher/k3d/v5/pkg/config/types"
k3dconf "github.com/rancher/k3d/v5/pkg/config/v1alpha3"
k3dlogger "github.com/rancher/k3d/v5/pkg/logger"
"github.com/rancher/k3d/v5/pkg/runtimes"
dockerutils "github.com/rancher/k3d/v5/pkg/runtimes/docker"
k3d "github.com/rancher/k3d/v5/pkg/types"
k3dversion "github.com/rancher/k3d/v5/version"
"k8s.io/client-go/tools/clientcmd"
)

const (
providerName = "k3d"

k3dVersion = "5.2.2"
k3dImage = "rancher/k3s:v1.21.7-k3s1"
k3dAPIPort = "0.0.0.0:0"
)

var (
k3dImage = fmt.Sprintf("%s:%s", k3d.DefaultK3sImageRepo, k3dversion.K3sVersion)
)

// K3d provider k3d struct.
type K3d struct {
*cluster.ProviderBase `json:",inline"`
typesk3d.Options `json:",inline"`
}

func init() {
k3dversion.Version = k3dVersion
providers.RegisterProvider(providerName, func() (providers.Provider, error) {
return newProvider(), nil
})
Expand Down Expand Up @@ -622,7 +623,9 @@ func (p *K3d) wrapCliFlags(masters, workers int) (*k3dconf.ClusterConfig, error)
APIVersion: config.DefaultConfigApiVersion,
Kind: "Simple",
},
Name: p.Name,
ObjectMeta: k3dtypes.ObjectMeta{
Name: p.Name,
},
Servers: masters,
Agents: workers,
ClusterToken: p.Token,
Expand Down
16 changes: 16 additions & 0 deletions pkg/providers/k3d/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//go:build !prod

package k3d

import (
"fmt"

k3d "github.com/k3d-io/k3d/v5/pkg/types"
k3dversion "github.com/k3d-io/k3d/v5/version"
)

func init() {
k3dversion.Version = "v5.4.4"
k3dversion.K3sVersion = "v1.23.8-k3s1"
k3dImage = fmt.Sprintf("%s:%s", k3d.DefaultK3sImageRepo, k3dversion.K3sVersion)
}

0 comments on commit f881cb7

Please sign in to comment.