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

Decouple server and jmx svc annotations #654

Merged
merged 2 commits into from
Aug 28, 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
1 change: 1 addition & 0 deletions src/main/charts/bamboo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ Kubernetes: `>=1.21.x-0`
| monitoring.jmxExporterImageTag | string | `"0.18.0"` | Image tag to be used to pull jmxExporterImageRepo |
| monitoring.jmxExporterPort | int | `9999` | Port number on which metrics will be available |
| monitoring.jmxExporterPortType | string | `"ClusterIP"` | JMX exporter port type |
| monitoring.jmxServiceAnnotations | object | `{}` | Annotations added to the jmx service |
| monitoring.serviceMonitor.create | bool | `false` | Create ServiceMonitor to start scraping metrics. ServiceMonitor CRD needs to be created in advance. |
| monitoring.serviceMonitor.prometheusLabelSelector | object | `{}` | ServiceMonitorSelector of the prometheus instance. |
| monitoring.serviceMonitor.scrapeIntervalSeconds | int | `30` | Scrape interval for the JMX service. |
Expand Down
2 changes: 1 addition & 1 deletion src/main/charts/bamboo/templates/service-jmx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
labels:
{{- include "common.labels.commonLabels" . | nindent 4 }}
annotations:
{{- with .Values.bamboo.service.annotations }}
{{- with .Values.monitoring.jmxServiceAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
Expand Down
4 changes: 4 additions & 0 deletions src/main/charts/bamboo/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,10 @@ monitoring:
#
exposeJmxMetrics: false

# -- Annotations added to the jmx service
#
jmxServiceAnnotations: {}

# -- Fetch jmx_exporter jar from the image. If set to false make sure to manually copy the jar
# to shared home and provide an absolute path in jmxExporterCustomJarLocation
#
Expand Down
1 change: 1 addition & 0 deletions src/main/charts/bitbucket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ Kubernetes: `>=1.21.x-0`
| monitoring.jmxExporterImageTag | string | `"0.18.0"` | Image tag to be used to pull jmxExporterImageRepo |
| monitoring.jmxExporterPort | int | `9999` | Port number on which metrics will be available |
| monitoring.jmxExporterPortType | string | `"ClusterIP"` | JMX exporter port type |
| monitoring.jmxServiceAnnotations | object | `{}` | Annotations added to the jmx service |
| monitoring.serviceMonitor.create | bool | `false` | Create ServiceMonitor to start scraping metrics. ServiceMonitor CRD needs to be created in advance. |
| monitoring.serviceMonitor.prometheusLabelSelector | object | `{}` | ServiceMonitorSelector of the prometheus instance. |
| monitoring.serviceMonitor.scrapeIntervalSeconds | int | `30` | Scrape interval for the JMX service. |
Expand Down
2 changes: 1 addition & 1 deletion src/main/charts/bitbucket/templates/service-jmx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
labels:
{{- include "common.labels.commonLabels" . | nindent 4 }}
annotations:
{{- with .Values.bitbucket.service.annotations }}
{{- with .Values.monitoring.jmxServiceAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
Expand Down
4 changes: 4 additions & 0 deletions src/main/charts/bitbucket/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,10 @@ monitoring:
#
exposeJmxMetrics: false

# -- Annotations added to the jmx service
#
jmxServiceAnnotations: {}

# -- Fetch jmx_exporter jar from the image. If set to false make sure to manually copy the jar
# to shared home and provide an absolute path in jmxExporterCustomJarLocation
#
Expand Down
1 change: 1 addition & 0 deletions src/main/charts/confluence/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ Kubernetes: `>=1.21.x-0`
| monitoring.jmxExporterImageTag | string | `"0.18.0"` | Image tag to be used to pull jmxExporterImageRepo |
| monitoring.jmxExporterPort | int | `9999` | Port number on which metrics will be available |
| monitoring.jmxExporterPortType | string | `"ClusterIP"` | JMX exporter port type |
| monitoring.jmxServiceAnnotations | object | `{}` | Annotations added to the jmx service |
| monitoring.serviceMonitor.create | bool | `false` | Create ServiceMonitor to start scraping metrics. ServiceMonitor CRD needs to be created in advance. |
| monitoring.serviceMonitor.prometheusLabelSelector | object | `{}` | ServiceMonitorSelector of the prometheus instance. |
| monitoring.serviceMonitor.scrapeIntervalSeconds | int | `30` | Scrape interval for the JMX service. |
Expand Down
2 changes: 1 addition & 1 deletion src/main/charts/confluence/templates/service-jmx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
labels:
{{- include "common.labels.commonLabels" . | nindent 4 }}
annotations:
{{- with .Values.confluence.service.annotations }}
{{- with .Values.monitoring.jmxServiceAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
Expand Down
4 changes: 4 additions & 0 deletions src/main/charts/confluence/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,10 @@ monitoring:
#
exposeJmxMetrics: false

# -- Annotations added to the jmx service
#
jmxServiceAnnotations: {}

# -- Fetch jmx_exporter jar from the image. If set to false make sure to manually copy the jar
# to shared home and provide an absolute path in jmxExporterCustomJarLocation
#
Expand Down
1 change: 1 addition & 0 deletions src/main/charts/crowd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Kubernetes: `>=1.21.x-0`
| monitoring.jmxExporterImageTag | string | `"0.18.0"` | Image tag to be used to pull jmxExporterImageRepo |
| monitoring.jmxExporterPort | int | `9999` | Port number on which metrics will be available |
| monitoring.jmxExporterPortType | string | `"ClusterIP"` | JMX exporter port type |
| monitoring.jmxServiceAnnotations | object | `{}` | Annotations added to the jmx service |
| monitoring.serviceMonitor.create | bool | `false` | Create ServiceMonitor to start scraping metrics. ServiceMonitor CRD needs to be created in advance. |
| monitoring.serviceMonitor.prometheusLabelSelector | object | `{}` | ServiceMonitorSelector of the prometheus instance. |
| monitoring.serviceMonitor.scrapeIntervalSeconds | int | `30` | Scrape interval for the JMX service. |
Expand Down
2 changes: 1 addition & 1 deletion src/main/charts/crowd/templates/service-jmx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
labels:
{{- include "common.labels.commonLabels" . | nindent 4 }}
annotations:
{{- with .Values.crowd.service.annotations }}
{{- with .Values.monitoring.jmxServiceAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
Expand Down
4 changes: 4 additions & 0 deletions src/main/charts/crowd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,10 @@ monitoring:
#
exposeJmxMetrics: false

# -- Annotations added to the jmx service
#
jmxServiceAnnotations: {}

# -- Fetch jmx_exporter jar from the image. If set to false make sure to manually copy the jar
# to shared home and provide an absolute path in jmxExporterCustomJarLocation
#
Expand Down
1 change: 1 addition & 0 deletions src/main/charts/jira/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Kubernetes: `>=1.21.x-0`
| monitoring.jmxExporterImageTag | string | `"0.18.0"` | Image tag to be used to pull jmxExporterImageRepo |
| monitoring.jmxExporterPort | int | `9999` | Port number on which metrics will be available |
| monitoring.jmxExporterPortType | string | `"ClusterIP"` | JMX exporter port type |
| monitoring.jmxServiceAnnotations | object | `{}` | Annotations added to the jmx service |
| monitoring.serviceMonitor.create | bool | `false` | Create ServiceMonitor to start scraping metrics. ServiceMonitor CRD needs to be created in advance. |
| monitoring.serviceMonitor.prometheusLabelSelector | object | `{}` | ServiceMonitorSelector of the prometheus instance. |
| monitoring.serviceMonitor.scrapeIntervalSeconds | int | `30` | Scrape interval for the JMX service. |
Expand Down
2 changes: 1 addition & 1 deletion src/main/charts/jira/templates/service-jmx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
labels:
{{- include "common.labels.commonLabels" . | nindent 4 }}
annotations:
{{- with .Values.jira.service.annotations }}
{{- with .Values.monitoring.jmxServiceAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
Expand Down
4 changes: 4 additions & 0 deletions src/main/charts/jira/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,10 @@ monitoring:
# -- Expose JMX metrics with jmx_exporter https://github.com/prometheus/jmx_exporter
#
exposeJmxMetrics: false

# -- Annotations added to the jmx service
#
jmxServiceAnnotations: {}

# -- Fetch jmx_exporter jar from the image. If set to false make sure to manually copy the jar
# to shared home and provide an absolute path in jmxExporterCustomJarLocation
Expand Down
6 changes: 5 additions & 1 deletion src/test/java/test/JmxMetricsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ void jmx_service_test(Product product) throws Exception {
final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of(
"monitoring.exposeJmxMetrics", "true",
"monitoring.jmxExporterPort", "9000",
"monitoring.jmxExporterPortType", "NodePort"
"monitoring.jmxExporterPortType", "NodePort",
"monitoring.jmxServiceAnnotations.foo", "bar"
));

final var service = resources.get(Kind.Service, Service.class, product.getHelmReleaseName()+"-jmx");
Expand All @@ -143,6 +144,9 @@ void jmx_service_test(Product product) throws Exception {
.hasTextEqualTo("NodePort");
VavrAssertions.assertThat(service.getPort("jmx"))
.hasValueSatisfying(node -> assertThat(node.path("port")).hasValueEqualTo(9000));
assertThat(service.getAnnotations()).isObject(Map.of(
"foo", "bar"
));
}

@ParameterizedTest
Expand Down
Loading