Skip to content

Commit

Permalink
update cri and containerd and add node-name flag to init
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Balogh <[email protected]>
  • Loading branch information
pbalogh-sa committed Oct 3, 2022
1 parent 4db691b commit 68ada07
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 16 deletions.
3 changes: 3 additions & 0 deletions cmd/pke/app/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ const (
// FlagClusterName cluster name
FlagClusterName = "kubernetes-cluster-name"

// FlagNodeName nodename for init
FlagNodeName = "kubernetes-node-name"

// FlagOIDCIssuerURL OIDC issuer URL
FlagOIDCIssuerURL = "kubernetes-oidc-issuer-url"
// FlagOIDCClientID OIDC client ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ func certificateAutoApproverTemplate() string {
" fieldRef:\n" +
" fieldPath: metadata.name\n" +
" - name: OPERATOR_NAME\n" +
" value: \"auto-approver\"\n"
" value: \"auto-approver\""
return tmpl
}
21 changes: 17 additions & 4 deletions cmd/pke/app/phases/kubeadm/controlplane/controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ import (

"emperror.dev/errors"
"github.com/Masterminds/semver"
"github.com/lestrrat-go/backoff"
"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/banzaicloud/pke/.gen/pipeline"
"github.com/banzaicloud/pke/cmd/pke/app/config"
"github.com/banzaicloud/pke/cmd/pke/app/constants"
Expand All @@ -47,9 +51,6 @@ import (
"github.com/banzaicloud/pke/cmd/pke/app/util/runner"
"github.com/banzaicloud/pke/cmd/pke/app/util/transport"
"github.com/banzaicloud/pke/cmd/pke/app/util/validator"
"github.com/lestrrat-go/backoff"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

const (
Expand Down Expand Up @@ -92,6 +93,7 @@ type ControlPlane struct {
advertiseAddress string
apiServerHostPort string
clusterName string
nodeName string
serviceCIDR string
podNetworkCIDR string
mtu uint
Expand Down Expand Up @@ -179,6 +181,8 @@ func (c *ControlPlane) RegisterFlags(flags *pflag.FlagSet) {
flags.Uint(constants.FlagMTU, 0, "maximum transmission unit. 0 means default value of the Kubernetes network provider is used")
// Kubernetes cluster name
flags.String(constants.FlagClusterName, "pke", "Kubernetes cluster name")
// Kubernetes kubadm init node name
flags.String(constants.FlagNodeName, "", "Kubernetes kubeadm node name for init")
// Kubernetes certificates
flags.StringSlice(constants.FlagAPIServerCertSANs, []string{}, "sets extra Subject Alternative Names for the API Server signing cert")
flags.String(constants.FlagControllerManagerSigningCA, "", "Kubernetes Controller Manager signing cert")
Expand Down Expand Up @@ -504,7 +508,7 @@ func (c *ControlPlane) Run(out io.Writer) error {
single = true
}
// TODO get cilium version from flag
version := "v1.9.1"
version := "v1.11.1"
if err := installCilium(out, kubeConfig, c.podNetworkCIDR, c.imageRepository, version, c.mtu, single); err != nil {
return err
}
Expand Down Expand Up @@ -627,6 +631,10 @@ func (c *ControlPlane) masterBootstrapParameters(cmd *cobra.Command) (err error)
if err != nil {
return
}
c.nodeName, err = cmd.Flags().GetString(constants.FlagNodeName)
if err != nil {
return
}
c.oidcIssuerURL, err = cmd.Flags().GetString(constants.FlagOIDCIssuerURL)
if err != nil {
return
Expand Down Expand Up @@ -858,6 +866,11 @@ func (c *ControlPlane) installMaster(out io.Writer) error {
"init",
"--config=" + kubeadmConfig,
}

if c.cloudProvider == constants.CloudProviderAmazon && c.nodeName != "" {
args = append(args, "--node-name="+c.nodeName)
}

_, err = runner.Cmd(out, cmdKubeadm, args...).CombinedOutputAsync()
if err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion cmd/pke/app/phases/kubeadm/controlplane/controlplane_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import (
"testing"
"time"

"github.com/banzaicloud/pke/cmd/pke/app/constants"
"github.com/stretchr/testify/require"

"github.com/banzaicloud/pke/cmd/pke/app/constants"
)

func TestWriteKubeadmConfig(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion cmd/pke/app/phases/kubeadm/node/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ import (

"emperror.dev/errors"
"github.com/Masterminds/semver"
"github.com/pbnjay/memory"

"github.com/banzaicloud/pke/cmd/pke/app/phases/kubeadm"
"github.com/banzaicloud/pke/cmd/pke/app/util/cri"
"github.com/banzaicloud/pke/cmd/pke/app/util/file"
"github.com/banzaicloud/pke/cmd/pke/app/util/kubernetes"
"github.com/pbnjay/memory"
)

//go:generate templify -t ${GOTMPL} -p node -f kubeadmConfigV1Beta2 kubeadm_v1beta2.yaml.tmpl
Expand Down
5 changes: 3 additions & 2 deletions cmd/pke/app/phases/pipeline/ready/ready.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ import (
"os"

"emperror.dev/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/banzaicloud/pke/.gen/pipeline"
"github.com/banzaicloud/pke/cmd/pke/app/constants"
"github.com/banzaicloud/pke/cmd/pke/app/phases"
"github.com/banzaicloud/pke/cmd/pke/app/util/network"
pipelineutil "github.com/banzaicloud/pke/cmd/pke/app/util/pipeline"
"github.com/banzaicloud/pke/cmd/pke/app/util/validator"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

const (
Expand Down
9 changes: 5 additions & 4 deletions cmd/pke/app/phases/runtime/container/containerd_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ import (
"text/template"

"emperror.dev/errors"

"github.com/banzaicloud/pke/cmd/pke/app/util/file"
"github.com/banzaicloud/pke/cmd/pke/app/util/linux"
)

const (
containerdVersion = "1.5.9"
containerdSHA256 = "f64c8e3b736b370c963b08c33ac70f030fc311bc48fcfd00461465af2fff3488"
containerdVersion = "1.6.8"
containerdSHA256 = "8e227caa318faa136e4387ffd6f96baeaad5582d176202fe9da69cde87036033"
containerdURL = "https://github.com/containerd/containerd/releases/download/v%s/cri-containerd-cni-%s-linux-amd64.tar.gz"
containerdVersionPath = "/opt/containerd/cluster/version"
containerdConf = "/etc/containerd/config.toml"
Expand Down Expand Up @@ -108,8 +109,8 @@ func installContainerd(out io.Writer, imageRepository string) error {
return errors.Wrapf(err, "unable to create temporary file: %q", f.Name())
}
defer func() { _ = f.Close() }()
// export CONTAINERD_VERSION="1.5.9"
// export CONTAINERD_SHA256="f64c8e3b736b370c963b08c33ac70f030fc311bc48fcfd00461465af2fff3488"
// export CONTAINERD_VERSION="1.6.8"
// export CONTAINERD_SHA256="8e227caa318faa136e4387ffd6f96baeaad5582d176202fe9da69cde87036033"
// wget https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION}/cri-containerd-cni-${CONTAINERD_VERSION}-linux-amd64.tar.gz
dl := fmt.Sprintf(containerdURL, containerdVersion, containerdVersion)
u, err := url.Parse(dl)
Expand Down
3 changes: 2 additions & 1 deletion cmd/pke/app/util/linux/apt.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"strings"

"emperror.dev/errors"

"github.com/banzaicloud/pke/cmd/pke/app/util/file"
"github.com/banzaicloud/pke/cmd/pke/app/util/runner"
)
Expand Down Expand Up @@ -140,7 +141,7 @@ func mapAptPackageVersion(pkg, kubernetesVersion string) string {
return "kubelet=" + getAptPackageVersion(kubernetesVersion)

case kubernetescni:
return "kubernetes-cni=0.8.7-00"
return "kubernetes-cni=1.1.1-00"

default:
return ""
Expand Down
3 changes: 2 additions & 1 deletion cmd/pke/app/util/linux/rpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"strings"

"emperror.dev/errors"

"github.com/banzaicloud/pke/cmd/pke/app/util/runner"
)

Expand All @@ -28,7 +29,7 @@ const (
kubectl = "kubectl"
kubelet = "kubelet"
kubernetescni = "kubernetes-cni"
kubernetesCNIVersion = "0.8.7"
kubernetesCNIVersion = "1.1.1"
disableExcludesKubernetes = "--disableexcludes=kubernetes"
selinuxConfig = "/etc/selinux/config"
)
Expand Down
3 changes: 2 additions & 1 deletion cmd/pke/app/util/pipeline/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import (
"os"
"time"

"github.com/spf13/cobra"

"github.com/banzaicloud/pke/.gen/pipeline"
"github.com/banzaicloud/pke/cmd/pke/app/constants"
"github.com/spf13/cobra"
)

type pipelineStatusReporter struct {
Expand Down

0 comments on commit 68ada07

Please sign in to comment.