-
Notifications
You must be signed in to change notification settings - Fork 66
🌱 Metrics Follow-Ups #2105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🌱 Metrics Follow-Ups #2105
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
help="install-prometheus.sh is used to set up prometheus monitoring for e2e testing. | ||
Usage: | ||
install-prometheus.sh [PROMETHEUS_NAMESPACE] [PROMETHEUS_VERSION] [KUSTOMIZE] [GIT_VERSION] | ||
" | ||
|
||
if [[ "$#" -ne 4 ]]; then | ||
echo "Illegal number of arguments passed" | ||
echo "${help}" | ||
exit 1 | ||
fi | ||
|
||
PROMETHEUS_NAMESPACE="$1" | ||
PROMETHEUS_VERSION="$2" | ||
KUSTOMIZE="$3" | ||
GIT_VERSION="$4" | ||
|
||
TMPDIR="$(mktemp -d)" | ||
trap 'echo "Cleaning up $TMPDIR"; rm -rf "$TMPDIR"' EXIT | ||
|
||
echo "Downloading Prometheus resources..." | ||
curl -s "https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/refs/tags/${PROMETHEUS_VERSION}/kustomization.yaml" > "${TMPDIR}/kustomization.yaml" | ||
curl -s "https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/refs/tags/${PROMETHEUS_VERSION}/bundle.yaml" > "${TMPDIR}/bundle.yaml" | ||
|
||
echo "Patching namespace to ${PROMETHEUS_NAMESPACE}..." | ||
(cd "$TMPDIR" && $KUSTOMIZE edit set namespace "$PROMETHEUS_NAMESPACE") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: My preference is to use braces There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do you execute this command in a subshell with curly braces instead of |
||
|
||
echo "Applying Prometheus base..." | ||
kubectl apply -k "$TMPDIR" --server-side | ||
|
||
echo "Waiting for Prometheus Operator pod to become ready..." | ||
kubectl wait --for=condition=Ready pod -n "$PROMETHEUS_NAMESPACE" -l app.kubernetes.io/name=prometheus-operator | ||
|
||
echo "Applying overlay config..." | ||
$KUSTOMIZE build config/overlays/prometheus | sed "s/cert-git-version/cert-${VERSION}/g" | kubectl apply -f - | ||
|
||
echo "Waiting for metrics scraper to become ready..." | ||
kubectl wait --for=create pods -n "$PROMETHEUS_NAMESPACE" prometheus-prometheus-0 --timeout=60s | ||
kubectl wait --for=condition=Ready pods -n "$PROMETHEUS_NAMESPACE" prometheus-prometheus-0 --timeout=120s | ||
|
||
echo "Prometheus deployment completed successfully." |
Uh oh!
There was an error while loading. Please reload this page.