Browse Source

Helm: Enabled Modifying namespace of ServiceMonitors (#2190)

* Added namespace in ServiceMonitor

Signed-off-by: Kratik Jain <kratik1998@gmail.com>

* Added namespace in values.yaml for ServiceMonitor

Signed-off-by: Kratik Jain <kratik1998@gmail.com>

* chore: gen helm docs

Signed-off-by: Moritz Johner <beller.moritz@googlemail.com>

* fix: update test

Signed-off-by: Moritz Johner <beller.moritz@googlemail.com>

---------

Signed-off-by: Kratik Jain <kratik1998@gmail.com>
Signed-off-by: Moritz Johner <beller.moritz@googlemail.com>
Co-authored-by: Moritz Johner <beller.moritz@googlemail.com>
Co-authored-by: Moritz Johner <moolen@users.noreply.github.com>
Kratik Jain 3 years ago
parent
commit
f931c6a6da

+ 1 - 0
deploy/charts/external-secrets/README.md

@@ -129,6 +129,7 @@ The command removes all the Kubernetes components associated with the chart and
 | serviceMonitor.honorLabels | bool | `false` | Let prometheus add an exported_ prefix to conflicting labels |
 | serviceMonitor.honorLabels | bool | `false` | Let prometheus add an exported_ prefix to conflicting labels |
 | serviceMonitor.interval | string | `"30s"` | Interval to scrape metrics |
 | serviceMonitor.interval | string | `"30s"` | Interval to scrape metrics |
 | serviceMonitor.metricRelabelings | list | `[]` | Metric relabel configs to apply to samples before ingestion. [Metric Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs) |
 | serviceMonitor.metricRelabelings | list | `[]` | Metric relabel configs to apply to samples before ingestion. [Metric Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs) |
+| serviceMonitor.namespace | string | `""` | namespace where you want to install ServiceMonitors |
 | serviceMonitor.relabelings | list | `[]` | Relabel configs to apply to samples before ingestion. [Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config) |
 | serviceMonitor.relabelings | list | `[]` | Relabel configs to apply to samples before ingestion. [Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config) |
 | serviceMonitor.scrapeTimeout | string | `"25s"` | Timeout if metrics can't be retrieved in given time interval |
 | serviceMonitor.scrapeTimeout | string | `"25s"` | Timeout if metrics can't be retrieved in given time interval |
 | tolerations | list | `[]` |  |
 | tolerations | list | `[]` |  |

+ 3 - 3
deploy/charts/external-secrets/templates/servicemonitor.yaml

@@ -24,7 +24,7 @@ metadata:
 {{ toYaml .Values.serviceMonitor.additionalLabels | indent 4 }}
 {{ toYaml .Values.serviceMonitor.additionalLabels | indent 4 }}
 {{- end }}
 {{- end }}
   name: {{ include "external-secrets.fullname" . }}-metrics
   name: {{ include "external-secrets.fullname" . }}-metrics
-  namespace: {{ .Release.Namespace | quote }}
+  namespace: {{ .Values.serviceMonitor.namespace | default .Release.Namespace | quote }}
 spec:
 spec:
   selector:
   selector:
     matchLabels:
     matchLabels:
@@ -72,7 +72,7 @@ metadata:
 {{ toYaml .Values.serviceMonitor.additionalLabels | indent 4 }}
 {{ toYaml .Values.serviceMonitor.additionalLabels | indent 4 }}
 {{- end }}
 {{- end }}
   name: {{ include "external-secrets.fullname" . }}-webhook-metrics
   name: {{ include "external-secrets.fullname" . }}-webhook-metrics
-  namespace: {{ .Release.Namespace | quote }}
+  namespace: {{ .Values.serviceMonitor.namespace | default .Release.Namespace | quote }}
 spec:
 spec:
   selector:
   selector:
     matchLabels:
     matchLabels:
@@ -121,7 +121,7 @@ metadata:
 {{ toYaml .Values.serviceMonitor.additionalLabels | indent 4 }}
 {{ toYaml .Values.serviceMonitor.additionalLabels | indent 4 }}
 {{- end }}
 {{- end }}
   name: {{ include "external-secrets.fullname" . }}-cert-controller-metrics
   name: {{ include "external-secrets.fullname" . }}-cert-controller-metrics
-  namespace: {{ .Release.Namespace | quote }}
+  namespace: {{ .Values.serviceMonitor.namespace | default .Release.Namespace | quote }}
 spec:
 spec:
   selector:
   selector:
     matchLabels:
     matchLabels:

+ 3 - 0
deploy/charts/external-secrets/tests/__snapshot__/crds_test.yaml.snap

@@ -1464,6 +1464,9 @@ should match snapshot of default values:
                                       type: object
                                       type: object
                                   type: object
                                   type: object
                               type: object
                               type: object
+                            externalID:
+                              description: AWS External ID set on assumed IAM roles
+                              type: string
                             region:
                             region:
                               description: AWS Region to be used for the provider
                               description: AWS Region to be used for the provider
                               type: string
                               type: string

+ 3 - 0
deploy/charts/external-secrets/values.yaml

@@ -130,6 +130,9 @@ serviceMonitor:
   # -- Specifies whether to create a ServiceMonitor resource for collecting Prometheus metrics
   # -- Specifies whether to create a ServiceMonitor resource for collecting Prometheus metrics
   enabled: false
   enabled: false
 
 
+  # -- namespace where you want to install ServiceMonitors
+  namespace: ""
+
   # -- Additional labels
   # -- Additional labels
   additionalLabels: {}
   additionalLabels: {}