From 24df7498eea355b525a763a927d19cebddbb8c49 Mon Sep 17 00:00:00 2001 From: Matthew Warman Date: Tue, 21 Apr 2020 10:47:51 +0100 Subject: [PATCH] Add ability to set labels on ServiceMonitor (#15) * Add ability to set labels on Nexus3 ServiceMonitor --- charts/nexus3/Chart.yaml | 2 +- charts/nexus3/README.md | 71 +++++++++++---------- charts/nexus3/templates/servicemonitor.yaml | 3 + charts/nexus3/values.yaml | 2 + 4 files changed, 42 insertions(+), 36 deletions(-) diff --git a/charts/nexus3/Chart.yaml b/charts/nexus3/Chart.yaml index b5309931..65027849 100644 --- a/charts/nexus3/Chart.yaml +++ b/charts/nexus3/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: nexus3 -version: 2.2.1 +version: 2.2.2 appVersion: 3.22.1 description: Sonatype Nexus OSS is an open source repository manager keywords: diff --git a/charts/nexus3/README.md b/charts/nexus3/README.md index 916607df..1fa9ce01 100644 --- a/charts/nexus3/README.md +++ b/charts/nexus3/README.md @@ -42,41 +42,42 @@ The command removes all the Kubernetes components associated with the chart and The following table lists the configurable parameters of the _Nexus3_ chart and their default values. -| Parameter | Description | Default | -| -------------------------------- | --------------------------------------------------------------------------------------- | ----------------- | -| `image.repository` | Docker repository to use | `sonatype/nexus3` | -| `image.tag` | Docker tag to use | `3.22.1` | -| `image.pullPolicy` | Docker image pull policy | `IfNotPresent` | -| `nameOverride` | String to partially override `nexus3.fullname` template (will prepend the release name) | `nil` | -| `fullnameOverride` | String to fully override `nexus3.fullname` template | `nil` | -| `securityContext.fsGroup` | File system group ownership | `200` | -| `service.type` | Type of service | `ClusterIP` | -| `service.port` | Service port | `8881` | -| `service.additionalPorts` | Additional ports exposed by the service and used by repository connectors | `nil` | -| `caCerts.secret` | Name of the secret containing additional CA certificates | `nil` | -| `metrics.enabled` | Metrics enabled for anonymous access | `false` | -| `metrics.serviceMonitor.enabled` | Prometheus service monitor created | `false` | -| `envVars.jvmMaxRAMPercentage` | JVM max RAM percentage | `25.0` | -| `envVars.jvmMaxDirectMemorySize` | JVM direct memory size | `2G` | -| `env` | List of environmental variable to apply to the deployment | `nil` | -| `persistence.enabled` | Create a volume (PVC) for storage | `false` | -| `persistence.existingClaim` | An existing PVC to use instead of creating a new one | `nil` | -| `persistence.accessMode` | The PVC access mode | `ReadWriteOnce` | -| `persistence.storageClass` | The PVC storage class (use `-` for default) | `standard` | -| `persistence.size` | The size of the PVC to create | `8Gi` | -| `podAnnotations` | Pod Annotations | `{}` | -| `resources` | Resource requests and limits | `{}` | -| `nodeSelector` | Node labels for pod assignment | `{}` | -| `tolerations` | List of node taints to tolerate | `[]` | -| `affinity` | Map of node/pod affinities | `{}` | -| `ingress.enabled` | Create an ingress | `false` | -| `ingress.annotations` | Annotations to enhance ingress configuration | `{}` | -| `ingress.path` | Path for ingress rules | `/` | -| `ingress.hosts` | List of ingress hosts | `[]` | -| `ingress.tls` | List of TLS configurations (`ingress.tls[n].secretName`, `ingress.tls[n].hosts[m])` | `[]` | -| `properties.enabled` | Support passing _Nexus3_ properties. | `false` | -| `properties.values` | The properties to pass to _Nexus3_. | `nil` | -| `config.enabled` | Automatically configure _Nexus3_ | `false` | +| Parameter | Description | Default | +| ------------------------------------------| --------------------------------------------------------------------------------------- | ----------------- | +| `image.repository` | Docker repository to use | `sonatype/nexus3` | +| `image.tag` | Docker tag to use | `3.22.1` | +| `image.pullPolicy` | Docker image pull policy | `IfNotPresent` | +| `nameOverride` | String to partially override `nexus3.fullname` template (will prepend the release name) | `nil` | +| `fullnameOverride` | String to fully override `nexus3.fullname` template | `nil` | +| `securityContext.fsGroup` | File system group ownership | `200` | +| `service.type` | Type of service | `ClusterIP` | +| `service.port` | Service port | `8881` | +| `service.additionalPorts` | Additional ports exposed by the service and used by repository connectors | `nil` | +| `caCerts.secret` | Name of the secret containing additional CA certificates | `nil` | +| `metrics.enabled` | Metrics enabled for anonymous access | `false` | +| `metrics.serviceMonitor.enabled` | Prometheus service monitor created | `false` | +| `metrics.serviceMonitor.additionalLabels` | Additional labels to be set on the ServiceMonitor | `{}` | +| `envVars.jvmMaxRAMPercentage` | JVM max RAM percentage | `25.0` | +| `envVars.jvmMaxDirectMemorySize` | JVM direct memory size | `2G` | +| `env` | List of environmental variable to apply to the deployment | `nil` | +| `persistence.enabled` | Create a volume (PVC) for storage | `false` | +| `persistence.existingClaim` | An existing PVC to use instead of creating a new one | `nil` | +| `persistence.accessMode` | The PVC access mode | `ReadWriteOnce` | +| `persistence.storageClass` | The PVC storage class (use `-` for default) | `standard` | +| `persistence.size` | The size of the PVC to create | `8Gi` | +| `podAnnotations` | Pod Annotations | `{}` | +| `resources` | Resource requests and limits | `{}` | +| `nodeSelector` | Node labels for pod assignment | `{}` | +| `tolerations` | List of node taints to tolerate | `[]` | +| `affinity` | Map of node/pod affinities | `{}` | +| `ingress.enabled` | Create an ingress | `false` | +| `ingress.annotations` | Annotations to enhance ingress configuration | `{}` | +| `ingress.path` | Path for ingress rules | `/` | +| `ingress.hosts` | List of ingress hosts | `[]` | +| `ingress.tls` | List of TLS configurations (`ingress.tls[n].secretName`, `ingress.tls[n].hosts[m])` | `[]` | +| `properties.enabled` | Support passing _Nexus3_ properties. | `false` | +| `properties.values` | The properties to pass to _Nexus3_. | `nil` | +| `config.enabled` | Automatically configure _Nexus3_ | `false` | ## Persistence diff --git a/charts/nexus3/templates/servicemonitor.yaml b/charts/nexus3/templates/servicemonitor.yaml index 03b0f916..e90c467d 100644 --- a/charts/nexus3/templates/servicemonitor.yaml +++ b/charts/nexus3/templates/servicemonitor.yaml @@ -8,6 +8,9 @@ metadata: helm.sh/chart: {{ include "nexus3.chart" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- if .Values.metrics.serviceMonitor.additionalLabels }} + {{- .Values.metrics.serviceMonitor.additionalLabels | toYaml | trim | nindent 4 }} + {{- end }} spec: jobLabel: {{ .Release.Name }} namespaceSelector: diff --git a/charts/nexus3/values.yaml b/charts/nexus3/values.yaml index 61f5471c..9c4f927a 100644 --- a/charts/nexus3/values.yaml +++ b/charts/nexus3/values.yaml @@ -29,6 +29,8 @@ metrics: enabled: false serviceMonitor: enabled: false + # additionalLabels: + # myLabel: myValue envVars: jvmMaxRAMPercentage: "25.0"