Skip to content

Commit

Permalink
Removed some files!
Browse files Browse the repository at this point in the history
Signed-off-by: Kushal Shukla <[email protected]>
  • Loading branch information
kushalShukla-web committed Nov 11, 2024
1 parent 0ef32ea commit 8232940
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 118 deletions.
15 changes: 1 addition & 14 deletions prombench/docs/kind.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,7 @@ If used with the GitHub integration:
export PR_NUMBER=<PR to benchmark against the selected $RELEASE>
```

2. Before applying benchmarking objects , You have to choices to make:
- **Option 1: Download data from object storage**

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.
> Note: Make sure this secret applied before ```3b_prometheus-test_deployment.yaml```
- **Option 2: Skip downloading data**

If you don’t need to download data, edit the `3b_prometheus-test_deployment.yaml` file:

- Remove the `bucket-config` volume section from.
- Remove the `volumeMount` section name `bucket-config` from `data-downloader`.
> Note: You have to remove these two sections from both prometheus-test-pr-{{ .PR_NUMBER }} and prometheus-test-{{ normalise .RELEASE }} deployments.

3. Deploy the Kubernetes objects:
2. Deploy the Kubernetes objects:
> **_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:
> ```bash
> sudo sysctl fs.inotify.max_user_instances=512
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
runAsUser: 0
initContainers:
- name: prometheus-builder
image: kushalshukla/builder
image: docker.io/prominfra/prometheus-builder:master
imagePullPolicy: Always
env:
- name: PR_NUMBER
Expand All @@ -48,18 +48,6 @@ spec:
volumeMounts:
- name: prometheus-executable
mountPath: /prometheus-builder
- name: key
mountPath: /config
- name: data-downloader
image: kushalshukla/writer
imagePullPolicy: Always
volumeMounts:
- name: instance-ssd
mountPath: /data
- name: bucket-config
mountPath: /config
- name: key
mountPath: /key
containers:
- name: prometheus
image: quay.io/prometheus/busybox:latest
Expand Down Expand Up @@ -100,11 +88,6 @@ spec:
path: /mnt/disks/ssd0 #gke ssds
- name: prometheus-executable
emptyDir: {}
- name: bucket-config # Define the Secret volume
secret:
secretName: bucket-secret
- name: key
emptyDir: {}
terminationGracePeriodSeconds: 300
nodeSelector:
node-name: prometheus-{{ .PR_NUMBER }}
Expand Down Expand Up @@ -161,31 +144,6 @@ spec:
- prometheus
securityContext:
runAsUser: 0
initContainers:
- name: download-key
image: kushalshukla/builder
imagePullPolicy: Always
command: [ "/download-key/key.sh" ]
env:
- name: PR_NUMBER
value: "{{ .PR_NUMBER }}"
- name: GITHUB_ORG
value: "{{ .GITHUB_ORG }}"
- name: GITHUB_REPO
value: "{{ .GITHUB_REPO }}"
volumeMounts:
- name: key
mountPath: /config
- name: data-downloader
image: kushalshukla/writer
imagePullPolicy: Always
volumeMounts:
- name: instance-ssd
mountPath: /data
- name: bucket-config
mountPath: /config
- name: key
mountPath: /key
containers:
- name: prometheus
image: quay.io/prometheus/prometheus:{{ .RELEASE }}
Expand Down Expand Up @@ -214,14 +172,6 @@ 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
- name: bucket-config # Define the Secret volume
secret:
secretName: bucket-secret
- name: key
emptyDir: {}
terminationGracePeriodSeconds: 300
nodeSelector:
node-name: prometheus-{{ .PR_NUMBER }}
Expand Down
16 changes: 13 additions & 3 deletions tools/block-sync/upload_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,20 @@ func newStore(tsdbPath, objectConfig, objectKey string, logger *slog.Logger) (*S
}

content := strings.TrimSpace(string(key))
lines := strings.Split(content, "\n")
var value string
if strings.HasPrefix(content, "key:") {
value = strings.TrimSpace(strings.TrimPrefix(content, "key:"))
} else {

// Loop through each line to find the key
for _, line := range lines {
line = strings.TrimSpace(line)
if strings.HasPrefix(line, "key:") {
// Extract the value after "key:"
value = strings.TrimSpace(strings.TrimPrefix(line, "key:"))
break
}
}

if value == "" {
return nil, fmt.Errorf("expected 'key:' prefix not found")
}

Expand Down
2 changes: 0 additions & 2 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 /download-key/key.sh

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

ENTRYPOINT ["/go/src/github.com/build.sh"]
15 changes: 2 additions & 13 deletions 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,22 +24,11 @@ fi

git checkout pr-branch

# Here, MKDIR is specified in the volumeMount section of the prometheus-builder init container,
# where it will copy the key.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.
MKDIR="/config"
if [ -f "$DIR/key.yml" ]; then
echo "File exists."
cp "$DIR/key.yml" "$MKDIR/key.yml"
else
echo "File does not exist."
fi

echo ">> Creating prometheus binaries"
if ! make build PROMU_BINARIES="prometheus"; then
echo "ERROR:: Building of binaries failed"
exit 1;
fi

echo ">> Copy files to volume"
cp prometheus $VOLUME_DIR/prometheus
cp prometheus $VOLUME_DIR/prometheus
35 changes: 0 additions & 35 deletions tools/prometheus-builder/key.sh

This file was deleted.

0 comments on commit 8232940

Please sign in to comment.