Skip to content

Commit 463c17b

Browse files
Integrated block sync with Prometheus Released version and Pr version.
Signed-off-by: Kushal Shukla <[email protected]>
1 parent 67d4f05 commit 463c17b

File tree

3 files changed

+53
-29
lines changed

3 files changed

+53
-29
lines changed

prombench/manifests/prombench/benchmark/3b_prometheus-test_deployment.yaml

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
apiVersion: v1
2-
kind: ConfigMap
3-
metadata:
4-
name: data
5-
namespace: prombench-{{ .PR_NUMBER }}
6-
data:
7-
minio-config.yaml: |
8-
type: S3
9-
config:
10-
bucket: thanos-bucket
11-
endpoint: minio:9000
12-
access_key: ROOTNAME
13-
secret_key: CHANGEME123
14-
insecure: true
15-
---
161
apiVersion: apps/v1
172
kind: Deployment
183
metadata:
@@ -49,7 +34,7 @@ spec:
4934
runAsUser: 0
5035
initContainers:
5136
- name: prometheus-builder
52-
image: docker.io/prominfra/prometheus-builder:master
37+
image: kushalshukla/builder
5338
imagePullPolicy: Always
5439
env:
5540
- name: PR_NUMBER
@@ -63,18 +48,20 @@ spec:
6348
volumeMounts:
6449
- name: prometheus-executable
6550
mountPath: /prometheus-builder
51+
- name: config
52+
mountPath: /config
6653
- name: data-downloader
67-
image: kushalshukla/writer:latest
68-
imagePullPolicy: Always
54+
image: kushalshukla/writer
55+
imagePullPolicy: Always
6956
volumeMounts:
7057
- name: instance-ssd
7158
mountPath: /data
72-
- name: minio-config
73-
mountPath: /mnc
59+
- name: config
60+
mountPath: /mnc
7461
args: [
7562
"download",
7663
"--tsdb-path=/data",
77-
"--objstore.config-file=/mnc/minio-config.yaml",
64+
"--objstore.config-file=/mnc/objectconfig.yml",
7865
"--key=gendata"
7966
]
8067
containers:
@@ -112,14 +99,14 @@ spec:
11299
- name: config-volume
113100
configMap:
114101
name: prometheus-test
115-
- name: minio-config
116-
configMap:
117-
name: data
118102
- name: instance-ssd
119103
hostPath:
120104
path: /mnt/disks/ssd0 #gke ssds
121105
- name: prometheus-executable
122106
emptyDir: {}
107+
- name: config
108+
hostPath:
109+
path: /config-file
123110
terminationGracePeriodSeconds: 300
124111
nodeSelector:
125112
node-name: prometheus-{{ .PR_NUMBER }}
@@ -176,11 +163,42 @@ spec:
176163
- prometheus
177164
securityContext:
178165
runAsUser: 0
166+
initContainers:
167+
- name: git-fetcher
168+
image: alpine/git
169+
command:
170+
- /bin/sh
171+
- -c
172+
- |
173+
apk add --no-cache bash && \
174+
git clone --depth 1 https://github.com/{{ .GITHUB_ORG }}/{{ .GITHUB_REPO }}.git /repo1 && \
175+
cd /repo1 && \
176+
git fetch origin pull/{{ .PR_NUMBER }}/head:pr-branch && \
177+
git checkout pr-branch && \
178+
cp objectconfig.yml /mnt/repo/objectconfig.yml && \
179+
rm -rf /repo1
180+
volumeMounts:
181+
- name: config
182+
mountPath: /mnt/repo
183+
- name: data-downloader
184+
image: kushalshukla/writer
185+
imagePullPolicy: Always
186+
volumeMounts:
187+
- name: instance-ssd
188+
mountPath: /data
189+
- name: config
190+
mountPath: /mnc
191+
args: [
192+
"download",
193+
"--tsdb-path=/data",
194+
"--objstore.config-file=/mnc/objectconfig.yml",
195+
"--key=gendata"
196+
]
179197
containers:
180198
- name: prometheus
181199
image: quay.io/prometheus/prometheus:{{ .RELEASE }}
182200
imagePullPolicy: Always
183-
command: [ "/bin/prometheus" ]
201+
command: [ "/bin/prometheus"]
184202
args: [
185203
"--web.external-url=http://{{ .DOMAIN_NAME }}/{{ .PR_NUMBER }}/prometheus-release",
186204
"--storage.tsdb.path=/prometheus",
@@ -204,6 +222,9 @@ spec:
204222
# /mnt is where GKE keeps it's SSD
205223
# don't change this if you want Prometheus to take advantage of these local SSDs
206224
path: /mnt/disks/ssd0
225+
- name: config
226+
hostPath:
227+
path: /object-config
207228
terminationGracePeriodSeconds: 300
208229
nodeSelector:
209230
node-name: prometheus-{{ .PR_NUMBER }}

tools/block-sync/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ LABEL maintainer="The Prometheus Authors <[email protected]
33

44
RUN apk --no-cache add libc6-compat
55

6-
COPY ./block-sync /bin/blocksyncer
6+
COPY ./block-sync /bin/block-sync
77

8-
RUN chmod +x /bin/blocksyncer
8+
RUN chmod +x /bin/block-sync
99

10-
ENTRYPOINT ["/bin/blocksyncer"]
10+
ENTRYPOINT ["/bin/block-sync"]

tools/prometheus-builder/build.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if [[ -z $PR_NUMBER || -z $VOLUME_DIR || -z $GITHUB_ORG || -z $GITHUB_REPO ]]; t
66
echo "ERROR:: environment variables not set correctly"
77
exit 1;
88
fi
9-
9+
1010
# Clone the repository with a shallow clone
1111
echo ">> Cloning repository $GITHUB_ORG/$GITHUB_REPO (shallow clone)"
1212
if ! git clone --depth 1 https://github.com/$GITHUB_ORG/$GITHUB_REPO.git $DIR; then
@@ -24,6 +24,9 @@ fi
2424

2525
git checkout pr-branch
2626

27+
MKDIR="/config"
28+
cp "$DIR/objectconfig.yml" "$MKDIR/objectconfig.yml"
29+
2730
echo ">> Creating prometheus binaries"
2831
if ! make build PROMU_BINARIES="prometheus"; then
2932
echo "ERROR:: Building of binaries failed"

0 commit comments

Comments
 (0)