Skip to content

Commit 9ee7645

Browse files
sayanchowdhurytormath1
authored andcommitted
Add kustomize templates
Signed-off-by: Sayan Chowdhury <[email protected]> Signed-off-by: Mathieu Tortuyaux <[email protected]>
1 parent 08070df commit 9ee7645

File tree

3 files changed

+228
-0
lines changed

3 files changed

+228
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace: default
2+
resources:
3+
- ../base
4+
- machine-deployment.yaml
5+
- ../../azure-cluster-identity
6+
7+
patchesStrategicMerge:
8+
- patches/kubeadm-controlplane.yaml
9+
- ../../azure-cluster-identity/azurecluster-identity-ref.yaml
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
apiVersion: cluster.x-k8s.io/v1beta1
3+
kind: MachineDeployment
4+
metadata:
5+
name: ${CLUSTER_NAME}-md-0
6+
spec:
7+
clusterName: ${CLUSTER_NAME}
8+
replicas: ${WORKER_MACHINE_COUNT}
9+
selector:
10+
matchLabels: null
11+
template:
12+
spec:
13+
bootstrap:
14+
configRef:
15+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
16+
kind: KubeadmConfigTemplate
17+
name: ${CLUSTER_NAME}-md-0
18+
clusterName: ${CLUSTER_NAME}
19+
infrastructureRef:
20+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
21+
kind: AzureMachineTemplate
22+
name: ${CLUSTER_NAME}-md-0
23+
version: ${KUBERNETES_VERSION}
24+
---
25+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
26+
kind: AzureMachineTemplate
27+
metadata:
28+
name: ${CLUSTER_NAME}-md-0
29+
spec:
30+
template:
31+
spec:
32+
image:
33+
computeGallery:
34+
gallery: flatcar-23485951-527a-48d6-9d11-6931ff0afc2e
35+
name: flatcar-stable-amd64
36+
version: ${FLATCAR_VERSION}
37+
osDisk:
38+
diskSizeGB: 128
39+
osType: Linux
40+
sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""}
41+
vmSize: ${AZURE_NODE_MACHINE_TYPE}
42+
---
43+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
44+
kind: KubeadmConfigTemplate
45+
metadata:
46+
name: ${CLUSTER_NAME}-md-0
47+
spec:
48+
template:
49+
spec:
50+
files:
51+
- contentFrom:
52+
secret:
53+
key: worker-node-azure.json
54+
name: ${CLUSTER_NAME}-md-0-azure-json
55+
owner: root:root
56+
path: /etc/kubernetes/azure.json
57+
permissions: "0644"
58+
format: ignition
59+
ignition:
60+
containerLinuxConfig:
61+
additionalConfig: |
62+
storage:
63+
links:
64+
- path: /etc/extensions/kubernetes.raw
65+
hard: false
66+
target: /opt/extensions/kubernetes/kubernetes-${KUBERNETES_VERSION}-x86-64.raw
67+
files:
68+
- path: /etc/sysupdate.kubernetes.d/kubernetes-${KUBERNETES_VERSION%.*}.conf
69+
mode: 0644
70+
contents:
71+
remote:
72+
url: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes-${KUBERNETES_VERSION%.*}.conf
73+
- path: /etc/sysupdate.d/noop.conf
74+
mode: 0644
75+
contents:
76+
remote:
77+
url: https://github.com/flatcar/sysext-bakery/releases/download/latest/noop.conf
78+
- path: /opt/extensions/kubernetes/kubernetes-${KUBERNETES_VERSION}-x86-64.raw
79+
contents:
80+
remote:
81+
url: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes-${KUBERNETES_VERSION}-x86-64.raw
82+
systemd:
83+
units:
84+
- name: systemd-sysupdate.service
85+
dropins:
86+
- name: kubernetes.conf
87+
contents: |
88+
[Service]
89+
ExecStartPre=/usr/bin/sh -c "readlink --canonicalize /etc/extensions/kubernetes.raw > /tmp/kubernetes"
90+
ExecStartPre=/usr/lib/systemd/systemd-sysupdate -C kubernetes update
91+
ExecStartPost=/usr/bin/sh -c "readlink --canonicalize /etc/extensions/kubernetes.raw > /tmp/kubernetes-new"
92+
ExecStartPost=/usr/bin/sh -c "if ! cmp --silent /tmp/kubernetes /tmp/kubernetes-new; then touch /run/reboot-required; fi"
93+
- name: update-engine.service
94+
# Set this to 'false' if you want to enable Flatcar auto-update
95+
mask: ${FLATCAR_DISABLE_AUTO_UPDATE:=true}
96+
- name: locksmithd.service
97+
# NOTE: To coordinate the node reboot in this context, we recommend to use Kured.
98+
mask: true
99+
- name: systemd-sysupdate.timer
100+
# Set this to 'true' if you want to enable the Kubernetes auto-update.
101+
# NOTE: Only patches version will be pulled.
102+
enabled: false
103+
- name: kubeadm.service
104+
dropins:
105+
- name: 10-flatcar.conf
106+
contents: |
107+
[Unit]
108+
After=oem-cloudinit.service
109+
# kubeadm must run after containerd - see https://github.com/kubernetes-sigs/image-builder/issues/939.
110+
After=containerd.service
111+
joinConfiguration:
112+
nodeRegistration:
113+
kubeletExtraArgs:
114+
cloud-provider: external
115+
name: '@@HOSTNAME@@'
116+
postKubeadmCommands: []
117+
preKubeadmCommands:
118+
- sed -i "s/@@HOSTNAME@@/$(curl -s -H Metadata:true --noproxy '*' 'http://169.254.169.254/metadata/instance?api-version=2020-09-01' | jq -r .compute.name)/g" /etc/kubeadm.yml
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
3+
kind: KubeadmControlPlane
4+
metadata:
5+
name: ${CLUSTER_NAME}-control-plane
6+
spec:
7+
kubeadmConfigSpec:
8+
diskSetup:
9+
filesystems:
10+
- device: /dev/disk/azure/scsi1/lun0
11+
extraOpts:
12+
- -E
13+
- lazy_itable_init=1,lazy_journal_init=1
14+
filesystem: ext4
15+
label: etcd_disk
16+
overwrite: false
17+
# Workaround for https://github.com/kubernetes-sigs/cluster-api/issues/7679.
18+
partitions: []
19+
format: ignition
20+
ignition:
21+
containerLinuxConfig:
22+
additionalConfig: |
23+
systemd:
24+
units:
25+
- name: systemd-sysupdate.service
26+
dropins:
27+
- name: kubernetes.conf
28+
contents: |
29+
[Service]
30+
ExecStartPre=/usr/bin/sh -c "readlink --canonicalize /etc/extensions/kubernetes.raw > /tmp/kubernetes"
31+
ExecStartPre=/usr/lib/systemd/systemd-sysupdate -C kubernetes update
32+
ExecStartPost=/usr/bin/sh -c "readlink --canonicalize /etc/extensions/kubernetes.raw > /tmp/kubernetes-new"
33+
ExecStartPost=/usr/bin/sh -c "if ! cmp --silent /tmp/kubernetes /tmp/kubernetes-new; then touch /run/reboot-required; fi"
34+
- name: update-engine.service
35+
# Set this to 'false' if you want to enable Flatcar auto-update
36+
mask: ${FLATCAR_DISABLE_AUTO_UPDATE:=true}
37+
- name: locksmithd.service
38+
# NOTE: To coordinate the node reboot in this context, we recommend to use Kured.
39+
mask: true
40+
- name: systemd-sysupdate.timer
41+
# Set this to 'true' if you want to enable the Kubernetes auto-update.
42+
# NOTE: Only patches version will be pulled.
43+
enabled: false
44+
- name: kubeadm.service
45+
dropins:
46+
- name: 10-flatcar.conf
47+
contents: |
48+
[Unit]
49+
After=oem-cloudinit.service
50+
# kubeadm must run after containerd - see https://github.com/kubernetes-sigs/image-builder/issues/939.
51+
After=containerd.service
52+
# Workaround for https://github.com/kubernetes-sigs/cluster-api/issues/7679.
53+
storage:
54+
disks:
55+
- device: /dev/disk/azure/scsi1/lun0
56+
partitions:
57+
- number: 1
58+
links:
59+
- path: /etc/extensions/kubernetes.raw
60+
hard: false
61+
target: /opt/extensions/kubernetes/kubernetes-${KUBERNETES_VERSION}-x86-64.raw
62+
files:
63+
- path: /etc/sysupdate.kubernetes.d/kubernetes-${KUBERNETES_VERSION%.*}.conf
64+
mode: 0644
65+
contents:
66+
remote:
67+
url: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes-${KUBERNETES_VERSION%.*}.conf
68+
- path: /etc/sysupdate.d/noop.conf
69+
mode: 0644
70+
contents:
71+
remote:
72+
url: https://github.com/flatcar/sysext-bakery/releases/download/latest/noop.conf
73+
- path: /opt/extensions/kubernetes/kubernetes-${KUBERNETES_VERSION}-x86-64.raw
74+
contents:
75+
remote:
76+
url: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes-${KUBERNETES_VERSION}-x86-64.raw
77+
initConfiguration:
78+
nodeRegistration:
79+
name: '@@HOSTNAME@@'
80+
joinConfiguration:
81+
nodeRegistration:
82+
name: '@@HOSTNAME@@'
83+
mounts:
84+
- - etcd_disk
85+
- /var/lib/etcddisk
86+
postKubeadmCommands: []
87+
preKubeadmCommands:
88+
- sed -i "s/@@HOSTNAME@@/$(curl -s -H Metadata:true --noproxy '*' 'http://169.254.169.254/metadata/instance?api-version=2020-09-01' | jq -r .compute.name)/g" /etc/kubeadm.yml
89+
---
90+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
91+
kind: AzureMachineTemplate
92+
metadata:
93+
name: ${CLUSTER_NAME}-control-plane
94+
spec:
95+
template:
96+
spec:
97+
image:
98+
computeGallery:
99+
gallery: flatcar-23485951-527a-48d6-9d11-6931ff0afc2e
100+
name: flatcar-stable-amd64
101+
version: ${FLATCAR_VERSION}

0 commit comments

Comments
 (0)