Skip to content
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

Requirements for Prometheus #97

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions config/service-monitor-selector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# An override for the prometheus-community/kube-prometheus-stack helm chart.
#
# This adds a selector to the Prometheus resource so it can find the
# ServiceMonitor resources that our repos are creating. Each submodule defines
# its ServiceMonitor resource in `config/prometheus/monitor.yaml`.
#
# helm repo add prometheus-community \
# https://prometheus-community.github.io/helm-charts
# helm repo update
# helm search repo prometheus-community | grep kube-prometheus-stack
# helm show values prometheus-community/kube-prometheus-stack \
# --version $CHART_VER > kube-prometheus-stack.yaml
#
# helm install $INSTANCE_NAME prometheus-community/kube-prometheus-stack \
# --version $CHART_VER --create-namespace --namespace monitoring \
# --values $THIS_OVERRIDE_FILE
#

prometheus:
prometheusSpec:
serviceMonitorSelector:
matchLabels:
prometheus-app: rabbit-nnf

51 changes: 51 additions & 0 deletions deploy-prometheus.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

# Copyright 2023 Hewlett Packard Enterprise Development LP
# Other additional copyright holders may be indicated within.
#
# The entirety of this work is licensed under the Apache License,
# Version 2.0 (the "License"); you may not use this file except
# in compliance with the License.
#
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Install Prometheus on an existing cluster.

CMD=$1

INSTANCE_NAME=rabbit
LOCAL_NAME=prometheus-community
NAMESPACE=monitoring
CHART_VER=52.1.0

set -e

# We want helm v3.
helm version | grep -qE Version:.v3

if [[ $CMD == 'deploy' ]]; then

helm repo add $LOCAL_NAME https://prometheus-community.github.io/helm-charts
helm repo update $LOCAL_NAME

helm install $INSTANCE_NAME prometheus-community/kube-prometheus-stack \
--version $CHART_VER --create-namespace --namespace $NAMESPACE \
--values config/service-monitor-selector.yaml

helm list -n $NAMESPACE
fi

if [[ $CMD == 'undeploy' ]]; then
# This does not uninstall the CRDs.
helm uninstall $INSTANCE_NAME -n $NAMESPACE
fi

exit 0