Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding traffic shifting rules to enforce traffic to all west's reviews v2 and v3 workloads #6896

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 46 additions & 0 deletions hack/istio/multicluster/split-bookinfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,52 @@ ${CLIENT_EXE} scale deploy -n ${BOOKINFO_NAMESPACE} reviews-v2 --replicas=0
${CLIENT_EXE} scale deploy -n ${BOOKINFO_NAMESPACE} reviews-v3 --replicas=0
${CLIENT_EXE} scale deploy -n ${BOOKINFO_NAMESPACE} ratings-v1 --replicas=0

echo "==== CREATING TRAFFIC SHIFTING RULES FOR REVIEWS SERVICE"
# This is done to enforce traffic to all reviews workloads (there were ocassions where traffic was not being routed to v3 or v2)
cat <<EOF | ${CLIENT_EXE} apply -f -
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
namespace: ${BOOKINFO_NAMESPACE}
spec:
hosts:
- reviews.bookinfo.svc.cluster.local
http:
- route:
- destination:
host: reviews.bookinfo.svc.cluster.local
subset: v1
weight: 33
- destination:
host: reviews.bookinfo.svc.cluster.local
subset: v2
weight: 33
- destination:
host: reviews.bookinfo.svc.cluster.local
subset: v3
weight: 34
EOF
cat <<EOF | ${CLIENT_EXE} apply -f -
kind: DestinationRule
apiVersion: networking.istio.io/v1beta1
metadata:
name: reviews
namespace: ${BOOKINFO_NAMESPACE}
spec:
host: reviews.bookinfo.svc.cluster.local
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
- name: v3
labels:
version: v3
EOF

if [ "${IS_OPENSHIFT}" == "true" ]; then
INGRESS_HOST=$(${CLIENT_EXE} -n ${ISTIO_NAMESPACE} get route istio-ingressgateway -o jsonpath='{.spec.host}')
else
Expand Down