Skip to content

Commit bd463d2

Browse files
committed
suppourt --kubernetes-version and --worker-machine-count
1 parent 1438e0f commit bd463d2

File tree

2 files changed

+60
-15
lines changed

2 files changed

+60
-15
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export NODE_URL=node.ssh.url:22
3434
export NODE_USER=node-ssh-user
3535
export NODE_PASSWORD=node-ssh-password
3636

37-
# generate manifests
38-
clusterctl generate cluster cappx-test --infrastructure=proxmox:v0.2.2 --config https://raw.githubusercontent.com/sp-yduck/cluster-api-provider-proxmox/main/clusterctl.yaml > cappx-test.yaml
37+
# generate manifests (available flags: --target-namespace, --kubernetes-version, --worker-machine-count)
38+
clusterctl generate cluster cappx-test --worker-machine-count=3 --infrastructure=proxmox:v0.2.2 --config https://raw.githubusercontent.com/sp-yduck/cluster-api-provider-proxmox/main/clusterctl.yaml > cappx-test.yaml
3939

4040
# inspect and edit
4141
vi cappx-test.yaml
@@ -86,8 +86,8 @@ CAPPX is tested with `pve-manager/7.4-3/9002ab8a (running kernel: 5.15.102-1-pve
8686

8787
### Cluster API
8888

89-
| | Cluster API v1alpha4 | Cluster API v1beta1 |
90-
| --------------------- | :------------------: | :-----------------: |
89+
| | Cluster API v1alpha4 | Cluster API v1beta1 |
90+
| ---------------------- | :------------------: | :-----------------: |
9191
| CAPPX v1beta1 `(v0.x)` | ? ||
9292

9393
### ControlPlane & Bootstrap provider

templates/cluster-template.yaml

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ spec:
8181
kind: ProxmoxMachineTemplate
8282
name: ${CLUSTER_NAME}-controlplane
8383
replicas: 1
84-
version: v1.26.5
84+
version: ${KUBERNETES_VERSION:=v1.27.3}
8585

8686
---
8787

@@ -140,9 +140,9 @@ spec:
140140
- "mkdir -p /opt/cni/bin"
141141
- curl -L "https://github.com/containernetworking/plugins/releases/download/v1.3.0/cni-plugins-linux-amd64-v1.3.0.tgz" | tar -C "/opt/cni/bin" -xz
142142
- curl -L "https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.27.0/crictl-v1.27.0-linux-amd64.tar.gz" | tar -C "/usr/local/bin" -xz
143-
- curl -L --remote-name-all https://dl.k8s.io/release/v1.26.5/bin/linux/amd64/kubeadm -o /usr/local/bin/kubeadm
143+
- curl -L --remote-name-all https://dl.k8s.io/release/${KUBERNETES_VERSION:=v1.27.3}/bin/linux/amd64/kubeadm -o /usr/local/bin/kubeadm
144144
- chmod +x /usr/local/bin/kubeadm
145-
- curl -L --remote-name-all https://dl.k8s.io/release/v1.26.5/bin/linux/amd64/kubelet -o /usr/local/bin/kubelet
145+
- curl -L --remote-name-all https://dl.k8s.io/release/${KUBERNETES_VERSION:=v1.27.3}/bin/linux/amd64/kubelet -o /usr/local/bin/kubelet
146146
- chmod +x /usr/local/bin/kubelet
147147
- curl -sSL "https://raw.githubusercontent.com/kubernetes/release/v0.15.1/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service" | sed "s:/usr/bin:/usr/local/bin:g" | tee /etc/systemd/system/kubelet.service
148148
- mkdir -p /etc/systemd/system/kubelet.service.d
@@ -155,31 +155,33 @@ apiVersion: cluster.x-k8s.io/v1beta1
155155
kind: MachineDeployment
156156
metadata:
157157
name: ${CLUSTER_NAME}-md-0
158+
namespace: ${NAMESPACE}
158159
spec:
159160
clusterName: "${CLUSTER_NAME}"
160-
replicas: 1
161+
replicas: ${WORKER_MACHINE_COUNT}
161162
selector:
162-
matchLabels: null
163+
matchLabels: {}
163164
template:
164165
spec:
166+
clusterName: ${CLUSTER_NAME}
165167
bootstrap:
166168
configRef:
167169
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
168170
kind: KubeadmConfigTemplate
169-
name: worker
170-
clusterName: "${CLUSTER_NAME}-md-0"
171+
name: ${CLUSTER_NAME}-md-0
171172
infrastructureRef:
172173
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
173174
kind: ProxmoxMachineTemplate
174175
name: ${CLUSTER_NAME}-md-0
175-
version: v1.26.5
176+
version: ${KUBERNETES_VERSION:=v1.27.3}
176177

177178
---
178179

179180
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
180181
kind: KubeadmConfigTemplate
181182
metadata:
182183
name: ${CLUSTER_NAME}-md-0
184+
namespace: ${NAMESPACE}
183185
spec:
184186
template:
185187
spec:
@@ -194,14 +196,57 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
194196
kind: ProxmoxMachineTemplate
195197
metadata:
196198
name: ${CLUSTER_NAME}-md-0
199+
namespace: ${NAMESPACE}
197200
spec:
198201
template:
199202
spec:
200203
image:
201204
url: https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64-disk-kvm.img
202-
hardware:
203-
cpu: 4
204-
memory: 4096
205+
checksum: 86e996f35732d26cd8b0888c46c4309d4d3b04eb6980378cf82b4d3eb2796549
206+
checksumType: sha256
207+
cloudInit:
208+
user:
209+
packages:
210+
- socat
211+
- conntrack
212+
writeFiles:
213+
- path: /etc/modules-load.d/k8s.conf
214+
owner: root:root
215+
permissions: "0640"
216+
content: overlay\nbr_netfilter
217+
- path: /etc/sysctl.d/k8s.conf
218+
owner: root:root
219+
permissions: "0640"
220+
content: |
221+
net.bridge.bridge-nf-call-iptables = 1
222+
net.bridge.bridge-nf-call-ip6tables = 1
223+
net.ipv4.ip_forward = 1
224+
runCmd:
225+
- "modprobe overlay"
226+
- "modprobe br_netfilter"
227+
- "sysctl --system"
228+
- "mkdir -p /usr/local/bin"
229+
- curl -L "https://github.com/containerd/containerd/releases/download/v1.7.2/containerd-1.7.2-linux-amd64.tar.gz" | tar Cxvz "/usr/local"
230+
- curl -L "https://raw.githubusercontent.com/containerd/containerd/main/containerd.service" -o /etc/systemd/system/containerd.service
231+
- "mkdir -p /etc/containerd"
232+
- "containerd config default > /etc/containerd/config.toml"
233+
- "sed 's/SystemdCgroup = false/SystemdCgroup = true/g' /etc/containerd/config.toml -i"
234+
- "systemctl daemon-reload"
235+
- "systemctl enable --now containerd"
236+
- "mkdir -p /usr/local/sbin"
237+
- curl -L "https://github.com/opencontainers/runc/releases/download/v1.1.7/runc.amd64" -o /usr/local/sbin/runc
238+
- "chmod 755 /usr/local/sbin/runc"
239+
- "mkdir -p /opt/cni/bin"
240+
- curl -L "https://github.com/containernetworking/plugins/releases/download/v1.3.0/cni-plugins-linux-amd64-v1.3.0.tgz" | tar -C "/opt/cni/bin" -xz
241+
- curl -L "https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.27.0/crictl-v1.27.0-linux-amd64.tar.gz" | tar -C "/usr/local/bin" -xz
242+
- curl -L --remote-name-all https://dl.k8s.io/release/${KUBERNETES_VERSION:=v1.27.3}/bin/linux/amd64/kubeadm -o /usr/local/bin/kubeadm
243+
- chmod +x /usr/local/bin/kubeadm
244+
- curl -L --remote-name-all https://dl.k8s.io/release/${KUBERNETES_VERSION:=v1.27.3}/bin/linux/amd64/kubelet -o /usr/local/bin/kubelet
245+
- chmod +x /usr/local/bin/kubelet
246+
- curl -sSL "https://raw.githubusercontent.com/kubernetes/release/v0.15.1/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service" | sed "s:/usr/bin:/usr/local/bin:g" | tee /etc/systemd/system/kubelet.service
247+
- mkdir -p /etc/systemd/system/kubelet.service.d
248+
- curl -sSL "https://raw.githubusercontent.com/kubernetes/release/v0.15.1/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf" | sed "s:/usr/bin:/usr/local/bin:g" | tee /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
249+
- "systemctl enable kubelet.service"
205250

206251
---
207252

0 commit comments

Comments
 (0)