Skip to content

Commit b9f62a3

Browse files
authored
Merge pull request #1388 from jsturtevant/windows-custom-binaries
Inject Windows custom binaries for use in PRs and running against Kubernetes CI
2 parents 079d2ce + 5df84fc commit b9f62a3

File tree

64 files changed

+3502
-402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+3502
-402
lines changed

Makefile

+6-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ GO_INSTALL = ./scripts/go_install.sh
4949
E2E_DATA_DIR ?= $(ROOT_DIR)/test/e2e/data
5050
KUBETEST_CONF_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/conformance.yaml)
5151
KUBETEST_WINDOWS_CONF_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/upstream-windows.yaml)
52-
KUBETEST_REPO_LIST_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/repo-list.yaml)
52+
KUBETEST_REPO_LIST_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/)
5353
AZURE_TEMPLATES := $(E2E_DATA_DIR)/infrastructure-azure
5454

5555
# set --output-base used for conversion-gen which needs to be different for in GOPATH and outside GOPATH dev
@@ -130,7 +130,7 @@ E2E_CONF_FILE ?= $(ROOT_DIR)/test/e2e/config/azure-dev.yaml
130130
E2E_CONF_FILE_ENVSUBST := $(ROOT_DIR)/test/e2e/config/azure-dev-envsubst.yaml
131131
SKIP_CLEANUP ?= false
132132
SKIP_CREATE_MGMT_CLUSTER ?= false
133-
WIN_REPO_LIST ?= https://raw.githubusercontent.com/kubernetes-sigs/windows-testing/master/images/image-repo-list
133+
WIN_REPO_URL ?=
134134

135135
# Build time versioning details.
136136
LDFLAGS := $(shell hack/version.sh)
@@ -202,8 +202,10 @@ test-conformance-fast: ## Run conformance test on workload cluster using a subse
202202

203203
.PHONY: test-windows-upstream
204204
test-windows-upstream: ## Run windows upstream tests on workload cluster.
205-
curl --retry $(CURL_RETRIES) $(WIN_REPO_LIST) -o $(KUBETEST_REPO_LIST_PATH)
206-
$(MAKE) test-conformance CONFORMANCE_E2E_ARGS="-kubetest.config-file=$(KUBETEST_WINDOWS_CONF_PATH) -kubetest.repo-list-file=$(KUBETEST_REPO_LIST_PATH) $(E2E_ARGS)"
205+
ifneq ($(WIN_REPO_URL), )
206+
curl --retry $(CURL_RETRIES) $(WIN_REPO_URL) -o $(KUBETEST_REPO_LIST_PATH)/custom-repo-list.yaml
207+
endif
208+
$(MAKE) test-conformance CONFORMANCE_E2E_ARGS="-kubetest.config-file=$(KUBETEST_WINDOWS_CONF_PATH) -kubetest.repo-list-path=$(KUBETEST_REPO_LIST_PATH) $(E2E_ARGS)"
207209

208210
$(KUBE_APISERVER) $(ETCD): ## install test asset kubectl, kube-apiserver, etcd
209211
source ./scripts/fetch_ext_bins.sh && fetch_tools

scripts/ci-build-kubernetes.sh

+22-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ source "${REPO_ROOT}/hack/parse-prow-creds.sh"
3838
: "${JOB_NAME:?Environment variable empty or not defined.}"
3939

4040
declare -a BINARIES=("kubeadm" "kubectl" "kubelet")
41+
declare -a WINDOWS_BINARIES=("kubeadm" "kubectl" "kubelet" "kube-proxy")
4142
declare -a IMAGES=("kube-apiserver" "kube-controller-manager" "kube-proxy" "kube-scheduler")
4243

4344
setup() {
@@ -100,7 +101,19 @@ main() {
100101
for BINARY in "${BINARIES[@]}"; do
101102
az storage blob upload --container-name "${JOB_NAME}" --file "${KUBE_ROOT}/_output/dockerized/bin/linux/amd64/${BINARY}" --name "${KUBE_GIT_VERSION}/bin/linux/amd64/${BINARY}"
102103
done
103-
fi
104+
105+
if [[ "${WINDOWS:-}" == "true" ]]; then
106+
echo "Building Kubernetes Windows binaries"
107+
108+
for BINARY in "${WINDOWS_BINARIES[@]}"; do
109+
"${KUBE_ROOT}"/build/run.sh make WHAT=cmd/"${BINARY}" KUBE_BUILD_PLATFORMS=windows/amd64 KUBE_VERBOSE=0
110+
done
111+
112+
for BINARY in "${WINDOWS_BINARIES[@]}"; do
113+
az storage blob upload --container-name "${JOB_NAME}" --file "${KUBE_ROOT}/_output/dockerized/bin/windows/amd64/${BINARY}.exe" --name "${KUBE_GIT_VERSION}/bin/windows/amd64/${BINARY}.exe"
114+
done
115+
fi
116+
fi
104117
}
105118

106119
# can_reuse_artifacts returns true if there exists Kubernetes artifacts built from a PR that we can reuse
@@ -117,6 +130,14 @@ can_reuse_artifacts() {
117130
fi
118131
done
119132

133+
if [[ "${WINDOWS:-}" == "true" ]]; then
134+
for BINARY in "${WINDOWS_BINARIES[@]}"; do
135+
if [[ "$(az storage blob exists --container-name "${JOB_NAME}" --name "${KUBE_GIT_VERSION}/bin/windows/amd64/${BINARY}.exe" --query exists)" == "false" ]]; then
136+
echo "false" && return
137+
fi
138+
done
139+
fi
140+
120141
echo "true"
121142
}
122143

templates/addons/windows/flannel.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ spec:
4747
rule: 'RunAsAny'
4848
---
4949
kind: ClusterRole
50-
apiVersion: rbac.authorization.k8s.io/v1beta1
50+
apiVersion: rbac.authorization.k8s.io/v1
5151
metadata:
5252
name: flannel
5353
rules:
@@ -76,7 +76,7 @@ rules:
7676
- patch
7777
---
7878
kind: ClusterRoleBinding
79-
apiVersion: rbac.authorization.k8s.io/v1beta1
79+
apiVersion: rbac.authorization.k8s.io/v1
8080
metadata:
8181
name: flannel
8282
roleRef:

templates/addons/windows/kube-proxy-windows.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ data:
55
mkdir -force /host/var/lib/kube-proxy/var/run/secrets/kubernetes.io/serviceaccount
66
mkdir -force /host/k/kube-proxy
77
8+
$$CI_VERSION="${CI_VERSION:-}"
9+
if($$CI_VERSION -ne "" -And (Test-Path -Path "/host/k/kube-proxy.exe"))
10+
{
11+
cp -force /host/k/kube-proxy.exe /k/kube-proxy/kube-proxy.exe
12+
}
13+
814
cp -force /k/kube-proxy/* /host/k/kube-proxy
915
cp -force /var/lib/kube-proxy/* /host/var/lib/kube-proxy
1016
cp -force /var/run/secrets/kubernetes.io/serviceaccount/* /host/var/lib/kube-proxy/var/run/secrets/kubernetes.io/serviceaccount #FIXME?
@@ -57,7 +63,7 @@ spec:
5763
valueFrom:
5864
fieldRef:
5965
fieldPath: status.podIP
60-
image: sigwindowstools/kube-proxy:${KUBERNETES_VERSION}-nanoserver
66+
image: sigwindowstools/kube-proxy:${KUBERNETES_VERSION/+/_}-nanoserver
6167
name: kube-proxy
6268
volumeMounts:
6369
- name: wins

templates/cluster-template-aad.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ spec:
115115
mounts:
116116
- - LABEL=etcd_disk
117117
- /var/lib/etcddisk
118+
postKubeadmCommands: []
119+
preKubeadmCommands: []
118120
useExperimentalRetryJoin: true
119121
machineTemplate:
120122
infrastructureRef:

templates/cluster-template-azure-bastion.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ spec:
112112
mounts:
113113
- - LABEL=etcd_disk
114114
- /var/lib/etcddisk
115+
postKubeadmCommands: []
116+
preKubeadmCommands: []
115117
machineTemplate:
116118
infrastructureRef:
117119
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
@@ -199,6 +201,7 @@ spec:
199201
cloud-config: /etc/kubernetes/azure.json
200202
cloud-provider: azure
201203
name: '{{ ds.meta_data["local_hostname"] }}'
204+
preKubeadmCommands: []
202205
---
203206
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
204207
kind: AzureClusterIdentity

templates/cluster-template-ephemeral.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ spec:
110110
mounts:
111111
- - LABEL=etcd_disk
112112
- /var/lib/etcddisk
113+
postKubeadmCommands: []
114+
preKubeadmCommands: []
113115
machineTemplate:
114116
infrastructureRef:
115117
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
@@ -203,6 +205,7 @@ spec:
203205
cloud-config: /etc/kubernetes/azure.json
204206
cloud-provider: azure
205207
name: '{{ ds.meta_data["local_hostname"] }}'
208+
preKubeadmCommands: []
206209
---
207210
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
208211
kind: AzureClusterIdentity

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

+3
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ spec:
111111
mounts:
112112
- - LABEL=etcd_disk
113113
- /var/lib/etcddisk
114+
postKubeadmCommands: []
115+
preKubeadmCommands: []
114116
machineTemplate:
115117
infrastructureRef:
116118
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
@@ -198,6 +200,7 @@ spec:
198200
cloud-config: /etc/kubernetes/azure.json
199201
cloud-provider: external
200202
name: '{{ ds.meta_data["local_hostname"] }}'
203+
preKubeadmCommands: []
201204
---
202205
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
203206
kind: AzureClusterIdentity

templates/cluster-template-ipv6.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ spec:
151151
- mv /etc/resolv.conf /etc/resolv.conf.OLD && ln -s /run/systemd/resolve/resolv.conf
152152
/etc/resolv.conf
153153
- systemctl restart systemd-resolved
154+
preKubeadmCommands: []
154155
machineTemplate:
155156
infrastructureRef:
156157
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4

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

+2
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ spec:
106106
mounts:
107107
- - LABEL=etcd_disk
108108
- /var/lib/etcddisk
109+
postKubeadmCommands: []
110+
preKubeadmCommands: []
109111
machineTemplate:
110112
infrastructureRef:
111113
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4

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

+2
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ spec:
106106
mounts:
107107
- - LABEL=etcd_disk
108108
- /var/lib/etcddisk
109+
postKubeadmCommands: []
110+
preKubeadmCommands: []
109111
machineTemplate:
110112
infrastructureRef:
111113
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4

templates/cluster-template-machinepool-windows.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ spec:
127127
- mac=$(ip -o link | grep eth0 | grep ether | awk '{ print $17 }')
128128
- sed -i -e "s/MACADDRESS/$${mac}/g" /etc/netplan/60-eth0.yaml
129129
- netplan apply
130+
preKubeadmCommands: []
130131
machineTemplate:
131132
infrastructureRef:
132133
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4

templates/cluster-template-machinepool.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ spec:
110110
mounts:
111111
- - LABEL=etcd_disk
112112
- /var/lib/etcddisk
113+
postKubeadmCommands: []
114+
preKubeadmCommands: []
113115
machineTemplate:
114116
infrastructureRef:
115117
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4

templates/cluster-template-nat-gateway.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ spec:
123123
mounts:
124124
- - LABEL=etcd_disk
125125
- /var/lib/etcddisk
126+
postKubeadmCommands: []
127+
preKubeadmCommands: []
126128
machineTemplate:
127129
infrastructureRef:
128130
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
@@ -210,6 +212,7 @@ spec:
210212
cloud-config: /etc/kubernetes/azure.json
211213
cloud-provider: azure
212214
name: '{{ ds.meta_data["local_hostname"] }}'
215+
preKubeadmCommands: []
213216
---
214217
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
215218
kind: AzureClusterIdentity

templates/cluster-template-nvidia-gpu.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ spec:
111111
mounts:
112112
- - LABEL=etcd_disk
113113
- /var/lib/etcddisk
114+
postKubeadmCommands: []
115+
preKubeadmCommands: []
114116
machineTemplate:
115117
infrastructureRef:
116118
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4

templates/cluster-template-private.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ spec:
213213
cloud-config: /etc/kubernetes/azure.json
214214
cloud-provider: azure
215215
name: '{{ ds.meta_data["local_hostname"] }}'
216+
preKubeadmCommands: []
216217
---
217218
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
218219
kind: AzureClusterIdentity

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

+3
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ spec:
106106
mounts:
107107
- - LABEL=etcd_disk
108108
- /var/lib/etcddisk
109+
postKubeadmCommands: []
110+
preKubeadmCommands: []
109111
machineTemplate:
110112
infrastructureRef:
111113
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
@@ -195,3 +197,4 @@ spec:
195197
cloud-config: /etc/kubernetes/azure.json
196198
cloud-provider: azure
197199
name: '{{ ds.meta_data["local_hostname"] }}'
200+
preKubeadmCommands: []

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

+3
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ spec:
106106
mounts:
107107
- - LABEL=etcd_disk
108108
- /var/lib/etcddisk
109+
postKubeadmCommands: []
110+
preKubeadmCommands: []
109111
machineTemplate:
110112
infrastructureRef:
111113
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
@@ -199,3 +201,4 @@ spec:
199201
cloud-config: /etc/kubernetes/azure.json
200202
cloud-provider: azure
201203
name: '{{ ds.meta_data["local_hostname"] }}'
204+
preKubeadmCommands: []

templates/cluster-template-windows.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ spec:
127127
- mac=$(ip -o link | grep eth0 | grep ether | awk '{ print $17 }')
128128
- sed -i -e "s/MACADDRESS/$${mac}/g" /etc/netplan/60-eth0.yaml
129129
- netplan apply
130+
preKubeadmCommands: []
130131
machineTemplate:
131132
infrastructureRef:
132133
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
@@ -160,7 +161,7 @@ metadata:
160161
namespace: default
161162
spec:
162163
clusterName: ${CLUSTER_NAME}
163-
replicas: ${WORKER_MACHINE_COUNT}
164+
replicas: ${LINUX_WORKER_MACHINE_COUNT:-1}
164165
selector:
165166
matchLabels: null
166167
template:
@@ -232,6 +233,7 @@ spec:
232233
- mac=$(ip -o link | grep eth0 | grep ether | awk '{ print $17 }')
233234
- sed -i -e "s/MACADDRESS/$${mac}/g" /etc/netplan/60-eth0.yaml
234235
- netplan apply
236+
preKubeadmCommands: []
235237
useExperimentalRetryJoin: true
236238
---
237239
apiVersion: cluster.x-k8s.io/v1alpha4

templates/cluster-template.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ spec:
110110
mounts:
111111
- - LABEL=etcd_disk
112112
- /var/lib/etcddisk
113+
postKubeadmCommands: []
114+
preKubeadmCommands: []
113115
machineTemplate:
114116
infrastructureRef:
115117
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
@@ -197,6 +199,7 @@ spec:
197199
cloud-config: /etc/kubernetes/azure.json
198200
cloud-provider: azure
199201
name: '{{ ds.meta_data["local_hostname"] }}'
202+
preKubeadmCommands: []
200203
---
201204
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
202205
kind: AzureClusterIdentity

templates/flavors/base/cluster-template.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ spec:
109109
mounts:
110110
- - LABEL=etcd_disk
111111
- /var/lib/etcddisk
112+
preKubeadmCommands: []
113+
postKubeadmCommands: []
112114
version: "${KUBERNETES_VERSION}"
113115
---
114116
kind: AzureMachineTemplate

templates/flavors/default/machine-deployment.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ metadata:
4242
spec:
4343
template:
4444
spec:
45+
preKubeadmCommands: []
4546
joinConfiguration:
4647
nodeRegistration:
4748
name: '{{ ds.meta_data["local_hostname"] }}'

templates/flavors/windows/machine-deployment.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
name: "${CLUSTER_NAME}-md-0"
66
spec:
77
clusterName: "${CLUSTER_NAME}"
8-
replicas: ${WORKER_MACHINE_COUNT}
8+
replicas: ${LINUX_WORKER_MACHINE_COUNT:-1}
99
selector:
1010
matchLabels:
1111
template:
@@ -44,6 +44,7 @@ metadata:
4444
spec:
4545
template:
4646
spec:
47+
preKubeadmCommands: []
4748
postKubeadmCommands:
4849
# Azures vnet MTU is 1400.
4950
# When using Flannel VXLAN to avoid packet fragmentation

0 commit comments

Comments
 (0)