-
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.
feat: enable prometheus metrics for Made for UDS (#111)
## Description This enables prometheus metrics for SonarQube to make it "Made for UDS" ## Related Issue Fixes #99 ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [X] New feature (non-breaking change which adds functionality) - [ ] Other (security config, docs update, etc) ## Checklist before merging - [X] Test, docs, adr added or updated as needed - [X] [Contributor Guide Steps](https://github.com/defenseunicorns/uds-package-sonarqube/blob/main/CONTRIBUTING.md#developer-workflow) followed Release-As: v10.6.0-uds.1
- Loading branch information
Showing
12 changed files
with
107 additions
and
12 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
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,16 @@ | ||
{{- $namespace := .Release.Namespace }} | ||
{{- $existingSecret := lookup "v1" "Secret" $namespace "sonarqube-monitoring" }} | ||
{{- $password := (randAlphaNum 32) }} | ||
{{- if $existingSecret }} | ||
{{- $decoded := index $existingSecret.data "passcode" | b64dec }} | ||
{{- $password = $decoded }} | ||
{{- end }} | ||
|
||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: sonarqube-monitoring | ||
namespace: {{ $namespace }} | ||
type: "Opaque" | ||
stringData: | ||
passcode: {{ $password | quote }} |
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,25 @@ | ||
# This is required because of unconfigurable port names for the Web and CE bean monitoring endpoints | ||
{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" }} | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: PodMonitor | ||
metadata: | ||
name: sonarqube-bean-metrics | ||
namespace: {{ .Release.Namespace }} | ||
spec: | ||
scrapeClass: istio-certs | ||
namespaceSelector: | ||
matchNames: | ||
- sonarqube | ||
podMetricsEndpoints: | ||
- path: / | ||
port: monitoring-ce | ||
scheme: https | ||
enableHttp2: false | ||
- path: / | ||
port: monitoring-web | ||
scheme: https | ||
enableHttp2: false | ||
selector: | ||
matchLabels: | ||
app: sonarqube | ||
{{- end }} |
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
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
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
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,14 @@ | ||
FROM cgr.dev/chainguard/busybox:latest | ||
|
||
# renovate: datasource=github-tags depName=prometheus/jmx_exporter versioning=semver | ||
ENV JMX_PROMETHEUS_PLUGIN_VERSION=0.17.2 | ||
|
||
USER root | ||
|
||
ADD https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/$JMX_PROMETHEUS_PLUGIN_VERSION/jmx_prometheus_javaagent-$JMX_PROMETHEUS_PLUGIN_VERSION.jar / | ||
|
||
COPY ./curl.sh /bin/curl | ||
|
||
RUN chmod -R 777 /*.jar | ||
|
||
ENTRYPOINT [ "/bin/curl" ] |
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,7 @@ | ||
#! /bin/sh | ||
|
||
set -e | ||
|
||
cp /jmx_prometheus_javaagent-$JMX_PROMETHEUS_PLUGIN_VERSION.jar /data/jmx_prometheus_javaagent.jar | ||
|
||
echo "finished loading jmx prometheus plugin" |
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
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
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
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 |
---|---|---|
|
@@ -4,6 +4,3 @@ image: | |
|
||
initContainers: | ||
image: busybox:1.36 | ||
|
||
prometheusExporter: | ||
image: curlimages/curl:8.8.0 |