Skip to content

Instantly share code, notes, and snippets.

@incfly
Created June 23, 2018 00:19
Show Gist options
  • Save incfly/b849f4a732f31fa628255509a7e9f545 to your computer and use it in GitHub Desktop.
Save incfly/b849f4a732f31fa628255509a7e9f545 to your computer and use it in GitHub Desktop.
function send_req() {
ITER=${ITER:-3}
for i in `seq 0 $ITER`; do
echo "iteration $i starts...."
for from in "foo" "bar" "legacy"; do
for to in "foo"; do
echo "from ${from}.sleep to ${to}.httpbin"; kubectl exec $(kubectl get pod -l app=sleep -n ${from} -o jsonpath={.items..metadata.name}) -c sleep -n ${from} -- curl http://httpbin.${to}:8000/ip -s ;
done;
done;
echo "iteration $i ends...."
done;
}
function modify_images() {
kubectl get deployment istio-pilot -n istio-system -o yaml > pilot.yaml
awk '{gsub(/gcr.io.istio-release.pilot:release-1.0.0-snapshot.0-20180622-02-34/, "gcr.io/jianfeih-test/pilot:0622-rebuild-a"); print }' pilot.yaml > pilot.modify.yaml
kubectl apply -f pilot.modify.yaml
}
function original_image() {
kubectl apply -f install/kubernetes/istio-demo.yaml
}
function delete_policy() {
kubectl delete policy --all -n foo
}
function create_policy() {
cat <<EOF | istioctl create -n foo -f -
apiVersion: "authentication.istio.io/v1alpha1"
kind: "Policy"
metadata:
name: "foo-httpbin-permissive"
namespace: foo
spec:
targets:
- name: httpbin
peers:
- mtls:
mode: PERMISSIVE
EOF
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment