Skip to content

Commit

Permalink
add JoinCPTemplateTextV1beate2Container when version >=1.20
Browse files Browse the repository at this point in the history
Signed-off-by: oldthreefeng <[email protected]>
  • Loading branch information
oldthreefeng committed Dec 21, 2020
1 parent e62345c commit 90d4f4a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
17 changes: 17 additions & 0 deletions install/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,23 @@ ipvs:
excludeCIDRs:
- "{{.VIP}}/32"`)

const JoinCPTemplateTextV1beate2Container = string(`apiVersion: kubeadm.k8s.io/v1beta2
caCertPath: /etc/kubernetes/pki/ca.crt
discovery:
bootstrapToken:
apiServerEndpoint: {{.Master0}}:6443
token: {{.TokenDiscovery}}
caCertHashes:
- {{.TokenDiscoveryCAHash}}
timeout: 5m0s
kind: JoinConfiguration
controlPlane:
localAPIEndpoint:
advertiseAddress: {{.Master}}
bindPort: 6443
nodeRegistration:
criSocket: /run/containerd/containerd.sock`)

const JoinCPTemplateTextV1beta2 = string(`apiVersion: kubeadm.k8s.io/v1beta2
caCertPath: /etc/kubernetes/pki/ca.crt
discovery:
Expand Down
6 changes: 5 additions & 1 deletion install/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ func Config() {

func joinKubeadmConfig() string {
var sb strings.Builder
sb.Write([]byte(JoinCPTemplateTextV1beta2))
if For120(Version) {
sb.Write([]byte(JoinCPTemplateTextV1beate2Container))
} else {
sb.Write([]byte(JoinCPTemplateTextV1beta2))
}
return sb.String()
}

Expand Down

0 comments on commit 90d4f4a

Please sign in to comment.