Skip to content

Commit df6fc9d

Browse files
committed
promtorture: work around kapp label bug
work around carvel-dev/kapp#381 where kapp adds unwanted labels that break the kube-prometheus service selctor
1 parent 864ee05 commit df6fc9d

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

testcases/promtorture/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ go build
6161

6262
### Use `k8s-insider` to talk to the services
6363

64+
(No OSX support at time of writing)
65+
6466
See https://github.com/TrueGoric/k8s-insider
6567

6668
Assuming Ubuntu 24.04:
@@ -75,6 +77,15 @@ resolvectl domain insider0 cluster.local
7577

7678
This will give you the ability to directly query kube services like `prometheus-k8s.monitoring.svc.cluster.local` or visit http://grafana.monitoring.svc.cluster.local:3000 directly in a browser.
7779

80+
### Use `socks5` to talk to the services
81+
82+
```
83+
./scripts/socks5
84+
```
85+
86+
Then set your `http_proxy` to `socks5://localhost:1081` and you can use `curl`
87+
etc to talk to the services.
88+
7889
### Grafana dashboard
7990

8091
See [`resources`](./resources/grafana-dashboards/promtorture.json).

testcases/promtorture/scripts/kind-create.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ if [ -f .cache/kube-prometheus/kustomization.yaml ]; then
1919
fi
2020
(cd .cache/kube-prometheus && kustomize create && kustomize edit add resource kube-prometheus.yaml)
2121

22-
kustomize build kubernetes/kube-prometheus | kapp deploy -a kube-prometheus -f - -y
22+
# Deploy it, and stop kapp adding its app labels to work around
23+
# https://github.com/carvel-dev/kapp/issues/381
24+
kustomize build kubernetes/kube-prometheus \
25+
| kapp deploy -a kube-prometheus -y \
26+
--default-label-scoping-rules=false \
27+
--apply-default-update-strategy=fallback-on-replace \
28+
-f -
2329

2430
# vim: et ts=2 sw=2 sts=2 ft=bash ai

testcases/promtorture/scripts/kind-deploy.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ spec:
5353
__END__
5454

5555
kustomize build "${tmpdir}" \
56-
| kapp deploy -a promtorture -f - -y --diff-changes
56+
| kapp deploy -a promtorture -f - -y \
57+
--default-label-scoping-rules=false \
58+
--apply-default-update-strategy=fallback-on-replace \
59+
--diff-changes
5760

5861
echo 1>&2 "Promtorture is running on service 'promtorture' on port 'metrics' (TCP/8080)"
5962

testcases/promtorture/scripts/promapi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function apiQuery() {
4242
local endpoint
4343
endpoint=$1
4444
shift
45-
curl -sL "${@}" 'http://prometheus-k8s.monitoring.svc.cluster.local:9090/'"${endpoint}" | yq --prettyPrint .
45+
curl -sSLf "${@}" 'http://prometheus-k8s.monitoring.svc.cluster.local:9090/'"${endpoint}" | yq --prettyPrint .
4646
}
4747

4848
case "${meta}" in

testcases/promtorture/scripts/socks5

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ set -e -u -o pipefail -x
55
source scripts/config
66

77
echo "use \"curl --socks5-hostname localhost:1081\" to make requests"
8+
echo "or set:"
9+
echo " http_proxy=socks5://localhost:1081 https_proxy=socks5://localhost:1081"
810

911
exec kubectl socks5-proxy -p 1081

0 commit comments

Comments
 (0)