-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdeploy-remote.sh
More file actions
executable file
·70 lines (59 loc) · 2.88 KB
/
Copy pathdeploy-remote.sh
File metadata and controls
executable file
·70 lines (59 loc) · 2.88 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
set -euo pipefail
trap 's=$?; echo >&2 "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
for cmd in "kubectl" "helm" "jq"; do
type $cmd >/dev/null 2>&1 || { echo >&2 "$cmd required but it's not installed; aborting."; exit 1; }
done
CENTRAL=${CENTRAL:-lgtm-central}
CERT_ISSUER_ID=${CERT_ISSUER_ID:-issuer-remote}
CONTEXT=${CONTEXT:-lgtm-remote}
SUBNET=${SUBNET:-240} # Last octet from the /29 CIDR subnet to use for LoadBalancer IPs
WORKERS=${WORKERS:-1}
CLUSTER_ID=${CLUSTER_ID:-2} # Unique on each cluster
POD_CIDR=${POD_CIDR:-10.21.0.0/16} # Unique on each cluster
SVC_CIDR=${SVC_CIDR:-10.22.0.0/16} # Unique on each cluster
CILIUM_CLUSTER_MESH_ENABLED=${CILIUM_CLUSTER_MESH_ENABLED:-no} # no for Linkerd or Istio, yes for Cilium CM
ISTIO_ENABLED=${ISTIO_ENABLED:-no} # no for Linkerd, yes for Istio
LOG_SHIPPER=${LOG_SHIPPER:-vector} # vector or fluentbit
APP_NS="tns" # Used by deploy-mesh.sh
echo "Updating Helm Repositories"
helm repo add jetstack https://charts.jetstack.io
helm repo add linkerd https://helm.linkerd.io/stable
helm repo add linkerd-edge https://helm.linkerd.io/edge
helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add grafana https://grafana.github.io/helm-charts
helm repo add vector https://helm.vector.dev
helm repo add fluent https://fluent.github.io/helm-charts
helm repo add metallb https://metallb.github.io/metallb
helm repo update &> /dev/null
echo "Deploying Kubernetes"
. deploy-kind.sh
echo "Deploying Prometheus CRDs"
helm upgrade --install prometheus-crds prometheus-community/prometheus-operator-crds
echo "Deploying Mesh"
if [[ "${LOG_SHIPPER}" == "fluentbit" ]]; then
FILES=("grafana-remote-config.alloy" "values-prometheus-remote.yaml" "values-fluentbit-remote.yaml")
else
FILES=("grafana-remote-config.alloy" "values-prometheus-remote.yaml" "values-vector-remote.yaml")
fi
. deploy-mesh.sh
echo "Deploying Prometheus (for Metrics)"
helm upgrade --install monitor prometheus-community/kube-prometheus-stack \
-n observability -f values-prometheus-common.yaml -f /tmp/values-prometheus-remote.yaml --wait
if [[ "${LOG_SHIPPER}" == "fluentbit" ]]; then
echo "Deploying Fluent Bit (for Logs)"
helm upgrade --install fluent-bit fluent/fluent-bit \
-n observability -f values-fluentbit-common.yaml -f /tmp/values-fluentbit-remote.yaml --wait
else
echo "Deploying Vector (for Logs)"
helm upgrade --install vector vector/vector \
-n observability -f values-vector-common.yaml -f /tmp/values-vector-remote.yaml --wait
fi
echo "Deploying Grafana Alloy (for Traces)"
helm upgrade --install alloy -n observability grafana/alloy \
-f values-alloy.yaml \
--set-file alloy.configMap.content=/tmp/grafana-remote-config.alloy \
--wait
echo "Deploying Grafana TNS application"
kubectl apply -n ${APP_NS} -f grafana-tns-apps.yaml