-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce a deploy-prometheus.sh script that can install the prometheus-community/kube-prometheus-stack helm chart. Include a file that overrides the ServiceMonitor selector in the chart's values.yaml. This selector inserts a label that is common across the ServiceMonitor resources in the DWS and NNF repos. Signed-off-by: Dean Roehrich <[email protected]>
- Loading branch information
1 parent
df39ba6
commit 4ba5d2a
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |