Skip to content

Commit b66228f

Browse files
Added two more tests regarding the robustness K8s standard, namely "maxMutatingRequestInflight" and "minRequestTimeout".
1 parent 98ae7c7 commit b66228f

File tree

4 files changed

+410
-47
lines changed

4 files changed

+410
-47
lines changed
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Makefile
2+
# This makefile is for development purpose
3+
4+
SHELL = /bin/bash
5+
#SED ?= sed
6+
7+
DOCKERFILE="Dockerfile"
8+
IMAGE_REGISTRY="ghcr.io/sovereigncloudstack/standards"
9+
IMAGE_NAME="scsconformance"
10+
#IMAGE_VERSION_TAG ="v0.1.2"
11+
12+
KIND_CLUSTER ="testcluster"
13+
14+
#PLUGIN_NAME="k8s-default-storage-class-plugin-go"
15+
PLUGIN_NAME="plugin"
16+
PLUGIN_FILE="${PLUGIN_NAME}.yaml"
17+
18+
#~ SONO_WAIT = 1
19+
#~ SONO_TIMEOUT = 60
20+
21+
KUBERNETES_SERVICE_HOST=127.0.0.1
22+
KUBERNETES_SERVICE_PORT=34743
23+
24+
25+
###############################################################################
26+
## Helpers: ##
27+
###############################################################################
28+
29+
ifeq ($(IMAGE_VERSION_TAG),)
30+
export TAG=dev
31+
else
32+
export TAG=${IMAGE_VERSION_TAG}
33+
endif
34+
35+
SONOBUOY_IMAGE = "${IMAGE_REGISTRY}/${IMAGE_NAME}:${TAG}"
36+
37+
container-init:
38+
@echo ""
39+
@echo "[ContainerImageName] ${SONOBUOY_IMAGE}"
40+
@echo "[SonobuoyPluginFile] ${PLUGIN_FILE}"
41+
@echo ""
42+
43+
44+
kind-init:
45+
@echo ""
46+
@echo "[KindCluster] ${KIND_CLUSTER}"
47+
@echo ""
48+
49+
50+
###############################################################################
51+
## For develpoment usage: ##
52+
###############################################################################
53+
54+
dev-prerequests:
55+
@echo "[check-test-setup]"
56+
@kind version
57+
@docker version
58+
@sonobuoy version --short
59+
@go version
60+
61+
62+
dev-setup: kind-init
63+
kind create cluster --name ${KIND_CLUSTER} --config kind-config.yaml
64+
65+
66+
dev-build: container-init
67+
@echo "[build]"
68+
DOCKER_BUILDKIT=1 docker build . -f ${DOCKERFILE} -t ${SONOBUOY_IMAGE}
69+
kind load docker-image --name ${KIND_CLUSTER} ${SONOBUOY_IMAGE}
70+
71+
72+
dev-go:
73+
@echo "[go]"
74+
@echo "[KubernetesService] ${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}"
75+
@rm -rf ./build || true
76+
@mkdir ./build
77+
go test -c -o ./build ./...
78+
# go test -c -o ./build ./... --args --skip-labels="type=pod-list"
79+
# go tool test2json ./build -test.v
80+
81+
82+
dev-run:
83+
@echo "[run-test]"
84+
@echo "sonobuoy run --plugin ${PLUGIN_FILE} --wait=${SONO_WAIT} --timeout=${SONO_TIMEOUT}"
85+
#~ @sonobuoy run --plugin ${PLUGIN_FILE} --wait=${SONO_WAIT} --timeout=${SONO_TIMEOUT}
86+
@sonobuoy run --plugin ${PLUGIN_FILE}
87+
@sonobuoy status
88+
89+
90+
dev-result:
91+
@echo "[result]"
92+
#outfile=$(sonobuoy retrieve) && mkdir results && tar -xf ${outfile} -C results
93+
sonobuoy retrieve
94+
sonobuoy results *.tar.gz
95+
mkdir results
96+
tar -xf *.tar.gz -C results
97+
98+
99+
dev-clean:
100+
@echo "[clean]"
101+
@sonobuoy delete --all --wait || true
102+
@sonobuoy status || true
103+
@rm -rf *.tar.gz || true
104+
@rm -rf results || true
105+
106+
107+
dev-purge: kind-init dev-clean
108+
@echo "[purge]"
109+
kind delete cluster --name ${KIND_CLUSTER} || true
110+
docker rmi ${SONOBUOY_IMAGE} || true
111+
112+
113+
dev-rerun: dev-clean dev-build dev-run
114+
@echo "[rerun] Waiting for tests to complete..."
115+
# Poll sonobuoy status until it shows "complete"
116+
while true; do \
117+
status_output=$$(sonobuoy status); \
118+
echo "$$status_output"; \
119+
if echo "$$status_output" | grep -q "complete"; then \
120+
echo "Tests completed."; \
121+
break; \
122+
fi; \
123+
sleep 5; \
124+
done
125+
@echo "[rerun] Waiting an additional 10 seconds to ensure results are ready..."
126+
sleep 30
127+
$(MAKE) dev-result
128+
@echo "[Displaying results...]"
129+
cat results/plugins/scsconformance/sonobuoy_results.yaml
130+
cat results/plugins/scsconformance/results/global/out.json
131+
132+
PHONY: dev-prerequests dev-build dev-run dev-result dev-clean dev-clean dev-purge
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# kind-config.yaml
2+
kind: Cluster
3+
apiVersion: kind.x-k8s.io/v1alpha4
4+
kubeadmConfigPatches:
5+
- |
6+
apiVersion: kubeadm.k8s.io/v1beta2
7+
kind: ClusterConfiguration
8+
apiServer:
9+
extraArgs:
10+
enable-admission-plugins: EventRateLimit
11+
admission-control-config-file: /etc/kubernetes/admission-control-config.yaml
12+
feature-gates": APIPriorityAndFairness=true
13+
nodes:
14+
- role: control-plane
15+
extraMounts:
16+
- hostPath: ./event-ratelimit-config.yaml
17+
containerPath: /etc/kubernetes/admission-control-config.yaml
18+
- role: worker
19+
- role: worker
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# event-ratelimit-config.yaml
2+
kind: Configuration
3+
apiVersion: eventratelimit.admission.k8s.io/v1alpha1
4+
limits:
5+
- burst: 20000
6+
qps: 5000
7+
type: Server
8+

0 commit comments

Comments
 (0)