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

feat: helm chart feature for service monitor additional labels #185

Merged
merged 3 commits into from
Aug 10, 2024
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ encrypted files stored in `git` repository.

| Kubernetes | Sops | Chart | Operator |
|---|---|---|---|
| v1.30.x | v3.9.0 | 0.19.2 | 0.13.2 |
| v1.30.x | v3.9.0 | 0.19.3 | 0.13.2 |
| v1.29.x | v3.8.1 | 0.18.6 | 0.12.6 |
| v1.28.x | v3.8.1 | 0.17.4 | 0.11.4 |
| v1.27.x | v3.7.3 | 0.15.5 | 0.9.5 |
Expand Down
2 changes: 1 addition & 1 deletion chart/helm3/sops-secrets-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
# UPDATE_HERE
version: 0.19.2
version: 0.19.3
appVersion: 0.13.2
type: application
description: Helm chart deploys sops-secrets-operator
Expand Down
7 changes: 5 additions & 2 deletions chart/helm3/sops-secrets-operator/templates/monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "sops-secrets-operator.fullname" . }}-mentrics-monitor
name: {{ include "sops-secrets-operator.fullname" . }}-metrics-monitor
labels:
{{ include "sops-secrets-operator.labels" . | indent 4 }}
{{- include "sops-secrets-operator.labels" . | nindent 4 }}
{{- with .Values.metrics.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
endpoints:
- path: /metrics
Expand Down
26 changes: 26 additions & 0 deletions chart/helm3/sops-secrets-operator/tests/monitor_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,29 @@ tests:
value:
app.kubernetes.io/instance: sops
app.kubernetes.io/name: sops-secrets-operator

- it: should include additional labels when set
release:
name: sops
namespace: sops
set:
metrics:
enabled: true
additionalLabels:
custom-label: custom-value
asserts:
- hasDocuments:
count: 1
- isKind:
of: ServiceMonitor
- isAPIVersion:
of: monitoring.coreos.com/v1
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: sops
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: sops-secrets-operator
app.kubernetes.io/version: "0.13.2"
helm.sh/chart: sops-secrets-operator-0.19.3
custom-label: custom-value
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ tests:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: sops-secrets-operator
app.kubernetes.io/version: 0.13.2
helm.sh/chart: sops-secrets-operator-0.19.2
helm.sh/chart: sops-secrets-operator-0.19.3

# custom name
- it: should correctly render custome name
Expand Down
2 changes: 2 additions & 0 deletions chart/helm3/sops-secrets-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,5 @@ rbac:
metrics:
# -- Enable prometheus metrics
enabled: false
# -- Additional labels for ServiceMonitor
additionalLabels: {}
Loading