-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup-emissary.sh
51 lines (40 loc) · 1.98 KB
/
setup-emissary.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# After that, we'll install Emissary as an ingress controller. The choice
# of ingress controller doesn't actually matter for this demo, we just need
# one to make it easy to get access to the Faces demo.
#
# This is almost straight out of the Emissary quickstart, but we force it
# to one replica to reduce the load on k3d, and we make sure to inject Emissary
# into the mesh.
EMISSARY_VERSION=3.8.0
EMISSARY_CRDS=https://app.getambassador.io/yaml/emissary/$EMISSARY_VERSION/emissary-crds.yaml
EMISSARY_INGRESS=https://app.getambassador.io/yaml/emissary/$EMISSARY_VERSION/emissary-emissaryns.yaml
# If MIRROR_TYPE is unset, assume we're doing flat networks.
if [ -z "$MIRROR_TYPE" ]; then
MIRROR_TYPE=remote-discovery
elif [ "$MIRROR_TYPE" == "gateway" ]; then
# Switch "gateway" to the "true" that the label needs.
MIRROR_TYPE=true
fi
install_emissary () {
ctx="$1"
kubectl --context "$ctx" create namespace emissary && \
curl --proto '=https' --tlsv1.2 -sSfL $EMISSARY_CRDS | \
sed -e 's/replicas: 3/replicas: 1/' | \
kubectl --context "$ctx" apply -f -
kubectl --context "$ctx" wait --timeout=90s --for=condition=available deployment emissary-apiext -n emissary-system
curl --proto '=https' --tlsv1.2 -sSfL $EMISSARY_INGRESS | \
sed -e 's/replicas: 3/replicas: 1/' | \
linkerd --context "$ctx" inject - | kubectl --context "$ctx" apply -f -
kubectl --context "$ctx" label service -n emissary emissary-ingress "mirror.linkerd.io/exported=$MIRROR_TYPE"
kubectl apply --context "$ctx" -f emissary/listeners-and-host.yaml
}
install_emissary us-east
install_emissary us-west
install_emissary eu-central
for ctx in us-east us-west eu-central; do \
kubectl --context "$ctx" -n emissary wait --for condition=available --timeout=90s deploy -lproduct=aes ;\
done
for ctx in us-east us-west; do \
kubectl apply --context "$ctx" -f emissary/auth/region-auth-us.yaml
done
kubectl apply --context eu-central -f emissary/auth/region-auth-eu.yaml