Skip to content

Commit

Permalink
Integrated block sync with Prometheus Released version and Pr version.
Browse files Browse the repository at this point in the history
Signed-off-by: Kushal Shukla <[email protected]>
  • Loading branch information
kushalShukla-web committed Oct 21, 2024
1 parent 67d4f05 commit 463c17b
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: data
namespace: prombench-{{ .PR_NUMBER }}
data:
minio-config.yaml: |
type: S3
config:
bucket: thanos-bucket
endpoint: minio:9000
access_key: ROOTNAME
secret_key: CHANGEME123
insecure: true
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -49,7 +34,7 @@ spec:
runAsUser: 0
initContainers:
- name: prometheus-builder
image: docker.io/prominfra/prometheus-builder:master
image: kushalshukla/builder
imagePullPolicy: Always
env:
- name: PR_NUMBER
Expand All @@ -63,18 +48,20 @@ spec:
volumeMounts:
- name: prometheus-executable
mountPath: /prometheus-builder
- name: config
mountPath: /config
- name: data-downloader
image: kushalshukla/writer:latest
imagePullPolicy: Always
image: kushalshukla/writer
imagePullPolicy: Always
volumeMounts:
- name: instance-ssd
mountPath: /data
- name: minio-config
mountPath: /mnc
- name: config
mountPath: /mnc
args: [
"download",
"--tsdb-path=/data",
"--objstore.config-file=/mnc/minio-config.yaml",
"--objstore.config-file=/mnc/objectconfig.yml",
"--key=gendata"
]
containers:
Expand Down Expand Up @@ -112,14 +99,14 @@ spec:
- name: config-volume
configMap:
name: prometheus-test
- name: minio-config
configMap:
name: data
- name: instance-ssd
hostPath:
path: /mnt/disks/ssd0 #gke ssds
- name: prometheus-executable
emptyDir: {}
- name: config
hostPath:
path: /config-file
terminationGracePeriodSeconds: 300
nodeSelector:
node-name: prometheus-{{ .PR_NUMBER }}
Expand Down Expand Up @@ -176,11 +163,42 @@ spec:
- prometheus
securityContext:
runAsUser: 0
initContainers:
- name: git-fetcher
image: alpine/git
command:
- /bin/sh
- -c
- |
apk add --no-cache bash && \
git clone --depth 1 https://github.com/{{ .GITHUB_ORG }}/{{ .GITHUB_REPO }}.git /repo1 && \
cd /repo1 && \
git fetch origin pull/{{ .PR_NUMBER }}/head:pr-branch && \
git checkout pr-branch && \
cp objectconfig.yml /mnt/repo/objectconfig.yml && \
rm -rf /repo1
volumeMounts:
- name: config
mountPath: /mnt/repo
- name: data-downloader
image: kushalshukla/writer
imagePullPolicy: Always
volumeMounts:
- name: instance-ssd
mountPath: /data
- name: config
mountPath: /mnc
args: [
"download",
"--tsdb-path=/data",
"--objstore.config-file=/mnc/objectconfig.yml",
"--key=gendata"
]
containers:
- name: prometheus
image: quay.io/prometheus/prometheus:{{ .RELEASE }}
imagePullPolicy: Always
command: [ "/bin/prometheus" ]
command: [ "/bin/prometheus"]
args: [
"--web.external-url=http://{{ .DOMAIN_NAME }}/{{ .PR_NUMBER }}/prometheus-release",
"--storage.tsdb.path=/prometheus",
Expand All @@ -204,6 +222,9 @@ spec:
# /mnt is where GKE keeps it's SSD
# don't change this if you want Prometheus to take advantage of these local SSDs
path: /mnt/disks/ssd0
- name: config
hostPath:
path: /object-config
terminationGracePeriodSeconds: 300
nodeSelector:
node-name: prometheus-{{ .PR_NUMBER }}
Expand Down
6 changes: 3 additions & 3 deletions tools/block-sync/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ LABEL maintainer="The Prometheus Authors <[email protected]

RUN apk --no-cache add libc6-compat

COPY ./block-sync /bin/blocksyncer
COPY ./block-sync /bin/block-sync

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

ENTRYPOINT ["/bin/blocksyncer"]
ENTRYPOINT ["/bin/block-sync"]
5 changes: 4 additions & 1 deletion tools/prometheus-builder/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if [[ -z $PR_NUMBER || -z $VOLUME_DIR || -z $GITHUB_ORG || -z $GITHUB_REPO ]]; t
echo "ERROR:: environment variables not set correctly"
exit 1;
fi

# Clone the repository with a shallow clone
echo ">> Cloning repository $GITHUB_ORG/$GITHUB_REPO (shallow clone)"
if ! git clone --depth 1 https://github.com/$GITHUB_ORG/$GITHUB_REPO.git $DIR; then
Expand All @@ -24,6 +24,9 @@ fi

git checkout pr-branch

MKDIR="/config"
cp "$DIR/objectconfig.yml" "$MKDIR/objectconfig.yml"

echo ">> Creating prometheus binaries"
if ! make build PROMU_BINARIES="prometheus"; then
echo "ERROR:: Building of binaries failed"
Expand Down

0 comments on commit 463c17b

Please sign in to comment.