Skip to content

Commit

Permalink
Adding Bucket-config in configMap instead on prometheus Repository.
Browse files Browse the repository at this point in the history
Signed-off-by: Kushal Shukla <[email protected]>
  • Loading branch information
kushalShukla-web committed Dec 14, 2024
1 parent 23a7a07 commit 39e9543
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 71 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: blocksync-config
namespace: prombench-{{ .PR_NUMBER }}
data:
bucket-config.yml: |
path: gendata
minTime: 1729694072541
maxTime: 1729706400000
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -45,15 +56,13 @@ spec:
value: "{{ .GITHUB_ORG }}"
- name: GITHUB_REPO
value: "{{ .GITHUB_REPO }}"
- name: STORAGE
value: "/storage-paths"
volumeMounts:
- name: prometheus-executable
mountPath: /prometheus-builder
- name: key
mountPath: /storage-paths
- name: data-downloader
image: docker.io/prominfra/block-sync:master
image: kushalshukla/writer
imagePullPolicy: Always
volumeMounts:
- name: instance-ssd
Expand Down Expand Up @@ -107,7 +116,8 @@ spec:
secret:
secretName: bucket-secret
- name: key
emptyDir: {}
configMap:
name: blocksync-config
terminationGracePeriodSeconds: 300
nodeSelector:
node-name: prometheus-{{ .PR_NUMBER }}
Expand Down Expand Up @@ -165,24 +175,8 @@ spec:
securityContext:
runAsUser: 0
initContainers:
- name: download-key
image: docker.io/prominfra/prometheus-builder:master
imagePullPolicy: Always
command: [ "/go/src/github.com/key.sh" ]
env:
- name: PR_NUMBER
value: "{{ .PR_NUMBER }}"
- name: GITHUB_ORG
value: "{{ .GITHUB_ORG }}"
- name: GITHUB_REPO
value: "{{ .GITHUB_REPO }}"
- name: STORAGE
value: "/storage-paths"
volumeMounts:
- name: key
mountPath: /storage-paths
- name: data-downloader
image: docker.io/prominfra/block-sync:master
image: kushalshukla/writer
imagePullPolicy: Always
volumeMounts:
- name: instance-ssd
Expand Down Expand Up @@ -224,7 +218,8 @@ spec:
secret:
secretName: bucket-secret
- name: key
emptyDir: {}
configMap:
name: blocksync-config
terminationGracePeriodSeconds: 300
nodeSelector:
node-name: prometheus-{{ .PR_NUMBER }}
Expand Down
4 changes: 1 addition & 3 deletions tools/prometheus-builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ RUN mkdir -p /go/src/github.com

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

COPY ./key.sh /go/src/github.com/key.sh

RUN chmod +x /go/src/github.com/*
RUN chmod +x /go/src/github.com/build.sh

ENTRYPOINT ["/go/src/github.com/build.sh"]
12 changes: 1 addition & 11 deletions tools/prometheus-builder/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

DIR="/go/src/github.com/prometheus/prometheus"

if [[ -z $PR_NUMBER || -z $VOLUME_DIR || -z $STORAGE || -z $GITHUB_ORG || -z $GITHUB_REPO ]]; then
if [[ -z $PR_NUMBER || -z $VOLUME_DIR || -z $GITHUB_ORG || -z $GITHUB_REPO ]]; then
echo "ERROR:: environment variables not set correctly"
exit 1;
fi
Expand All @@ -24,16 +24,6 @@ fi

git checkout pr-branch

# Here, STORAGE is specified as an environment variable of the prometheus-builder init container,
# where it will copy the bucket-config.yml file from the Prometheus directory to the volume section of the
# emptyDir. This file will later be used by the data-downloader init container.
if [ -f "$DIR/bucket-config.yml" ]; then
echo "INFO:: bucket-config.yml file is Present on $DIR/bucket-config.yml directory so download the block from ObjecStorage."
cp "$DIR/bucket-config.yml" "$STORAGE/bucket-config.yml"
else
echo "INFO:: bucket-config.yml File does not exist on $DIR/bucket-config.yml directory so data is not downloaded from ObjectStorage."
fi

echo ">> Creating prometheus binaries"
if ! make build PROMU_BINARIES="prometheus"; then
echo "ERROR:: Building of binaries failed"
Expand Down
35 changes: 0 additions & 35 deletions tools/prometheus-builder/key.sh

This file was deleted.

0 comments on commit 39e9543

Please sign in to comment.