Skip to content

Commit

Permalink
Update kubernetes to v1.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mavimo committed Mar 28, 2020
1 parent 5ee89ce commit c56c6da
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
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
4 changes: 3 additions & 1 deletion pkg/clustermanager/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ 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`

const KubernetesVersion = "1.18.0"

// Manager is the structure used to mange cluster
type Manager struct {
nodes []Node
Expand Down Expand Up @@ -74,7 +76,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

0 comments on commit c56c6da

Please sign in to comment.