diff --git a/CHANGELOG.md b/CHANGELOG.md index dbf075a..2d00d05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2.1.3 - Aug 1, 2022 + +* fix: rolled back parameter `servicemonitors` and marked as deprecated + ## 2.1.2 - Aug 1, 2022 * fix: parameter `servicemonitors` has been renamed to `serviceMonitors` diff --git a/templates/NOTES.txt b/templates/NOTES.txt index 8ce9579..070fad9 100644 --- a/templates/NOTES.txt +++ b/templates/NOTES.txt @@ -1,3 +1,3 @@ {{- include "helpers.deprecation.notice" $ }} {{- include "helpers.deprecation.workload.imagePullSecrets" $ }} -{{- include "helpers.incompatibleChanges.serviceMonitors" $ }} \ No newline at end of file +{{- include "helpers.deprecation.serviceMonitors" $ }} \ No newline at end of file diff --git a/templates/helpers/_changes.tpl b/templates/helpers/_changes.tpl deleted file mode 100644 index 395db76..0000000 --- a/templates/helpers/_changes.tpl +++ /dev/null @@ -1,8 +0,0 @@ -{{- define "helpers.incompatibleChanges.serviceMonitors" -}} -{{- if .Values.servicemonitors }} - -** WARNING ** - -Option `servicemonitors` has been renamed to `serviceMonitors`. Please fix it in your values. -{{- end }} -{{ end }} diff --git a/templates/helpers/_deprecations.tpl b/templates/helpers/_deprecations.tpl index 5e93ffd..c9203f6 100644 --- a/templates/helpers/_deprecations.tpl +++ b/templates/helpers/_deprecations.tpl @@ -3,6 +3,9 @@ Option `imagePullSecrets` for workloads deprecated and will be removed in the future releases. Please use `extraImagePullSecrets` instead. + +Option `servicemonitors` has been renamed to `serviceMonitors` and will be removed in the future releases. +Please use `serviceMonitors` instead. {{- end }} @@ -32,3 +35,12 @@ You use deprecated option `imagePullSecrets` for cronjob "{{$name}}". Please use You use deprecated option `imagePullSecrets` for job "{{$name}}". Please use `extraImagePullSecrets` instead. {{- end }}{{ end }} {{ end }} + +{{- define "helpers.deprecation.serviceMonitors" -}} +{{- if .Values.servicemonitors }} + +** WARNING ** + +You use deprecated option `servicemonitors`. Please use `serviceMonitors` instead. +{{- end }} +{{ end }} diff --git a/templates/servicemonitor.yml b/templates/servicemonitor.yml index 4fb75b8..a323a0c 100644 --- a/templates/servicemonitor.yml +++ b/templates/servicemonitor.yml @@ -16,4 +16,24 @@ 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 -}} -{{- end -}} +{{- end }} + +{{- range $name, $sm := .Values.servicemonitors }} +--- +kind: ServiceMonitor +apiVersion: monitoring.coreos.com/v1 +metadata: + name: {{ include "helpers.app.fullname" (dict "name" $name "context" $) }} + namespace: {{ $.Release.Namespace | quote }} + labels: + {{- include "helpers.app.labels" $ | nindent 4 }} + {{- with .labels }}{{- include "helpers.tplvalues.render" (dict "value" . "context" $) | nindent 4 }}{{- end }} +spec: + endpoints: + {{- include "helpers.tplvalues.render" (dict "value" .endpoints "context" $) | nindent 4 }} + selector: + matchLabels: + {{- 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 -}} +{{- end }}