diff --git a/solution-base/mongodb/charts/mongodb-sharded/templates/shard/shard-data-podmonitor.yaml b/solution-base/mongodb/charts/mongodb-sharded/templates/shard/shard-data-podmonitor.yaml index 7fb38a8b19..aa74ef3731 100644 --- a/solution-base/mongodb/charts/mongodb-sharded/templates/shard/shard-data-podmonitor.yaml +++ b/solution-base/mongodb/charts/mongodb-sharded/templates/shard/shard-data-podmonitor.yaml @@ -37,5 +37,8 @@ spec: matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: shardsvr shard: {{ $i | quote }} +{{- if lt $i (sub $replicas 1) }} +--- +{{- end }} {{- end }} {{- end }} diff --git a/solution-base/mongodb/patches/mongodb-sharded-fix-podmonitor.patch b/solution-base/mongodb/patches/mongodb-sharded-fix-podmonitor.patch deleted file mode 100644 index e6d7143650..0000000000 --- a/solution-base/mongodb/patches/mongodb-sharded-fix-podmonitor.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/solution-base/mongodb/charts/mongodb-sharded/templates/shard/shard-data-podmonitor.yaml b/solution-base/mongodb/charts/mongodb-sharded/templates/shard/shard-data-podmonitor.yaml -index d2c9c0cb..657764ac 100644 ---- a/solution-base/mongodb/charts/mongodb-sharded/templates/shard/shard-data-podmonitor.yaml -+++ b/solution-base/mongodb/charts/mongodb-sharded/templates/shard/shard-data-podmonitor.yaml -@@ -4,8 +4,7 @@ SPDX-License-Identifier: APACHE-2.0 - */}} - - {{- if and .Values.shards .Values.metrics.enabled .Values.metrics.podMonitor.enabled }} --{{- $replicas := .Values.shards | int }} --{{- range $i, $e := until $replicas }} -+{{- $i := 0 }} - apiVersion: monitoring.coreos.com/v1 - kind: PodMonitor - metadata: -@@ -36,7 +35,4 @@ spec: - selector: - matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} - app.kubernetes.io/component: shardsvr -- shard: {{ $i | quote }} ----- --{{- end }} - {{- end }} diff --git a/solution-base/mongodb/patches/shard-data-podmonitor.patch b/solution-base/mongodb/patches/shard-data-podmonitor.patch new file mode 100644 index 0000000000..e69de29bb2