diff --git a/chaos/network-delay.yaml b/chaos/network-delay.yaml index 63b8d81..c22c18e 100644 --- a/chaos/network-delay.yaml +++ b/chaos/network-delay.yaml @@ -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" \ No newline at end of file + 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' diff --git a/deploy.sh b/deploy.sh index 386eac3..3b51a9d 100755 --- a/deploy.sh +++ b/deploy.sh @@ -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 @@ -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 &