diff --git a/charts/universal-chart/CHANGELOG.md b/charts/universal-chart/CHANGELOG.md index 0425155..ecf8127 100644 --- a/charts/universal-chart/CHANGELOG.md +++ b/charts/universal-chart/CHANGELOG.md @@ -1,4 +1,7 @@ # Changelog +## 3.4.0 - Jun 25, 2022 +* feat: optional namespaceSelector for servicemonitors + ## 3.3.0 - Jun 13, 2022 * feat: add PrometheusRule support and tests diff --git a/charts/universal-chart/Chart.yaml b/charts/universal-chart/Chart.yaml index f6ae3b2..d79168a 100644 --- a/charts/universal-chart/Chart.yaml +++ b/charts/universal-chart/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 description: Nixys universal Helm chart for deploy your apps to Kubernetes name: universal-chart -version: 3.3.0 +version: 3.4.0 maintainers: - name: Roman Andreev email: r.andreev@nixys.ru diff --git a/charts/universal-chart/README.md b/charts/universal-chart/README.md index 51ceea6..9f163ae 100644 --- a/charts/universal-chart/README.md +++ b/charts/universal-chart/README.md @@ -394,11 +394,12 @@ Secret `data` object is a map where value can be a string, json or base64 encode `servicemonitors` is a map of the ServiceMonitor parameters, where key is a name. -| Name | Description | Value | -|-----------------------|------------------------------------------|-------| -| `labels` | Extra ServiceMonitor labels | `{}` | -| `endpoints` | Array of ServiceMonitor endpoints | `[]` | -| `extraSelectorLabels` | Extra selectorLabels for select workload | `{}` | +| Name | Description | Value | +|-----------------------|----------------------------------------------|-------| +| `labels` | Extra ServiceMonitor labels | `{}` | +| `endpoints` | (REQUIRED) Array of ServiceMonitor endpoints | `[]` | +| `extraSelectorLabels` | Extra selectorLabels for select workload | `{}` | +| `namespaceSelector` | Extra namespaceSelector for ServiceMonitor | `{}` | ### typed Volumes parameters diff --git a/charts/universal-chart/results/servicemonitors.yml b/charts/universal-chart/results/servicemonitors.yml index 4ad42b8..3273f11 100644 --- a/charts/universal-chart/results/servicemonitors.yml +++ b/charts/universal-chart/results/servicemonitors.yml @@ -20,3 +20,48 @@ spec: app.kubernetes.io/name: test app.kubernetes.io/instance: test app: nginx +--- +# Source: universal-chart/templates/servicemonitor.yml +kind: ServiceMonitor +apiVersion: monitoring.coreos.com/v1 +metadata: + name: test-sm2 + namespace: "default" + labels: + app.kubernetes.io/name: test + app.kubernetes.io/instance: test + app.kubernetes.io/managed-by: Helm +spec: + endpoints: + - interval: 30s + path: /metrics + port: exporter + selector: + matchLabels: + app.kubernetes.io/name: test + app.kubernetes.io/instance: test + namespaceSelector: + any: true +--- +# Source: universal-chart/templates/servicemonitor.yml +kind: ServiceMonitor +apiVersion: monitoring.coreos.com/v1 +metadata: + name: test-sm3 + namespace: "default" + labels: + app.kubernetes.io/name: test + app.kubernetes.io/instance: test + app.kubernetes.io/managed-by: Helm +spec: + endpoints: + - interval: 30s + path: /metrics + port: exporter + selector: + matchLabels: + app.kubernetes.io/name: test + app.kubernetes.io/instance: test + namespaceSelector: + matchNames: + - production diff --git a/charts/universal-chart/samples/servicemonitors.yml b/charts/universal-chart/samples/servicemonitors.yml index 82ba57a..6b471f3 100644 --- a/charts/universal-chart/samples/servicemonitors.yml +++ b/charts/universal-chart/samples/servicemonitors.yml @@ -8,3 +8,18 @@ servicemonitors: app: nginx labels: foo: foo + sm2: + endpoints: + - interval: 30s + port: exporter + path: /metrics + namespaceSelector: + any: true + sm3: + endpoints: + - interval: 30s + port: exporter + path: /metrics + namespaceSelector: + matchNames: + - production diff --git a/charts/universal-chart/templates/servicemonitor.yml b/charts/universal-chart/templates/servicemonitor.yml index 6b6a5f8..61fb831 100644 --- a/charts/universal-chart/templates/servicemonitor.yml +++ b/charts/universal-chart/templates/servicemonitor.yml @@ -16,4 +16,8 @@ spec: {{- include "helpers.app.selectorLabels" $ | nindent 6 }} {{- with $.Values.generic.extraSelectorLabels }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 6 }}{{- end -}} {{- with .extraSelectorLabels }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 6 }}{{- end -}} + {{- with .namespaceSelector }} + namespaceSelector: + {{- toYaml . | nindent 4 -}} + {{- end -}} {{- end -}}