Skip to content

Commit 5aa4b0f

Browse files
authored
Merge pull request #731 from sassoftware/grafana-service-monitor
Add service monitor TLS settings to helm and remove patch
2 parents e462c67 + 7fca8a6 commit 5aa4b0f

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ be installed. Specifically, a recent version (4.32+) of the [Golang-based (Mike
77
needs to be installed.
88
* [EXPERIMENTAL] The auto-generation of Ingress resources for the web applications is now available on an *experimental*
99
basis. Users are **only** required to provide a BASE_DOMAIN (e.g. cluster.example.com). Host-based ingress is configured
10-
by default although path-based ingress can be requested. This *experimental* feature requires `yq` (Mike Farah) version
10+
by default although path-based ingress can be requested. This *experimental* feature requires `yq` (Mike Farah) version
1111
4.32.2+ be installed. See [Autogenerated Ingress Definitions and Storage Class References](autogenerate.md) for more information.
1212
* **Metrics**
1313
* [FIX] Corrected bug preventing the `create_logging_datasource.sh` script from being run on OpenShift clusters.
1414
* [CHANGE] As part of making the above fix, obsolete functionality related to running the `create_logging_datasource.sh`
1515
script to deploy datasource within namespace/tenant-level instances of Grafana was removed.
1616
* [FIX] Corrected timing of call to `create_logging_datasource.sh` script within `deploy_monitoring_openshift.sh` script.
17+
* [CHANGE] The v4m-grafana service monitor was previously patched when TLS was enabled to defind the tlsConfig section. This is now
18+
defined in `values-prom-operator-tls.yaml` to be consistent with the other services and is no longer patched.
1719
* **Logging**
1820
* [FIX] Corrected a bug preventing requested container image details, inc. registry info, from being honored
1921
* [CHANGE] The pod labels assigned to the OpenSearch Dashboards pod changed as part of the upgrade (see below).

monitoring/bin/deploy_monitoring_cluster.sh

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ if [ "$PROM_OPERATOR_CRD_UPDATE" == "true" ]; then
110110
log_verbose "Updating Prometheus Operator custom resource definitions"
111111
crds=( alertmanagerconfigs alertmanagers prometheuses prometheusrules podmonitors servicemonitors thanosrulers probes )
112112
for crd in "${crds[@]}"; do
113-
113+
114114
## Determine CRD URL - if in an airgap environment, look for them in USER_DIR.
115115
if [ "$AIRGAP_DEPLOYMENT" == "true" ]; then
116116
crdURL=$USER_DIR/monitoring/prometheus-operator-crd/$PROM_OPERATOR_CRD_VERSION/monitoring.coreos.com_$crd.yaml
@@ -124,7 +124,7 @@ if [ "$PROM_OPERATOR_CRD_UPDATE" == "true" ]; then
124124
fi
125125
else
126126
crdURL="https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/$PROM_OPERATOR_CRD_VERSION/example/prometheus-operator-crd/monitoring.coreos.com_$crd.yaml"
127-
fi
127+
fi
128128

129129
if kubectl get crd $crd.monitoring.coreos.com 1>/dev/null 2>&1; then
130130
kubectl replace -f $crdURL
@@ -390,12 +390,6 @@ helm $helmDebug upgrade --install $promRelease \
390390

391391
sleep 2
392392

393-
if [ "$TLS_ENABLE" == "true" ]; then
394-
log_verbose "Patching Grafana ServiceMonitor for TLS"
395-
kubectl patch servicemonitor -n $MON_NS $promName-grafana --type=json \
396-
-p='[{"op": "replace", "path": "/spec/endpoints/0/scheme", "value":"https"},{"op": "replace", "path": "/spec/endpoints/0/tlsConfig", "value":{}},{"op": "replace", "path": "/spec/endpoints/0/tlsConfig/insecureSkipVerify", "value":true}]'
397-
fi
398-
399393
#Container Security: Disable serviceAccount Token Automounting
400394
disable_sa_token_automount $MON_NS v4m-grafana
401395
disable_sa_token_automount $MON_NS sas-ops-acct #Used w/Prometheus
@@ -543,13 +537,11 @@ fi
543537

544538
if [ "$showPass" == "true" ]; then
545539
# Find the grafana pod
546-
540+
547541
log_notice " Generated Grafana admin password is: $grafanaPwd"
548542
log_notice " To change the password, run the following script (replace myNewPassword with an updated password):"
549543
log_notice " monitoring/bin/change_grafana_admin_password.sh -p myNewPassword"
550544
fi
551545

552546
log_message ""
553547
log_notice " Successfully deployed components to the [$MON_NS] namespace"
554-
555-

monitoring/tls/values-prom-operator-tls.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ alertmanager:
4040

4141
prometheus-node-exporter:
4242
extraArgs:
43-
- '--web.config.file=/opt/node-exporter/node-exporter-web.yaml'
43+
- "--web.config.file=/opt/node-exporter/node-exporter-web.yaml"
4444
configmaps:
45-
- name: node-exporter-tls-web-config
46-
mountPath: /opt/node-exporter
45+
- name: node-exporter-tls-web-config
46+
mountPath: /opt/node-exporter
4747

4848
# node-exporter helm chart does not yet support HTTPS
4949
# node-exporter:
@@ -62,11 +62,11 @@ grafana:
6262
scheme: HTTPS
6363
port: 3000
6464
extraSecretMounts:
65-
- name: grafana-tls
66-
mountPath: /cert
67-
secretName: grafana-tls-secret
68-
readOnly: true
69-
subPath: ""
65+
- name: grafana-tls
66+
mountPath: /cert
67+
secretName: grafana-tls-secret
68+
readOnly: true
69+
subPath: ""
7070
service:
7171
port: 3000
7272
targetPort: 3000
@@ -80,6 +80,10 @@ grafana:
8080
reloadURL: "https://localhost:3000/api/admin/provisioning/datasources/reload"
8181
env:
8282
REQ_SKIP_TLS_VERIFY: true
83+
serviceMonitor:
84+
scheme: https
85+
tlsConfig:
86+
insecureSkipVerify: true
8387
"grafana.ini":
8488
server:
8589
protocol: https

0 commit comments

Comments
 (0)