-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdo-filters.sh
executable file
·33 lines (27 loc) · 1.17 KB
/
do-filters.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# This script deploy envoyfilters which controls metrics generation
# to a cluster in a given namespace.
# The default is to deploy onto cluster named cluster2 and namespace
# external-istiod. If these are not the env, you may use the following
# two env. variable to change the env.
# CLUSTER_NAME
# ISTIO_NAMESPACE
CLUSTER_NAME=${CLUSTER_NAME:-cluster2}
ISTIO_NAMESPACE=${ISTIO_NAMESPACE:-external-istiod}
rm -rf /tmp/istiogen
istioctl manifest generate --set profile=empty \
--set spec.components.pilot.enabled=true -o /tmp/istiogen \
--set values.global.istioNamespace=$ISTIO_NAMESPACE \
--set spec.meshConfig.rootNamespace=${ISTIO_NAMESPACE} > /dev/null 2>&1
ACTION=apply
if [[ $1 != '' ]]; then
ACTION=delete
fi
# The command to get these envoy filters
# yq eval 'select(.kind=="EnvoyFilter")' Pilot.yaml
docker run --rm -v /tmp/istiogen/Base:/workdir mikefarah/yq \
eval 'select(.kind=="EnvoyFilter" and .metadata.name=="*stats-filter-*")' \
/workdir/Pilot/Pilot.yaml > /tmp/istiogen/filters.yaml
# Deploy these filters
echo "Filters are being deployed onto ${CLUSTER_NAME}..."
kubectl ${ACTION} --context kind-${CLUSTER_NAME} -f /tmp/istiogen/filters.yaml