Skip to content

Commit 8b5d40c

Browse files
committed
Add combined template
dalec artifact template
1 parent 5712010 commit 8b5d40c

File tree

8 files changed

+992
-0
lines changed

8 files changed

+992
-0
lines changed

templates/test/ci/cluster-template-prow-dalec-custom-builds.yaml

Lines changed: 696 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
namespace: default
4+
resources:
5+
- ../prow-apiserver-ilb-custom-images
6+
- patches/azl3-machine-deployment.yaml
7+
patches:
8+
- path: patches/kubeadm-bootstrap-custom-builds.yaml
9+
target:
10+
group: bootstrap.cluster.x-k8s.io
11+
kind: KubeadmConfigTemplate
12+
name: ^[^-]*-md-0$
13+
namespace: default
14+
version: v1beta1
15+
- path: patches/control-plane-custom-builds.yaml
16+
target:
17+
group: controlplane.cluster.x-k8s.io
18+
kind: KubeadmControlPlane
19+
name: .*-control-plane
20+
version: v1beta1
21+
- path: patches/delete-machine-health-check.yaml
22+
target:
23+
group: cluster.x-k8s.io
24+
kind: MachineHealthCheck
25+
name: .*-control-plane
26+
namespace: default
27+
version: v1beta1
28+
29+
sortOptions:
30+
order: fifo
31+
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
---
2+
apiVersion: cluster.x-k8s.io/v1beta1
3+
kind: MachineDeployment
4+
metadata:
5+
name: "${CLUSTER_NAME}-azl3-md-0"
6+
spec:
7+
clusterName: "${CLUSTER_NAME}"
8+
replicas: ${AZL3_WORKER_MACHINE_COUNT:=2}
9+
selector:
10+
matchLabels:
11+
template:
12+
spec:
13+
clusterName: "${CLUSTER_NAME}"
14+
version: "${KUBERNETES_VERSION}"
15+
bootstrap:
16+
configRef:
17+
name: "${CLUSTER_NAME}-azl3-md-0"
18+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
19+
kind: KubeadmConfigTemplate
20+
infrastructureRef:
21+
name: "${CLUSTER_NAME}-azl3-md-0"
22+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
23+
kind: AzureMachineTemplate
24+
---
25+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
26+
kind: AzureMachineTemplate
27+
metadata:
28+
name: "${CLUSTER_NAME}-azl3-md-0"
29+
spec:
30+
template:
31+
spec:
32+
vmSize: ${AZURE_NODE_MACHINE_TYPE}
33+
osDisk:
34+
osType: "Linux"
35+
diskSizeGB: 128
36+
sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""}
37+
image:
38+
computeGallery:
39+
gallery: ClusterAPI-f72ceb4f-5159-4c26-a0fe-2ea738f0d019
40+
name: capi-azurelinux-3
41+
version: ${AZL3_VERSION:="1.33.2"}
42+
---
43+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
44+
kind: KubeadmConfigTemplate
45+
metadata:
46+
name: "${CLUSTER_NAME}-azl3-md-0"
47+
spec:
48+
template:
49+
spec:
50+
files:
51+
- content: |
52+
#!/bin/bash
53+
54+
set -o nounset
55+
set -o pipefail
56+
set -o errexit
57+
58+
# Install ca-certificates packages for Azure Linux
59+
tdnf install -y ca-certificates ca-certificates-legacy
60+
update-ca-trust
61+
62+
# Follow Azure Linux 3 docs exactly - completely permissive for debugging
63+
# Change default policy to ACCEPT (as recommended by AZL3 docs)
64+
iptables -P INPUT ACCEPT
65+
iptables -P FORWARD ACCEPT
66+
iptables -P OUTPUT ACCEPT
67+
68+
ip6tables -P INPUT ACCEPT
69+
ip6tables -P FORWARD ACCEPT
70+
ip6tables -P OUTPUT ACCEPT
71+
72+
# Flush any rules which would filter packets
73+
iptables -F
74+
ip6tables -F
75+
76+
iptables-save > /etc/systemd/scripts/ip4save
77+
ip6tables-save > /etc/systemd/scripts/ip6save
78+
path: /tmp/azl3-setup.sh
79+
owner: "root:root"
80+
permissions: "0744"
81+
- contentFrom:
82+
secret:
83+
name: ${CLUSTER_NAME}-azl3-md-0-azure-json
84+
key: worker-node-azure.json
85+
owner: root:root
86+
path: /etc/kubernetes/azure.json
87+
permissions: "0644"
88+
- content: |
89+
#!/bin/bash
90+
91+
set -o nounset
92+
set -o pipefail
93+
set -o errexit
94+
95+
systemctl stop kubelet
96+
97+
declare -a BINARIES=("kubeadm" "kubectl" "kubelet")
98+
99+
# Define the base URL and version
100+
BASE_URL="https://kubernetesreleases.blob.core.windows.net/dalec-packages"
101+
VERSION="${KUBERNETES_VERSION}"
102+
VERSION=$${VERSION#v}
103+
OS_VERSION="azl3"
104+
ARCH="x86_64"
105+
106+
for BINARY in "$${BINARIES[@]}"; do
107+
echo "* downloading and extracting binary: $${BINARY} $${VERSION}"
108+
RPM_FILE="/tmp/$${BINARY}-$${VERSION}-1.$${OS_VERSION}.$${ARCH}.rpm"
109+
RPM_URL="$${BASE_URL}/$${BINARY}/$${VERSION}/$${OS_VERSION}/$${ARCH}/$${BINARY}-$${VERSION}-1.$${OS_VERSION}.$${ARCH}.rpm"
110+
111+
echo "Downloading from: $${RPM_URL}"
112+
curl -L --retry 10 --retry-delay 5 "$${RPM_URL}" --output "$${RPM_FILE}"
113+
114+
# Extract binary from RPM package in a temporary directory
115+
echo "Extracting $${BINARY} binary to /usr/bin"
116+
TEMP_DIR="/tmp/$${BINARY}-extract-$$"
117+
mkdir -p "$${TEMP_DIR}"
118+
cd "$${TEMP_DIR}"
119+
rpm2cpio "$${RPM_FILE}" | cpio -idmv
120+
121+
# Move the binary to the correct location
122+
if [ -f "./usr/bin/$${BINARY}" ]; then
123+
mv "./usr/bin/$${BINARY}" "/usr/bin/$${BINARY}"
124+
chmod +x "/usr/bin/$${BINARY}"
125+
else
126+
echo "Error: Binary $${BINARY} not found in RPM package"
127+
exit 1
128+
fi
129+
130+
# Clean up
131+
cd /
132+
rm -rf "$${TEMP_DIR}"
133+
rm -f "$${RPM_FILE}"
134+
done
135+
136+
systemctl restart kubelet
137+
138+
echo "kubeadm version: $(kubeadm version -o=short)"
139+
echo "kubectl version: $(kubectl version --client=true)"
140+
echo "kubelet version: $(kubelet --version)"
141+
path: /opt/install-custom-k8s-binaries.sh
142+
owner: "root:root"
143+
permissions: "0744"
144+
preKubeadmCommands:
145+
- bash -c /tmp/azl3-setup.sh
146+
- echo '${AZURE_INTERNAL_LB_PRIVATE_IP} ${CLUSTER_NAME}-${APISERVER_LB_DNS_SUFFIX}.${AZURE_LOCATION}.cloudapp.azure.com' >> /etc/hosts
147+
- bash -c /opt/install-custom-k8s-binaries.sh
148+
joinConfiguration:
149+
nodeRegistration:
150+
name: '{{ ds.meta_data["local_hostname"] }}'
151+
kubeletExtraArgs:
152+
cloud-provider: external
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
- op: add
2+
path: /spec/template/spec/files/-
3+
value:
4+
contentFrom:
5+
secret:
6+
name: ${CLUSTER_NAME}-azl3-md-0-azure-json
7+
key: worker-node-azure.json
8+
owner: root:root
9+
path: /etc/kubernetes/azure.json
10+
permissions: "0644"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
- op: add
2+
path: /spec/kubeadmConfigSpec/files/-
3+
value:
4+
content: |
5+
#!/bin/bash
6+
set -o nounset
7+
set -o pipefail
8+
set -o errexit
9+
systemctl stop kubelet
10+
declare -a BINARIES=("kubeadm" "kubectl" "kubelet")
11+
# Define the base URL and version
12+
BASE_URL="https://kubernetesreleases.blob.core.windows.net/dalec-packages"
13+
VERSION="${KUBERNETES_VERSION}"
14+
VERSION=$${VERSION#v}
15+
OS_VERSION="ubuntu24.04"
16+
ARCH="amd64"
17+
for BINARY in "$${BINARIES[@]}"; do
18+
if [[ "$${BINARY}" == "kubelet" ]]; then
19+
DEB_VERSION="ubuntu24.04u1"
20+
else
21+
DEB_VERSION="ubuntu24.04u2"
22+
fi
23+
echo "* downloading and extracting binary: $${BINARY} $${VERSION} with deb version $${DEB_VERSION}"
24+
DEB_FILE="/tmp/$${BINARY}_$${VERSION}-$${DEB_VERSION}_$${ARCH}.deb"
25+
DEB_URL="$${BASE_URL}/$${BINARY}/$${VERSION}/$${OS_VERSION}/$${ARCH}/$${BINARY}_$${VERSION}-$${DEB_VERSION}_$${ARCH}.deb"
26+
echo "Downloading from: $${DEB_URL}"
27+
curl -L --retry 10 --retry-delay 5 "$${DEB_URL}" --output "$${DEB_FILE}"
28+
# Extract just the binary from the deb package directly to /usr/bin
29+
echo "Extracting $${BINARY} binary to /usr/bin"
30+
dpkg-deb --fsys-tarfile "$${DEB_FILE}" | tar -xf - --strip-components=3 -C /usr/bin ./usr/bin/$${BINARY}
31+
chmod +x "/usr/bin/$${BINARY}"
32+
# Clean up the downloaded deb file
33+
rm -f "$${DEB_FILE}"
34+
done
35+
systemctl restart kubelet
36+
echo "kubeadm version: $(kubeadm version -o=short)"
37+
echo "kubectl version: $(kubectl version --client=true)"
38+
echo "kubelet version: $(kubelet --version)"
39+
path: /tmp/replace-k8s-binaries.sh
40+
owner: "root:root"
41+
permissions: "0744"
42+
- op: add
43+
path: /spec/kubeadmConfigSpec/preKubeadmCommands/-
44+
value:
45+
bash -c /tmp/replace-k8s-binaries.sh
46+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: cluster.x-k8s.io/v1beta1
2+
kind: MachineHealthCheck
3+
metadata:
4+
name: ${CLUSTER_NAME}-control-plane
5+
namespace: default
6+
$patch: delete
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
- op: add
2+
path: /spec/template/spec/files/-
3+
value:
4+
content: |
5+
#!/bin/bash
6+
set -o nounset
7+
set -o pipefail
8+
set -o errexit
9+
systemctl stop kubelet
10+
declare -a BINARIES=("kubeadm" "kubectl" "kubelet")
11+
# Define the base URL and version
12+
BASE_URL="https://kubernetesreleases.blob.core.windows.net/dalec-packages"
13+
VERSION="${KUBERNETES_VERSION}"
14+
VERSION=$${VERSION#v}
15+
OS_VERSION="ubuntu24.04"
16+
ARCH="amd64"
17+
for BINARY in "$${BINARIES[@]}"; do
18+
if [[ "$${BINARY}" == "kubelet" ]]; then
19+
DEB_VERSION="ubuntu24.04u1"
20+
else
21+
DEB_VERSION="ubuntu24.04u2"
22+
fi
23+
echo "* downloading and extracting binary: $${BINARY} $${VERSION} with deb version $${DEB_VERSION}"
24+
DEB_FILE="/tmp/$${BINARY}_$${VERSION}-$${DEB_VERSION}_$${ARCH}.deb"
25+
DEB_URL="$${BASE_URL}/$${BINARY}/$${VERSION}/$${OS_VERSION}/$${ARCH}/$${BINARY}_$${VERSION}-$${DEB_VERSION}_$${ARCH}.deb"
26+
echo "Downloading from: $${DEB_URL}"
27+
curl -L --retry 10 --retry-delay 5 "$${DEB_URL}" --output "$${DEB_FILE}"
28+
# Extract just the binary from the deb package directly to /usr/bin
29+
echo "Extracting $${BINARY} binary to /usr/bin"
30+
dpkg-deb --fsys-tarfile "$${DEB_FILE}" | tar -xf - --strip-components=3 -C /usr/bin ./usr/bin/$${BINARY}
31+
chmod +x "/usr/bin/$${BINARY}"
32+
# Clean up the downloaded deb file
33+
rm -f "$${DEB_FILE}"
34+
done
35+
systemctl restart kubelet
36+
echo "kubeadm version: $(kubeadm version -o=short)"
37+
echo "kubectl version: $(kubectl version --client=true)"
38+
echo "kubelet version: $(kubelet --version)"
39+
path: /tmp/replace-k8s-binaries.sh
40+
owner: "root:root"
41+
permissions: "0744"
42+
- op: add
43+
path: /spec/template/spec/preKubeadmCommands/-
44+
value:
45+
bash -c /tmp/replace-k8s-binaries.sh

test/e2e/config/azure-dev.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ providers:
186186
targetName: "cluster-template-apiserver-ilb.yaml"
187187
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-apiserver-ilb-custom-images.yaml"
188188
targetName: "cluster-template-apiserver-ilb-custom-images.yaml"
189+
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-custom-builds-apiserver-ilb-custom-images.yaml"
190+
targetName: "cluster-template-custom-builds-apiserver-ilb-custom-images.yaml"
191+
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-custom-builds-azl3.yaml"
192+
targetName: "cluster-template-custom-builds-azl3.yaml"
193+
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-dalec-custom-builds.yaml"
194+
targetName: "cluster-template-dalec-custom-builds.yaml"
189195
- sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-azl3.yaml"
190196
targetName: "cluster-template-azl3.yaml"
191197
replacements:

0 commit comments

Comments
 (0)