Skip to content

Commit 9d469f5

Browse files
committed
e2e-k8s.sh drop CLUSTER_LOG_FORMAT and add versioned kubeadm config patches
1 parent b2b7266 commit 9d469f5

File tree

1 file changed

+55
-41
lines changed

1 file changed

+55
-41
lines changed

hack/ci/e2e-k8s.sh

Lines changed: 55 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -82,47 +82,11 @@ build() {
8282
export PATH="${PWD}/_output/bin:$PATH"
8383
}
8484

85-
check_structured_log_support() {
86-
case "${KUBE_VERSION}" in
87-
v1.1[0-8].*)
88-
echo "$1 is only supported on versions >= v1.19, got ${KUBE_VERSION}"
89-
exit 1
90-
;;
91-
esac
92-
}
93-
9485
# up a cluster with kind
9586
create_cluster() {
96-
# Grab the version of the cluster we're about to start
97-
KUBE_VERSION="$(docker run --rm --entrypoint=cat "kindest/node:latest" /kind/version)"
98-
9987
# Default Log level for all components in test clusters
10088
KIND_CLUSTER_LOG_LEVEL=${KIND_CLUSTER_LOG_LEVEL:-4}
10189

102-
# potentially enable --logging-format
103-
CLUSTER_LOG_FORMAT=${CLUSTER_LOG_FORMAT:-}
104-
scheduler_extra_args=" \"v\": \"${KIND_CLUSTER_LOG_LEVEL}\""
105-
controllerManager_extra_args=" \"v\": \"${KIND_CLUSTER_LOG_LEVEL}\""
106-
apiServer_extra_args=" \"v\": \"${KIND_CLUSTER_LOG_LEVEL}\""
107-
if [ -n "$CLUSTER_LOG_FORMAT" ]; then
108-
check_structured_log_support "CLUSTER_LOG_FORMAT"
109-
scheduler_extra_args="${scheduler_extra_args}
110-
\"logging-format\": \"${CLUSTER_LOG_FORMAT}\""
111-
controllerManager_extra_args="${controllerManager_extra_args}
112-
\"logging-format\": \"${CLUSTER_LOG_FORMAT}\""
113-
apiServer_extra_args="${apiServer_extra_args}
114-
\"logging-format\": \"${CLUSTER_LOG_FORMAT}\""
115-
fi
116-
kubelet_extra_args=" \"v\": \"${KIND_CLUSTER_LOG_LEVEL}\"
117-
\"container-log-max-files\": \"10\"
118-
\"container-log-max-size\": \"100Mi\""
119-
KUBELET_LOG_FORMAT=${KUBELET_LOG_FORMAT:-$CLUSTER_LOG_FORMAT}
120-
if [ -n "$KUBELET_LOG_FORMAT" ]; then
121-
check_structured_log_support "KUBECTL_LOG_FORMAT"
122-
kubelet_extra_args="${kubelet_extra_args}
123-
\"logging-format\": \"${KUBELET_LOG_FORMAT}\""
124-
fi
125-
12690
# JSON or YAML map injected into featureGates config
12791
feature_gates="${FEATURE_GATES:-{\}}"
12892
# --runtime-config argument value passed to the API server, again as a map
@@ -146,29 +110,79 @@ nodes:
146110
featureGates: ${feature_gates}
147111
runtimeConfig: ${runtime_config}
148112
kubeadmConfigPatches:
113+
# v1beta4 for the future (v1.35.0+ ?)
114+
# https://github.com/kubernetes-sigs/kind/issues/3847
115+
# TODO: drop v1beta3 when we no longer need versions that use it
116+
- |
117+
kind: ClusterConfiguration
118+
apiVersion: kubeadm.k8s.io/v1beta4
119+
metadata:
120+
name: config
121+
apiServer:
122+
extraArgs:
123+
- name: "v"
124+
value: "${KIND_CLUSTER_LOG_LEVEL}"
125+
controllerManager:
126+
extraArgs:
127+
- name: "v"
128+
value: "${KIND_CLUSTER_LOG_LEVEL}"
129+
scheduler:
130+
extraArgs:
131+
- name: "v"
132+
value: "${KIND_CLUSTER_LOG_LEVEL}"
133+
---
134+
kind: InitConfiguration
135+
apiVersion: kubeadm.k8s.io/v1beta4
136+
nodeRegistration:
137+
kubeletExtraArgs:
138+
- name: "v"
139+
value: "${KIND_CLUSTER_LOG_LEVEL}"
140+
- name: "container-log-max-files"
141+
value: "10"
142+
- name: "container-log-max-size"
143+
value: "100Mi"
144+
---
145+
kind: JoinConfiguration
146+
apiVersion: kubeadm.k8s.io/v1beta4
147+
nodeRegistration:
148+
kubeletExtraArgs:
149+
- name: "v"
150+
value: "${KIND_CLUSTER_LOG_LEVEL}"
151+
- name: "container-log-max-files"
152+
value: "10"
153+
- name: "container-log-max-size"
154+
value: "100Mi"
155+
# v1beta3 for v1.23.0 ... ?
149156
- |
150157
kind: ClusterConfiguration
158+
apiVersion: kubeadm.k8s.io/v1beta3
151159
metadata:
152160
name: config
153161
apiServer:
154162
extraArgs:
155-
${apiServer_extra_args}
163+
"v": "${KIND_CLUSTER_LOG_LEVEL}"
156164
controllerManager:
157165
extraArgs:
158-
${controllerManager_extra_args}
166+
"v": "${KIND_CLUSTER_LOG_LEVEL}"
159167
scheduler:
160168
extraArgs:
161-
${scheduler_extra_args}
169+
"v": "${KIND_CLUSTER_LOG_LEVEL}"
162170
---
163171
kind: InitConfiguration
172+
apiVersion: kubeadm.k8s.io/v1beta3
164173
nodeRegistration:
165174
kubeletExtraArgs:
166-
${kubelet_extra_args}
175+
"v": "${KIND_CLUSTER_LOG_LEVEL}"
176+
"container-log-max-files": "10"
177+
"container-log-max-size": "100Mi"
167178
---
168179
kind: JoinConfiguration
180+
apiVersion: kubeadm.k8s.io/v1beta3
169181
nodeRegistration:
170182
kubeletExtraArgs:
171-
${kubelet_extra_args}
183+
"v": "${KIND_CLUSTER_LOG_LEVEL}"
184+
"container-log-max-files": "10"
185+
"container-log-max-size": "100Mi"
172186
EOF
173187
# NOTE: must match the number of workers above
174188
NUM_NODES=2

0 commit comments

Comments
 (0)