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

varius changes #258

Merged
merged 1 commit into from
Mar 11, 2019
Merged
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
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