Skip to content

Commit de9cca4

Browse files
committed
Support add worker node by creating MachineDeployment
Signed-off-by: ekko <[email protected]>
1 parent 6d56d7f commit de9cca4

File tree

3 files changed

+48
-9
lines changed

3 files changed

+48
-9
lines changed

Diff for: docs/tilt.md

-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ kustomize_substitutions:
4949

5050
ECS_IMAGE_ID: "a9f5cc27-0d50-4864-a45e-d8eead734a3f"
5151

52-
KUBE_IMAGE_REPO: "registry.cn-hangzhou.aliyuncs.com/google_containers"
53-
KUBE_DNS_IMAGE_REPO: "registry.cn-hangzhou.aliyuncs.com/google_containers"
54-
ETCD_IMAGE_REPO: "registry.cn-hangzhou.aliyuncs.com/google_containers"
5552
```
5653

5754
**Note:** Please ensure that the values for `CLOUD_SDK_AK` and `CLOUD_SDK_SK` are base64 encoded.

Diff for: pkg/services/ecs/instance.go

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ func (s *Service) GetCoreSecurityGroups(scope *scope.MachineScope) ([]string, er
102102
switch scope.Role() {
103103
case "control-plane":
104104
sgRoles = append(sgRoles, infrav1.SecurityGroupControlPlane)
105+
case "node":
105106
default:
106107
return nil, errors.Errorf("Unknown node role %q", scope.Role())
107108
}

Diff for: templates/cluster-template.yaml

+47-6
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,6 @@ spec:
3939
controllerManager:
4040
extraArgs:
4141
cloud-provider: external
42-
etcd:
43-
local:
44-
imageRepository: "${ETCD_IMAGE_REPO}"
45-
dns:
46-
imageRepository: "${KUBE_DNS_IMAGE_REPO}"
47-
imageRepository: "${KUBE_IMAGE_REPO}"
4842
initConfiguration:
4943
nodeRegistration:
5044
kubeletExtraArgs:
@@ -72,4 +66,51 @@ spec:
7266
spec:
7367
imageRef: "${ECS_IMAGE_ID}"
7468
flavorRef: "${HC_CONTROL_PLANE_MACHINE_TYPE}"
69+
publicIP: true
70+
---
71+
apiVersion: cluster.x-k8s.io/v1beta1
72+
kind: MachineDeployment
73+
metadata:
74+
name: "${CLUSTER_NAME}-md-0"
75+
spec:
76+
clusterName: "${CLUSTER_NAME}"
77+
replicas: ${WORKER_MACHINE_COUNT}
78+
selector:
79+
matchLabels: null
80+
template:
81+
spec:
82+
bootstrap:
83+
configRef:
84+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
85+
kind: KubeadmConfigTemplate
86+
name: "${CLUSTER_NAME}-md-0"
87+
clusterName: ${CLUSTER_NAME}
88+
infrastructureRef:
89+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
90+
kind: HuaweiCloudMachineTemplate
91+
name: "${CLUSTER_NAME}-md-0"
92+
version: ${KUBERNETES_VERSION}
93+
---
94+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
95+
kind: KubeadmConfigTemplate
96+
metadata:
97+
name: "${CLUSTER_NAME}-md-0"
98+
spec:
99+
template:
100+
spec:
101+
joinConfiguration:
102+
nodeRegistration:
103+
kubeletExtraArgs:
104+
cloud-provider: external
105+
name: '{{ ds.meta_data.local_hostname }}'
106+
---
107+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
108+
kind: HuaweiCloudMachineTemplate
109+
metadata:
110+
name: "${CLUSTER_NAME}-md-0"
111+
spec:
112+
template:
113+
spec:
114+
imageRef: "${ECS_IMAGE_ID}"
115+
flavorRef: "${HC_NODE_MACHINE_TYPE}"
75116
publicIP: true

0 commit comments

Comments
 (0)