-
Notifications
You must be signed in to change notification settings - Fork 2
131 lines (108 loc) · 5.42 KB
/
kind_thanos.yml
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Thanos setup on kind
on:
workflow_dispatch:
env:
kind-image: 'kindest/node:v1.31.0'
kind-version: 'v0.24.0'
jobs:
thanos_test:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
steps:
- name: Start kind cluster
uses: helm/[email protected]
with:
version: ${{ env.kind-version }}
node_image: ${{ env.kind-image }}
wait: 10s
cluster_name: kind
- name: Wait for cluster to bootstrap and setup thanos operator
run: |
kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout=300s
- name: Clone autotune repository
uses: actions/checkout@v3
with:
repository: kruize/autotune
ref: mvp_demo
path: autotune
- name: Install Prometheus
run: |
cd autotune
echo "Installing prometheus..."
./scripts/prometheus_on_kind.sh -as
- name: Setup thanos operator
run: |
#LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name)
#curl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f -
git clone https://github.com/thanos-community/thanos-operator.git
cd thanos-operator
echo "***********************************"
echo "Install Thanos CRDS"
echo "***********************************"
make install
kubectl get crds -n thanos-operator
echo "***********************************"
echo "Install Thanos operator"
echo "***********************************"
make deploy IMG="quay.io/thanos/thanos-operator:main-2024-12-24-5e131ef"
kubectl get pods -n thanos-operator-system
echo "***********************************"
echo "Install Thanos components"
echo "***********************************"
make install-example
kubectl get pods -n thanos-operator-system
- name: Create tsdb blocks using thanosbench
run: |
echo "***********************************"
echo "Creating TSDB blocks"
echo "***********************************"
git clone -b kruize_profile https://github.com/chandrams/thanosbench.git
cd thanosbench
make build
maxtime=$(date -u +"%Y-%m-%dT%H:%M:%S.000Z")
echo "${maxtime}"
echo " ./thanosbench block plan -p kruize-1d-tiny --max-time="${maxtime}" | ./thanosbench block gen --workers=20 --output.dir=${GITHUB_WORKSPACE}/tsdb"
./thanosbench block plan -p kruize-1d-tiny --max-time="${maxtime}" | ./thanosbench block gen --workers=20 --output.dir=${GITHUB_WORKSPACE}/tsdb
ls ${GITHUB_WORKSPACE}/tsdb
- name: Copy the tsdb blocks to minio
run: |
kubectl port-forward -n thanos-operator-system svc/thanos-query-frontend-example-query 9090:9090 &
kubectl port-forward -n thanos-operator-system svc/minio 9000:9000 &
ps -ef | grep kubectl
curl https://dl.min.io/client/mc/release/linux-amd64/mc --create-dirs -o ${GITHUB_WORKSPACE}/mc
chmod +x ${GITHUB_WORKSPACE}/mc
export PATH=$PATH:${GITHUB_WORKSPACE}
mc alias set myminio http://localhost:9000 thanos thanos-secret
mc cp -r tsdb/* myminio/thanos
- name: Clone autotune repository
uses: actions/checkout@v3
with:
repository: kruize/autotune
ref: mvp_demo
path: autotune
- name: Deploy kruize with thanos datasource
run: |
cd autotune
echo "Deploying kruize..."
manifest_file="./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml"
ds_url="http://127.0.0.1:9090"
sed -i 's/"name": "prometheus-1"/"name": "thanos"/' ${manifest_file}
sed -i 's/"serviceName": "prometheus-k8s"/"serviceName": ""/' ${manifest_file}
sed -i 's/"namespace": "monitoring"/"namespace": ""/' ${manifest_file}
sed -i 's#"url": ""#"url": "'"${ds_url}"'"#' ${manifest_file}
sed -i 's/\([[:space:]]*\)\(storage:\)[[:space:]]*[0-9]\+Mi/\1\2 1Gi/' ${manifest_file}
sed -i 's/\([[:space:]]*\)\(memory:\)[[:space:]]*".*"/\1\2 "2Gi"/; s/\([[:space:]]*\)\(cpu:\)[[:space:]]*".*"/\1\2 "2"/' ${manifest_file}
cat ${manifest_file}
./deploy.sh -c minikube -i quay.io/kruize/autotune_operator:0.3 -m crc
echo "Port forward for kruize"
kubectl port-forward -n monitoring svc/kruize 8080:8080 &
sleep 20
ps -ef | grep port-forward
echo "Creating performance profile..."
curl -s -X POST http://127.0.0.1:8080/createMetricProfile -d @./manifests/autotune/performance-profiles/resource_optimization_local_monitoring.json
echo ""
echo "List Datasources..."
curl POST http://127.0.0.1:8080/datasources
echo ""
echo "Invoking Bulk API..."
curl -s -X POST http://127.0.0.1:8080/bulk -d '{"filter": {"exclude": {"namespace": [], "workload": [], "containers": [], "labels": {}}, "include": {"namespace": [], "workload": [], "containers": [], "labels": {}}}, "datasource": "thanos"}'