-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathprovision-chart-vector.sh
60 lines (56 loc) · 1.8 KB
/
provision-chart-vector.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
52
53
54
55
56
57
58
59
60
#!/bin/bash
source /vagrant/lib.sh
# vector chart.
# see https://artifacthub.io/packages/helm/vector/vector
# see https://github.com/vectordotdev/helm-charts
# see https://vector.dev/docs/setup/installation/package-managers/helm/
vector_chart_version="${1:-0.22.0}"; shift || true
pandora_ip_address="${1:-10.10.0.2}"; shift || true
# add the vector helm charts repository.
helm repo add vector https://helm.vector.dev
helm repo update
# search the chart and app versions, e.g.: in this case we are using:
# NAME CHART VERSION APP VERSION DESCRIPTION
# vector/vector 0.22.0 0.30.0-distroless-libc A lightweight, ultra-fast tool for building obs...
helm search repo vector/vector --versions | head -5
# install.
# see https://vector.dev/docs/reference/configuration/sources/kubernetes_logs
# NB in talos, the /var partition is ephemeral and will be erased at the next
# upgrade. this means the logs and the vector data_dir will be lost.
# see https://www.talos.dev/v1.4/learn-more/architecture/
kubectl apply -f - <<'EOF'
apiVersion: v1
kind: Namespace
metadata:
name: logging-system
labels:
pod-security.kubernetes.io/enforce: privileged
pod-security.kubernetes.io/audit: privileged
pod-security.kubernetes.io/warn: privileged
EOF
helm upgrade --install \
vector \
vector/vector \
--version $vector_chart_version \
--namespace logging-system \
--values <(cat <<EOF
role: Agent
service:
enabled: false
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/control-plane
operator: Exists
persistence:
hostPath:
path: /var/vector
customConfig:
data_dir: /var/vector
$(
sed \
-E "s,http://localhost:3100,http://$pandora_ip_address:3100,g" \
/vagrant/vector-k8s.yml \
| sed -E 's,\{\{,{{ "{{" }},g' \
| sed -E 's,^, ,g')
EOF
)