Skip to content

Instantly share code, notes, and snippets.

@rjhowe
Last active February 12, 2025 18:15
Show Gist options
  • Save rjhowe/959b46b339f9b795b3056b7c9ee3422a to your computer and use it in GitHub Desktop.
Save rjhowe/959b46b339f9b795b3056b7c9ee3422a to your computer and use it in GitHub Desktop.
Curl loop DS
---
apiVersion: v1
kind: Namespace
metadata:
name: openshift4-debug
labels:
app: openshift4-debug
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: openshift4-debug
namespace: openshift4-debug
labels:
app: openshift4-debug
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: curl-debug
namespace: openshift4-debug
labels:
app: curl-debug
spec:
selector:
matchLabels:
app: curl-debug
template:
metadata:
labels:
app: curl-debug
spec:
tolerations:
- operator: Exists
nodeSelector:
curl-debug: "true"
containers:
- name: curl-debug
env:
- name: URL
value: "https://google.com:443/health"
command:
- /bin/sh
- -c
- |
#!/bin/sh
trap 'echo "Container A terminated"; exit 0' SIGTERM
while true; do
curl_output=$(curl -ks -m 1 -o /dev/null -w 'source": "%{local_ip}:%{local_port}","remote": "%{remote_ip}:%{remote_port}","lookup": "%{time_namelookup}","connect": "%{time_connect}","total": "%{time_total}","http_code": "%{http_code}' $URL);
printf '{"pod_name": "%s", "%s"}\n' "$dnspod" "$curl_output"
sleep 2
done
image: registry.redhat.io/openshift4/ose-cli
imagePullPolicy: Always
resources:
limits:
memory: 400Mi
requests:
cpu: 100m
memory: 400Mi
serviceAccount: openshift4-debug
serviceAccountName: openshift4-debug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment