Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update kubernetes to v1.18.0 #322

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"

"github.com/spf13/cobra"
"github.com/xetys/hetzner-kube/pkg/clustermanager"
)

// Version The current version of hetzner-kube.
Expand All @@ -15,7 +16,8 @@ var versionCmd = &cobra.Command{
Aliases: []string{"v"},
Short: "prints the current version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(version)
fmt.Printf("Application: %s\n", version)
fmt.Printf("Kubernetes: %s\n", clustermanager.KubernetesVersion)
},
}

Expand Down
5 changes: 4 additions & 1 deletion pkg/clustermanager/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import (

const rewriteTpl = `cat /etc/kubernetes/%s | sed -e 's/server: https\(.*\)/server: https:\/\/127.0.0.1:16443/g' > /tmp/cp && mv /tmp/cp /etc/kubernetes/%s`

// KubernetesVersion indicate the kubernetes version managed by the current application
const KubernetesVersion = "1.18.0"

// Manager is the structure used to mange cluster
type Manager struct {
nodes []Node
Expand Down Expand Up @@ -74,7 +77,7 @@ func (manager *Manager) Cluster() Cluster {
IsolatedEtcd: manager.isolatedEtcd,
CloudInitFile: manager.cloudInitFile,
NodeCIDR: manager.clusterProvider.GetNodeCidr(),
KubernetesVersion: "1.16.4",
KubernetesVersion: KubernetesVersion,
}
}

Expand Down
10 changes: 4 additions & 6 deletions pkg/clustermanager/configs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func TestGenerateMasterConfiguration(t *testing.T) {
expectedConf := `apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
kubernetesVersion: v1.16.4
kubernetesVersion: v1.18.0
networking:
serviceSubnet: "10.96.0.0/12"
podSubnet: "10.244.0.0/16"
Expand Down Expand Up @@ -45,7 +45,7 @@ featureGates:

expectedConfWithEtcd := `apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
kubernetesVersion: v1.16.4
kubernetesVersion: v1.18.0
networking:
serviceSubnet: "10.96.0.0/12"
podSubnet: "10.244.0.0/16"
Expand Down Expand Up @@ -88,15 +88,13 @@ featureGates:
{Name: "node2", IPAddress: "1.1.1.2", PrivateIPAddress: "10.0.0.2"},
}

kubernetesVersion := "1.16.4"

noEtcdConf := GenerateMasterConfiguration(nodes[0], nodes, nil, kubernetesVersion)
noEtcdConf := GenerateMasterConfiguration(nodes[0], nodes, nil, KubernetesVersion)

if noEtcdConf != expectedConf {
t.Errorf("master config without etcd does not match to expected.\n%s\n", diff.LineDiff(noEtcdConf, expectedConf))
}

etcdConf := GenerateMasterConfiguration(nodes[0], nodes, nodes, kubernetesVersion)
etcdConf := GenerateMasterConfiguration(nodes[0], nodes, nodes, KubernetesVersion)

if etcdConf != expectedConfWithEtcd {
t.Errorf("master config with etcd does not match to expected.\n%s\n", diff.LineDiff(etcdConf, expectedConfWithEtcd))
Expand Down