Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions chaos/network-delay.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
apiVersion: pingcap.com/v1alpha1
kind: NetworkChaos
apiVersion: chaos-mesh.org/v1alpha1
kind: Schedule
metadata:
name: network-delay-example
name: schedule-delay-example
spec:
action: delay
mode: one
selector:
namespaces:
- default
labelSelectors:
"app": "web-show"
delay:
latency: "10ms"
correlation: "100"
jitter: "0ms"
duration: "30s"
scheduler:
cron: "@every 60s"
schedule: '*/1 * * * *'
historyLimit: 2
concurrencyPolicy: 'Allow'
type: 'NetworkChaos'
networkChaos:
action: delay
mode: one
selector:
namespaces:
- default
labelSelectors:
'app': 'web-show'
delay:
latency: '10ms'
correlation: '100'
jitter: '0ms'
duration: '30s'
4 changes: 2 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

TARGET_IP=$(kubectl get pod -n kube-system -o wide| grep kube-controller | head -n 1 | awk '{print $6}')
TARGET_IP=$(kubectl get pod -n kube-system -o wide| grep kube-controller | head -n 1 | awk '{print $8}')

sed "s/TARGETIP/$TARGET_IP/g" deploy/deployment.yaml > deploy/deployment.yamlg

Expand All @@ -12,6 +12,6 @@ kubectl apply -f deploy/

while [[ $(kubectl get pods -l app=web-show -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "waiting for pod running" && sleep 1; done

kill $(lsof -t -i:8081) 2>&1 >/dev/null | True
kill $(lsof -t -i:8081) 2>&1 >/dev/null | true

nohup kubectl port-forward svc/web-show --address 0.0.0.0 8081:8081 2>&1 &