Skip to content

Commit c90c27f

Browse files
authored
update cri and containerd and add node-name flag to init (#155)
Signed-off-by: Peter Balogh <[email protected]>
1 parent 4db691b commit c90c27f

File tree

10 files changed

+39
-16
lines changed

10 files changed

+39
-16
lines changed

cmd/pke/app/constants/constants.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ const (
103103
// FlagClusterName cluster name
104104
FlagClusterName = "kubernetes-cluster-name"
105105

106+
// FlagNodeName nodename for init
107+
FlagNodeName = "kubernetes-node-name"
108+
106109
// FlagOIDCIssuerURL OIDC issuer URL
107110
FlagOIDCIssuerURL = "kubernetes-oidc-issuer-url"
108111
// FlagOIDCClientID OIDC client ID

cmd/pke/app/phases/kubeadm/controlplane/certificate_auto_approver.yaml.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,6 @@ func certificateAutoApproverTemplate() string {
107107
" fieldRef:\n" +
108108
" fieldPath: metadata.name\n" +
109109
" - name: OPERATOR_NAME\n" +
110-
" value: \"auto-approver\"\n"
110+
" value: \"auto-approver\""
111111
return tmpl
112112
}

cmd/pke/app/phases/kubeadm/controlplane/controlplane.go

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ import (
3333

3434
"emperror.dev/errors"
3535
"github.com/Masterminds/semver"
36+
"github.com/lestrrat-go/backoff"
37+
"github.com/spf13/cobra"
38+
"github.com/spf13/pflag"
39+
3640
"github.com/banzaicloud/pke/.gen/pipeline"
3741
"github.com/banzaicloud/pke/cmd/pke/app/config"
3842
"github.com/banzaicloud/pke/cmd/pke/app/constants"
@@ -47,9 +51,6 @@ import (
4751
"github.com/banzaicloud/pke/cmd/pke/app/util/runner"
4852
"github.com/banzaicloud/pke/cmd/pke/app/util/transport"
4953
"github.com/banzaicloud/pke/cmd/pke/app/util/validator"
50-
"github.com/lestrrat-go/backoff"
51-
"github.com/spf13/cobra"
52-
"github.com/spf13/pflag"
5354
)
5455

5556
const (
@@ -92,6 +93,7 @@ type ControlPlane struct {
9293
advertiseAddress string
9394
apiServerHostPort string
9495
clusterName string
96+
nodeName string
9597
serviceCIDR string
9698
podNetworkCIDR string
9799
mtu uint
@@ -179,6 +181,8 @@ func (c *ControlPlane) RegisterFlags(flags *pflag.FlagSet) {
179181
flags.Uint(constants.FlagMTU, 0, "maximum transmission unit. 0 means default value of the Kubernetes network provider is used")
180182
// Kubernetes cluster name
181183
flags.String(constants.FlagClusterName, "pke", "Kubernetes cluster name")
184+
// Kubernetes kubadm init node name
185+
flags.String(constants.FlagNodeName, "", "Kubernetes kubeadm node name for init")
182186
// Kubernetes certificates
183187
flags.StringSlice(constants.FlagAPIServerCertSANs, []string{}, "sets extra Subject Alternative Names for the API Server signing cert")
184188
flags.String(constants.FlagControllerManagerSigningCA, "", "Kubernetes Controller Manager signing cert")
@@ -504,7 +508,7 @@ func (c *ControlPlane) Run(out io.Writer) error {
504508
single = true
505509
}
506510
// TODO get cilium version from flag
507-
version := "v1.9.1"
511+
version := "v1.11.1"
508512
if err := installCilium(out, kubeConfig, c.podNetworkCIDR, c.imageRepository, version, c.mtu, single); err != nil {
509513
return err
510514
}
@@ -627,6 +631,10 @@ func (c *ControlPlane) masterBootstrapParameters(cmd *cobra.Command) (err error)
627631
if err != nil {
628632
return
629633
}
634+
c.nodeName, err = cmd.Flags().GetString(constants.FlagNodeName)
635+
if err != nil {
636+
return
637+
}
630638
c.oidcIssuerURL, err = cmd.Flags().GetString(constants.FlagOIDCIssuerURL)
631639
if err != nil {
632640
return
@@ -858,6 +866,11 @@ func (c *ControlPlane) installMaster(out io.Writer) error {
858866
"init",
859867
"--config=" + kubeadmConfig,
860868
}
869+
870+
if c.cloudProvider == constants.CloudProviderAmazon && c.nodeName != "" {
871+
args = append(args, "--node-name="+c.nodeName)
872+
}
873+
861874
_, err = runner.Cmd(out, cmdKubeadm, args...).CombinedOutputAsync()
862875
if err != nil {
863876
return err

cmd/pke/app/phases/kubeadm/controlplane/controlplane_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ import (
2121
"testing"
2222
"time"
2323

24-
"github.com/banzaicloud/pke/cmd/pke/app/constants"
2524
"github.com/stretchr/testify/require"
25+
26+
"github.com/banzaicloud/pke/cmd/pke/app/constants"
2627
)
2728

2829
func TestWriteKubeadmConfig(t *testing.T) {

cmd/pke/app/phases/kubeadm/node/kubeadm.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ import (
2222

2323
"emperror.dev/errors"
2424
"github.com/Masterminds/semver"
25+
"github.com/pbnjay/memory"
26+
2527
"github.com/banzaicloud/pke/cmd/pke/app/phases/kubeadm"
2628
"github.com/banzaicloud/pke/cmd/pke/app/util/cri"
2729
"github.com/banzaicloud/pke/cmd/pke/app/util/file"
2830
"github.com/banzaicloud/pke/cmd/pke/app/util/kubernetes"
29-
"github.com/pbnjay/memory"
3031
)
3132

3233
//go:generate templify -t ${GOTMPL} -p node -f kubeadmConfigV1Beta2 kubeadm_v1beta2.yaml.tmpl

cmd/pke/app/phases/pipeline/ready/ready.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ import (
2323
"os"
2424

2525
"emperror.dev/errors"
26+
"github.com/spf13/cobra"
27+
"github.com/spf13/pflag"
28+
2629
"github.com/banzaicloud/pke/.gen/pipeline"
2730
"github.com/banzaicloud/pke/cmd/pke/app/constants"
2831
"github.com/banzaicloud/pke/cmd/pke/app/phases"
2932
"github.com/banzaicloud/pke/cmd/pke/app/util/network"
3033
pipelineutil "github.com/banzaicloud/pke/cmd/pke/app/util/pipeline"
3134
"github.com/banzaicloud/pke/cmd/pke/app/util/validator"
32-
"github.com/spf13/cobra"
33-
"github.com/spf13/pflag"
3435
)
3536

3637
const (

cmd/pke/app/phases/runtime/container/containerd_linux.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ import (
2323
"text/template"
2424

2525
"emperror.dev/errors"
26+
2627
"github.com/banzaicloud/pke/cmd/pke/app/util/file"
2728
"github.com/banzaicloud/pke/cmd/pke/app/util/linux"
2829
)
2930

3031
const (
31-
containerdVersion = "1.5.9"
32-
containerdSHA256 = "f64c8e3b736b370c963b08c33ac70f030fc311bc48fcfd00461465af2fff3488"
32+
containerdVersion = "1.6.8"
33+
containerdSHA256 = "8e227caa318faa136e4387ffd6f96baeaad5582d176202fe9da69cde87036033"
3334
containerdURL = "https://github.com/containerd/containerd/releases/download/v%s/cri-containerd-cni-%s-linux-amd64.tar.gz"
3435
containerdVersionPath = "/opt/containerd/cluster/version"
3536
containerdConf = "/etc/containerd/config.toml"
@@ -108,8 +109,8 @@ func installContainerd(out io.Writer, imageRepository string) error {
108109
return errors.Wrapf(err, "unable to create temporary file: %q", f.Name())
109110
}
110111
defer func() { _ = f.Close() }()
111-
// export CONTAINERD_VERSION="1.5.9"
112-
// export CONTAINERD_SHA256="f64c8e3b736b370c963b08c33ac70f030fc311bc48fcfd00461465af2fff3488"
112+
// export CONTAINERD_VERSION="1.6.8"
113+
// export CONTAINERD_SHA256="8e227caa318faa136e4387ffd6f96baeaad5582d176202fe9da69cde87036033"
113114
// wget https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION}/cri-containerd-cni-${CONTAINERD_VERSION}-linux-amd64.tar.gz
114115
dl := fmt.Sprintf(containerdURL, containerdVersion, containerdVersion)
115116
u, err := url.Parse(dl)

cmd/pke/app/util/linux/apt.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"strings"
2323

2424
"emperror.dev/errors"
25+
2526
"github.com/banzaicloud/pke/cmd/pke/app/util/file"
2627
"github.com/banzaicloud/pke/cmd/pke/app/util/runner"
2728
)
@@ -140,7 +141,7 @@ func mapAptPackageVersion(pkg, kubernetesVersion string) string {
140141
return "kubelet=" + getAptPackageVersion(kubernetesVersion)
141142

142143
case kubernetescni:
143-
return "kubernetes-cni=0.8.7-00"
144+
return "kubernetes-cni=1.1.1-00"
144145

145146
default:
146147
return ""

cmd/pke/app/util/linux/rpm.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"strings"
2020

2121
"emperror.dev/errors"
22+
2223
"github.com/banzaicloud/pke/cmd/pke/app/util/runner"
2324
)
2425

@@ -28,7 +29,7 @@ const (
2829
kubectl = "kubectl"
2930
kubelet = "kubelet"
3031
kubernetescni = "kubernetes-cni"
31-
kubernetesCNIVersion = "0.8.7"
32+
kubernetesCNIVersion = "1.1.1"
3233
disableExcludesKubernetes = "--disableexcludes=kubernetes"
3334
selinuxConfig = "/etc/selinux/config"
3435
)

cmd/pke/app/util/pipeline/status.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ import (
2121
"os"
2222
"time"
2323

24+
"github.com/spf13/cobra"
25+
2426
"github.com/banzaicloud/pke/.gen/pipeline"
2527
"github.com/banzaicloud/pke/cmd/pke/app/constants"
26-
"github.com/spf13/cobra"
2728
)
2829

2930
type pipelineStatusReporter struct {

0 commit comments

Comments
 (0)