Skip to content

Commit fe6d1e0

Browse files
committed
Ensure we don't overwrite pr templates during generation
1 parent a47dcfe commit fe6d1e0

30 files changed

+242
-174
lines changed

templates/cluster-template-aad.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ spec:
115115
mounts:
116116
- - LABEL=etcd_disk
117117
- /var/lib/etcddisk
118+
postKubeadmCommands: []
118119
preKubeadmCommands: []
119120
useExperimentalRetryJoin: true
120121
machineTemplate:

templates/cluster-template-azure-bastion.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ spec:
112112
mounts:
113113
- - LABEL=etcd_disk
114114
- /var/lib/etcddisk
115+
postKubeadmCommands: []
115116
preKubeadmCommands: []
116117
machineTemplate:
117118
infrastructureRef:

templates/cluster-template-ephemeral.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ spec:
110110
mounts:
111111
- - LABEL=etcd_disk
112112
- /var/lib/etcddisk
113+
postKubeadmCommands: []
113114
preKubeadmCommands: []
114115
machineTemplate:
115116
infrastructureRef:

templates/cluster-template-external-cloud-provider.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ spec:
111111
mounts:
112112
- - LABEL=etcd_disk
113113
- /var/lib/etcddisk
114+
postKubeadmCommands: []
114115
preKubeadmCommands: []
115116
machineTemplate:
116117
infrastructureRef:

templates/cluster-template-machinepool-multiple-subnets.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ spec:
117117
mounts:
118118
- - LABEL=etcd_disk
119119
- /var/lib/etcddisk
120+
postKubeadmCommands: []
121+
preKubeadmCommands: []
120122
machineTemplate:
121123
infrastructureRef:
122124
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4

templates/cluster-template-machinepool-system-assigned-identity.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ spec:
106106
mounts:
107107
- - LABEL=etcd_disk
108108
- /var/lib/etcddisk
109+
postKubeadmCommands: []
109110
preKubeadmCommands: []
110111
machineTemplate:
111112
infrastructureRef:

templates/cluster-template-machinepool-user-assigned-identity.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ spec:
106106
mounts:
107107
- - LABEL=etcd_disk
108108
- /var/lib/etcddisk
109+
postKubeadmCommands: []
109110
preKubeadmCommands: []
110111
machineTemplate:
111112
infrastructureRef:

templates/cluster-template-machinepool.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ spec:
110110
mounts:
111111
- - LABEL=etcd_disk
112112
- /var/lib/etcddisk
113+
postKubeadmCommands: []
113114
preKubeadmCommands: []
114115
machineTemplate:
115116
infrastructureRef:

templates/cluster-template-nat-gateway.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ spec:
123123
mounts:
124124
- - LABEL=etcd_disk
125125
- /var/lib/etcddisk
126+
postKubeadmCommands: []
126127
preKubeadmCommands: []
127128
machineTemplate:
128129
infrastructureRef:

templates/cluster-template-nvidia-gpu.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ spec:
111111
mounts:
112112
- - LABEL=etcd_disk
113113
- /var/lib/etcddisk
114+
postKubeadmCommands: []
114115
preKubeadmCommands: []
115116
machineTemplate:
116117
infrastructureRef:

templates/cluster-template-system-assigned-identity.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ spec:
106106
mounts:
107107
- - LABEL=etcd_disk
108108
- /var/lib/etcddisk
109+
postKubeadmCommands: []
109110
preKubeadmCommands: []
110111
machineTemplate:
111112
infrastructureRef:

templates/cluster-template-user-assigned-identity.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ spec:
106106
mounts:
107107
- - LABEL=etcd_disk
108108
- /var/lib/etcddisk
109+
postKubeadmCommands: []
109110
preKubeadmCommands: []
110111
machineTemplate:
111112
infrastructureRef:

templates/cluster-template.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ spec:
110110
mounts:
111111
- - LABEL=etcd_disk
112112
- /var/lib/etcddisk
113+
postKubeadmCommands: []
113114
preKubeadmCommands: []
114115
machineTemplate:
115116
infrastructureRef:

templates/flavors/base/cluster-template.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ spec:
110110
- - LABEL=etcd_disk
111111
- /var/lib/etcddisk
112112
preKubeadmCommands: []
113+
postKubeadmCommands: []
113114
version: "${KUBERNETES_VERSION}"
114115
---
115116
kind: AzureMachineTemplate

templates/test/ci/cluster-template-prow-ci-version.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ spec:
181181
mounts:
182182
- - LABEL=etcd_disk
183183
- /var/lib/etcddisk
184+
postKubeadmCommands: []
184185
preKubeadmCommands:
185186
- bash -c /tmp/kubeadm-bootstrap.sh
186187
useExperimentalRetryJoin: true

templates/test/ci/cluster-template-prow-custom-vnet.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ spec:
126126
mounts:
127127
- - LABEL=etcd_disk
128128
- /var/lib/etcddisk
129+
postKubeadmCommands: []
129130
preKubeadmCommands: []
130131
machineTemplate:
131132
infrastructureRef:

templates/test/ci/cluster-template-prow-external-cloud-provider.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ spec:
116116
mounts:
117117
- - LABEL=etcd_disk
118118
- /var/lib/etcddisk
119+
postKubeadmCommands: []
119120
preKubeadmCommands: []
120121
machineTemplate:
121122
infrastructureRef:

templates/test/ci/cluster-template-prow-identity-from-env.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ spec:
111111
mounts:
112112
- - LABEL=etcd_disk
113113
- /var/lib/etcddisk
114+
postKubeadmCommands: []
114115
preKubeadmCommands: []
115116
machineTemplate:
116117
infrastructureRef:

templates/test/ci/cluster-template-prow-machine-pool-ci-version.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ spec:
181181
mounts:
182182
- - LABEL=etcd_disk
183183
- /var/lib/etcddisk
184+
postKubeadmCommands: []
184185
preKubeadmCommands:
185186
- bash -c /tmp/kubeadm-bootstrap.sh
186187
useExperimentalRetryJoin: true

templates/test/ci/cluster-template-prow-machine-pool.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ spec:
115115
mounts:
116116
- - LABEL=etcd_disk
117117
- /var/lib/etcddisk
118+
postKubeadmCommands: []
118119
preKubeadmCommands: []
119120
machineTemplate:
120121
infrastructureRef:

templates/test/ci/cluster-template-prow-nvidia-gpu.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ spec:
116116
mounts:
117117
- - LABEL=etcd_disk
118118
- /var/lib/etcddisk
119+
postKubeadmCommands: []
119120
preKubeadmCommands: []
120121
machineTemplate:
121122
infrastructureRef:

templates/test/ci/cluster-template-prow.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ spec:
115115
mounts:
116116
- - LABEL=etcd_disk
117117
- /var/lib/etcddisk
118+
postKubeadmCommands: []
118119
preKubeadmCommands: []
119120
machineTemplate:
120121
infrastructureRef:

templates/test/dev/cluster-template-custom-builds-windows.yaml

+41-14
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,25 @@ spec:
9595
overwrite: false
9696
tableType: gpt
9797
files:
98+
- content: |
99+
network:
100+
version: 2
101+
ethernets:
102+
eth0:
103+
mtu: 1400
104+
match:
105+
macaddress: MACADDRESS
106+
set-name: eth0
107+
owner: root:root
108+
path: /etc/netplan/60-eth0.yaml
109+
permissions: "0644"
110+
- contentFrom:
111+
secret:
112+
key: control-plane-azure.json
113+
name: ${CLUSTER_NAME}-control-plane-azure-json
114+
owner: root:root
115+
path: /etc/kubernetes/azure.json
116+
permissions: "0644"
98117
- content: |
99118
#!/bin/bash
100119
@@ -144,13 +163,6 @@ spec:
144163
owner: root:root
145164
path: /tmp/replace-k8s-components.sh
146165
permissions: "0744"
147-
- contentFrom:
148-
secret:
149-
key: control-plane-azure.json
150-
name: ${CLUSTER_NAME}-control-plane-azure-json
151-
owner: root:root
152-
path: /etc/kubernetes/azure.json
153-
permissions: "0644"
154166
initConfiguration:
155167
nodeRegistration:
156168
kubeletExtraArgs:
@@ -169,6 +181,9 @@ spec:
169181
- - LABEL=etcd_disk
170182
- /var/lib/etcddisk
171183
postKubeadmCommands:
184+
- mac=$(ip -o link | grep eth0 | grep ether | awk '{ print $17 }')
185+
- sed -i -e "s/MACADDRESS/$${mac}/g" /etc/netplan/60-eth0.yaml
186+
- netplan apply
172187
- bash -c /tmp/replace-k8s-components.sh
173188
preKubeadmCommands:
174189
- bash -c /tmp/replace-k8s-binaries.sh
@@ -260,6 +275,25 @@ spec:
260275
template:
261276
spec:
262277
files:
278+
- contentFrom:
279+
secret:
280+
key: worker-node-azure.json
281+
name: ${CLUSTER_NAME}-md-0-azure-json
282+
owner: root:root
283+
path: /etc/kubernetes/azure.json
284+
permissions: "0644"
285+
- content: |
286+
network:
287+
version: 2
288+
ethernets:
289+
eth0:
290+
mtu: 1400
291+
match:
292+
macaddress: MACADDRESS
293+
set-name: eth0
294+
owner: root:root
295+
path: /etc/netplan/60-eth0.yaml
296+
permissions: "0644"
263297
- content: |
264298
#!/bin/bash
265299
@@ -281,13 +315,6 @@ spec:
281315
owner: root:root
282316
path: /tmp/replace-k8s-binaries.sh
283317
permissions: "0744"
284-
- contentFrom:
285-
secret:
286-
key: control-plane-azure.json
287-
name: ${CLUSTER_NAME}-control-plane-azure-json
288-
owner: root:root
289-
path: /etc/kubernetes/azure.json
290-
permissions: "0644"
291318
joinConfiguration:
292319
nodeRegistration:
293320
kubeletExtraArgs:

templates/test/dev/cluster-template-custom-builds.yaml

+14-14
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ spec:
9494
overwrite: false
9595
tableType: gpt
9696
files:
97+
- contentFrom:
98+
secret:
99+
key: control-plane-azure.json
100+
name: ${CLUSTER_NAME}-control-plane-azure-json
101+
owner: root:root
102+
path: /etc/kubernetes/azure.json
103+
permissions: "0644"
97104
- content: |
98105
#!/bin/bash
99106
@@ -143,13 +150,6 @@ spec:
143150
owner: root:root
144151
path: /tmp/replace-k8s-components.sh
145152
permissions: "0744"
146-
- contentFrom:
147-
secret:
148-
key: control-plane-azure.json
149-
name: ${CLUSTER_NAME}-control-plane-azure-json
150-
owner: root:root
151-
path: /etc/kubernetes/azure.json
152-
permissions: "0644"
153153
initConfiguration:
154154
nodeRegistration:
155155
kubeletExtraArgs:
@@ -259,6 +259,13 @@ spec:
259259
template:
260260
spec:
261261
files:
262+
- contentFrom:
263+
secret:
264+
key: worker-node-azure.json
265+
name: ${CLUSTER_NAME}-md-0-azure-json
266+
owner: root:root
267+
path: /etc/kubernetes/azure.json
268+
permissions: "0644"
262269
- content: |
263270
#!/bin/bash
264271
@@ -280,13 +287,6 @@ spec:
280287
owner: root:root
281288
path: /tmp/replace-k8s-binaries.sh
282289
permissions: "0744"
283-
- contentFrom:
284-
secret:
285-
key: control-plane-azure.json
286-
name: ${CLUSTER_NAME}-control-plane-azure-json
287-
owner: root:root
288-
path: /etc/kubernetes/azure.json
289-
permissions: "0644"
290290
joinConfiguration:
291291
nodeRegistration:
292292
kubeletExtraArgs:

templates/test/dev/custom-builds-windows/kustomization.yaml

+14-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ namespace: default
22
resources:
33
- ../../../test/ci/prow-windows
44
patchesStrategicMerge:
5-
- ../custom-builds/patches/custom-builds.yaml
65
- patches/windows-image-update.yaml
6+
- ../custom-builds/patches/machine-deployment-pr-version.yaml
77
patchesJson6902:
88
- target:
99
group: bootstrap.cluster.x-k8s.io
@@ -12,3 +12,16 @@ patchesJson6902:
1212
name: .*-md-win
1313
namespace: default
1414
path: patches/custom-builds-windows.yaml
15+
- target:
16+
group: bootstrap.cluster.x-k8s.io
17+
version: v1alpha4
18+
kind: KubeadmConfigTemplate
19+
name: .*-md-0
20+
namespace: default
21+
path: ../custom-builds/patches/kubeadm-bootstrap.yaml
22+
- target:
23+
group: controlplane.cluster.x-k8s.io
24+
version: v1alpha4
25+
kind: KubeadmControlPlane
26+
name: .*-control-plane
27+
path: ../custom-builds/patches/kubeadm-controlplane-bootstrap.yaml

templates/test/dev/custom-builds/kustomization.yaml

+15-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,18 @@ namespace: default
22
resources:
33
- ../../../test/ci/prow
44
patchesStrategicMerge:
5-
- ../patches/control-plane-custom-builds.yaml
6-
- patches/custom-builds.yaml
5+
- patches/machine-deployment-pr-version.yaml
6+
patches:
7+
- target:
8+
group: bootstrap.cluster.x-k8s.io
9+
version: v1alpha4
10+
kind: KubeadmConfigTemplate
11+
name: .*-md-0
12+
namespace: default
13+
path: patches/kubeadm-bootstrap.yaml
14+
- target:
15+
group: controlplane.cluster.x-k8s.io
16+
version: v1alpha4
17+
kind: KubeadmControlPlane
18+
name: .*-control-plane
19+
path: patches/kubeadm-controlplane-bootstrap.yaml

0 commit comments

Comments
 (0)