Skip to content

Commit b18501c

Browse files
Added yaml file changes and prometheus builder changes that was removed
from block-sync. Signed-off-by: Kushal Shukla <[email protected]>
1 parent 9e660d4 commit b18501c

File tree

5 files changed

+114
-2
lines changed

5 files changed

+114
-2
lines changed

prombench/docs/kind.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,20 @@ If used with the GitHub integration:
114114
export PR_NUMBER=<PR to benchmark against the selected $RELEASE>
115115
```
116116

117-
2. Deploy the Kubernetes objects:
117+
2. Before applying benchmarking objects , You have two choices to make:
118+
- **Option 1: Download data from object storage**
119+
120+
To download data from object storage, create a Kubernetes secret with exact named `bucket-config` and file name ```object-config.yml``` with the necessary credentials as per your object storage. This secret enables access to the stored data.
121+
> Note: Make sure this secret applied before ```3b_prometheus-test_deployment.yaml```
122+
- **Option 2: Skip downloading data**
123+
124+
If you don’t need to download data, edit the `3b_prometheus-test_deployment.yaml` file:
125+
126+
- Remove the `bucket-config` volume section from.
127+
- Remove the `volumeMount` section name `bucket-config` from `data-downloader`.
128+
> Note: You have to remove these two sections from both prometheus-test-pr-{{ .PR_NUMBER }} and prometheus-test-{{ normalise .RELEASE }} deployments.
129+
130+
3. Deploy the Kubernetes objects:
118131
> **_Note:_** If you encounter a `too many files open` error caused by promtail, increase the default value of `/proc/sys/fs/inotify/max_user_instances` from 128 to 512:
119132
> ```bash
120133
> sudo sysctl fs.inotify.max_user_instances=512

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

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
runAsUser: 0
3535
initContainers:
3636
- name: prometheus-builder
37-
image: docker.io/prominfra/prometheus-builder:master
37+
image: kushalshukla/builder
3838
imagePullPolicy: Always
3939
env:
4040
- name: PR_NUMBER
@@ -48,6 +48,18 @@ spec:
4848
volumeMounts:
4949
- name: prometheus-executable
5050
mountPath: /prometheus-builder
51+
- name: key
52+
mountPath: /config
53+
- name: data-downloader
54+
image: kushalshukla/writer
55+
imagePullPolicy: Always
56+
volumeMounts:
57+
- name: instance-ssd
58+
mountPath: /data
59+
- name: bucket-config
60+
mountPath: /config
61+
- name: key
62+
mountPath: /key
5163
containers:
5264
- name: prometheus
5365
image: quay.io/prometheus/busybox:latest
@@ -88,6 +100,11 @@ spec:
88100
path: /mnt/disks/ssd0 #gke ssds
89101
- name: prometheus-executable
90102
emptyDir: {}
103+
- name: bucket-config # Define the Secret volume
104+
secret:
105+
secretName: bucket-secret
106+
- name: key
107+
emptyDir: {}
91108
terminationGracePeriodSeconds: 300
92109
nodeSelector:
93110
node-name: prometheus-{{ .PR_NUMBER }}
@@ -144,6 +161,31 @@ spec:
144161
- prometheus
145162
securityContext:
146163
runAsUser: 0
164+
initContainers:
165+
- name: download-key
166+
image: kushalshukla/builder
167+
imagePullPolicy: Always
168+
command: [ "/download-key/key.sh" ]
169+
env:
170+
- name: PR_NUMBER
171+
value: "{{ .PR_NUMBER }}"
172+
- name: GITHUB_ORG
173+
value: "{{ .GITHUB_ORG }}"
174+
- name: GITHUB_REPO
175+
value: "{{ .GITHUB_REPO }}"
176+
volumeMounts:
177+
- name: key
178+
mountPath: /config
179+
- name: data-downloader
180+
image: kushalshukla/writer
181+
imagePullPolicy: Always
182+
volumeMounts:
183+
- name: instance-ssd
184+
mountPath: /data
185+
- name: bucket-config
186+
mountPath: /config
187+
- name: key
188+
mountPath: /key
147189
containers:
148190
- name: prometheus
149191
image: quay.io/prometheus/prometheus:{{ .RELEASE }}
@@ -172,6 +214,14 @@ spec:
172214
# /mnt is where GKE keeps it's SSD
173215
# don't change this if you want Prometheus to take advantage of these local SSDs
174216
path: /mnt/disks/ssd0
217+
- name: config
218+
hostPath:
219+
path: /object-config
220+
- name: bucket-config # Define the Secret volume
221+
secret:
222+
secretName: bucket-secret
223+
- name: key
224+
emptyDir: {}
175225
terminationGracePeriodSeconds: 300
176226
nodeSelector:
177227
node-name: prometheus-{{ .PR_NUMBER }}

tools/prometheus-builder/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ RUN mkdir -p /go/src/github.com
44

55
COPY ./build.sh /go/src/github.com/build.sh
66

7+
COPY ./key.sh /download-key/key.sh
8+
79
RUN chmod +x /go/src/github.com/build.sh
810

911
ENTRYPOINT ["/go/src/github.com/build.sh"]

tools/prometheus-builder/build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ fi
2424

2525
git checkout pr-branch
2626

27+
# Here, MKDIR is specified in the volumeMount section of the prometheus-builder init container,
28+
# where it will copy the key.yml file from the Prometheus directory to the volume section of the
29+
# emptyDir. This file will later be used by the data-downloader init container.
30+
MKDIR="/config"
31+
if [ -f "$DIR/key.yml" ]; then
32+
echo "File exists."
33+
cp "$DIR/key.yml" "$MKDIR/key.yml"
34+
else
35+
echo "File does not exist."
36+
fi
37+
2738
echo ">> Creating prometheus binaries"
2839
if ! make build PROMU_BINARIES="prometheus"; then
2940
echo "ERROR:: Building of binaries failed"

tools/prometheus-builder/key.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
DIR="/go/src/github.com/prometheus/prometheus"
4+
5+
if [[ -z $PR_NUMBER || -z $VOLUME_DIR || -z $GITHUB_ORG || -z $GITHUB_REPO ]]; then
6+
echo "ERROR:: environment variables not set correctly"
7+
exit 1;
8+
fi
9+
10+
# Clone the repository with a shallow clone
11+
echo ">> Cloning repository $GITHUB_ORG/$GITHUB_REPO (shallow clone)"
12+
if ! git clone --depth 1 https://github.com/$GITHUB_ORG/$GITHUB_REPO.git $DIR; then
13+
echo "ERROR:: Cloning of repo $GITHUB_ORG/$GITHUB_REPO failed"
14+
exit 1;
15+
fi
16+
17+
cd $DIR || exit 1
18+
19+
echo ">> Fetching Pull Request $GITHUB_ORG/$GITHUB_REPO/pull/$PR_NUMBER"
20+
if ! git fetch origin pull/$PR_NUMBER/head:pr-branch; then
21+
echo "ERROR:: Fetching of PR $PR_NUMBER failed"
22+
exit 1;
23+
fi
24+
25+
git checkout pr-branch
26+
27+
# Here, MKDIR is specified in the volumeMount section of the prometheus-builder init container,
28+
# where it will copy the key.yml file from the Prometheus directory to the volume section of the
29+
# emptyDir. This file will later be used by the data-downloader init container.
30+
MKDIR="/config"
31+
if [ -f "$DIR/key.yml" ]; then
32+
echo "File exists."
33+
cp "$DIR/key.yml" "$MKDIR/key.yml"
34+
else
35+
echo "File does not exist."
36+
fi

0 commit comments

Comments
 (0)