Skip to content

Commit

Permalink
varius changes:
Browse files Browse the repository at this point in the history
 - update to kubernetes 1.13.4
 - update kubeadm/kubelet config file format
 - enable feature-gate that allow to use CSI
  • Loading branch information
mavimo committed Mar 10, 2019
1 parent 2f1368c commit c4d78d9
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 26 deletions.
23 changes: 15 additions & 8 deletions pkg/clustermanager/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,39 @@ import (
)

// GenerateMasterConfiguration generate the kubernetes config for master
func GenerateMasterConfiguration(masterNode Node, masterNodes, etcdNodes []Node) string {
masterConfigTpl := `apiVersion: kubeadm.k8s.io/v1alpha3
func GenerateMasterConfiguration(masterNode Node, masterNodes []Node, etcdNodes []Node) string {
masterConfigTpl := `apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
networking:
serviceSubnet: "10.96.0.0/12"
podSubnet: "10.244.0.0/16"
dnsDomain: "cluster.local"
apiServerCertSANs:
- 127.0.0.1
- %s
apiServer:
certSANs:
- 127.0.0.1
- %s
%s%s
---
apiVersion: kubeadm.k8s.io/v1alpha3
apiVersion: kubeadm.k8s.io/v1beta1
kind: InitConfiguration
apiEndpoint:
localAPIEndpoint:
advertiseAddress: %s
bindPort: 6443
nodeRegistration:
taints:
- effect: NoSchedule
key: node-role.kubernetes.io/master
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
featureGates:
CSINodeInfo: true
CSIDriverRegistry: true
`

masterNodesIps := ""
for _, node := range masterNodes {
masterNodesIps = fmt.Sprintf("%s - %s\n", masterNodesIps, node.PrivateIPAddress)
masterNodesIps = fmt.Sprintf("%s - %s\n", masterNodesIps, node.PrivateIPAddress)
}

etcdConfig := ""
Expand Down
46 changes: 30 additions & 16 deletions pkg/clustermanager/configs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,57 +7,71 @@ import (
)

func TestGenerateMasterConfiguration(t *testing.T) {
expectedConf := `apiVersion: kubeadm.k8s.io/v1alpha3
expectedConf := `apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
networking:
serviceSubnet: "10.96.0.0/12"
podSubnet: "10.244.0.0/16"
dnsDomain: "cluster.local"
apiServerCertSANs:
- 127.0.0.1
- 1.1.1.1
- 10.0.0.1
- 10.0.0.2
apiServer:
certSANs:
- 127.0.0.1
- 1.1.1.1
- 10.0.0.1
- 10.0.0.2
---
apiVersion: kubeadm.k8s.io/v1alpha3
apiVersion: kubeadm.k8s.io/v1beta1
kind: InitConfiguration
apiEndpoint:
localAPIEndpoint:
advertiseAddress: 10.0.0.1
bindPort: 6443
nodeRegistration:
taints:
- effect: NoSchedule
key: node-role.kubernetes.io/master
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
featureGates:
CSINodeInfo: true
CSIDriverRegistry: true
`

expectedConfWithEtcd := `apiVersion: kubeadm.k8s.io/v1alpha3
expectedConfWithEtcd := `apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
networking:
serviceSubnet: "10.96.0.0/12"
podSubnet: "10.244.0.0/16"
dnsDomain: "cluster.local"
apiServerCertSANs:
- 127.0.0.1
- 1.1.1.1
- 10.0.0.1
- 10.0.0.2
apiServer:
certSANs:
- 127.0.0.1
- 1.1.1.1
- 10.0.0.1
- 10.0.0.2
etcd:
external:
endpoints:
- http://10.0.0.1:2379
- http://10.0.0.2:2379
---
apiVersion: kubeadm.k8s.io/v1alpha3
apiVersion: kubeadm.k8s.io/v1beta1
kind: InitConfiguration
apiEndpoint:
localAPIEndpoint:
advertiseAddress: 10.0.0.1
bindPort: 6443
nodeRegistration:
taints:
- effect: NoSchedule
key: node-role.kubernetes.io/master
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
featureGates:
CSINodeInfo: true
CSIDriverRegistry: true
`
nodes := []Node{
{Name: "node1", IPAddress: "1.1.1.1", PrivateIPAddress: "10.0.0.1"},
Expand Down
4 changes: 2 additions & 2 deletions pkg/clustermanager/provision_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
const maxErrors = 3

// K8sVersion is the version that will be used to install kubernetes
var K8sVersion = flag.String("k8s-version", "1.13.3-00", "The version of the k8s debian packages that will be used during provisioning")
var K8sVersion = flag.String("k8s-version", "1.13.4-00", "The version of the k8s debian packages that will be used during provisioning")

// NodeProvisioner provisions all basic packages to install docker, kubernetes and wireguard
type NodeProvisioner struct {
Expand Down Expand Up @@ -117,7 +117,7 @@ func (provisioner *NodeProvisioner) waitForCloudInitCompletion() error {
cloudInitScript := `
#!/bin/bash
# timout is 10 min, retur true immediately if ok, otherwise wait timout
# timout is 10 min, return true immediately if ok, otherwise wait timout
# if cloud-init not very complex usually takes 2-3 min to completion
for i in {1..200}
do
Expand Down

0 comments on commit c4d78d9

Please sign in to comment.