Skip to content

feat(monitoring): upgrade victoria-metrics-operator to v0.68.4 - #2426

Merged
myasnikovdaniil merged 1 commit into
mainfrom
feat/victoria-metrics-operator-v0.68.4
Apr 21, 2026
Merged

myasnikovdaniil merged 1 commit into
mainfrom
feat/victoria-metrics-operator-v0.68.4

Conversation

@lexfrei

@lexfrei Aleksei Sviridkin (lexfrei) commented Apr 20, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

Upgrades the vendored victoria-metrics-operator Helm chart from 0.59.1 to 0.61.0 (operator appVersion v0.68.1 → v0.68.4) by re-running make update in packages/system/victoria-metrics-operator/.

Picks up upstream bugfixes in the v0.68.x operator line:

  • Correct VMPodScrape port for VMAgent / VLAgent (previously misrouted, causing scrape failures)
  • StatefulSet pod deletion (not eviction) when maxUnavailable=100% — matches the minimum-downtime upgrade strategy
  • VMDistributed PVC no longer owned by both the StatefulSet and the top-level object
  • Finalizer cleanup on core Kubernetes resources and correct finalizer targeting for VLAgent/VLogs/VMAgent/VMSingle
  • Ingest-only VMSingle/VMAgent no longer mount scrape config secrets (avoids RBAC errors)
  • StatefulSet recreation when immutable fields change
  • Operator waits for PVC resize completion before continuing reconcile

Chart 0.60.0 is skipped deliberately: it switched the operator Deployment's selector to app.kubernetes.io/component, which required Deployment recreation on upgrade. 0.61.0 reverts that change, so jumping straight from 0.59.1 to 0.61.0 avoids the disruption.

Local patch patches/disable-ca-key-rotation.patch still applies cleanly against the new templates/webhook.yaml.

Release note

[monitoring] Upgrade victoria-metrics-operator chart to 0.61.0 (operator v0.68.4) for upstream STS/PVC bugfixes, correct VMPodScrape port, and finalizer cleanup.

Summary by CodeRabbit

  • New Features

    • Added support for configuring Deployment rolling update strategy
    • Added Deployment unhealthyPodEvictionPolicy for Pod Disruption Budgets
    • Added webhook annotations configuration
    • Extended CRD with statefulRollingUpdateStrategyBehavior and vmauth.enabled settings
  • Bug Fixes

    • Reverted Deployment matchLabels change from release 0.60.0
  • Documentation

    • Added changelog links to documentation

Bumps the vendored victoria-metrics-operator chart from 0.59.1 to 0.61.0
(operator appVersion v0.68.1 to v0.68.4) via `make update`.

Picks up upstream bugfixes in the v0.68.x line: correct VMPodScrape port
for VMAgent/VLAgent, StatefulSet pod deletion when maxUnavailable=100%,
VMDistributed PVC ownership fix, finalizer cleanup, ingest-only mode not
mounting scrape config secrets, STS recreation on immutable field changes,
and PVC resize completion wait.

Chart 0.60.0 is skipped because it introduced a matchLabels change
requiring Deployment recreation that was reverted in 0.61.0.

Local patch disable-ca-key-rotation.patch reapplies cleanly.

Assisted-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
@coderabbitai

coderabbitai Bot commented Apr 20, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR updates the VictoriaMetrics Operator Helm chart with version bumps to v0.61.0, refactors label and selector templating logic to revert Deployment matchLabels changes, extends CRD schemas with new configuration fields, and introduces new values for pod disruption budgets, deployment strategy, and webhook annotations.

Changes

Cohort / File(s) Summary
Chart Metadata & Release Documentation
packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/Chart.yaml, README.md, RELEASE_NOTES
packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/victoria-metrics-common/Chart.yaml, README.md, RELEASE_NOTES
Version bumps (0.59.1 → 0.61.0 for main chart; 0.0.46 → 0.3.0 for common subchart), appVersion update (v0.68.1 → v0.68.4), dependency registry change from HTTPS to OCI, version constraint narrowing (0.0.* → 0.3.*), and changelog/documentation link additions.
CRD Schema Extensions
packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/crds/crds/crd.yaml
Added int32 format hints to shardCount fields, introduced statefulRollingUpdateStrategyBehavior complex object with maxUnavailable across multiple spec sections, and added vmauth.enabled boolean property with default true.
Template Helper Refactoring
packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/victoria-metrics-common/templates/_helpers.tpl, _image.tpl, _pod.tpl, _service.tpl
Replaced default dict with dict for default value initialization, refactored label generation logic (added vm.commonLabels, updated vm.selectorLabels to always use app label), modified vm.podLabels to conditionally derive app.kubernetes.io/component from app label, and updated vm.labels to use vm.commonLabels base.
Deployment & Webhook Configuration
packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/templates/server.yaml, webhook.yaml, pdb.yaml, NOTES.txt
Added conditional deployment strategy support, improved pod disruption budget with unhealthyPodEvictionPolicy field, enhanced webhook configuration with user-provided annotations, and updated label selector in post-install notes to use both name and instance labels.
Values Configuration
packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/values.yaml
Uncommented and set explicit podDisruptionBudget values (minAvailable: 0, maxUnavailable: 0), added unhealthyPodEvictionPolicy key, introduced strategy block for RollingUpdate configuration, added admissionWebhooks.annotations for webhook customization, and updated example labelSelector from app: to app.kubernetes.io/component:.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

enhancement, size:L, lgtm

Suggested reviewers

  • lllamnyp
  • androndo
  • kvaps

Poem

🐰 Labels dance and selectors spin,
Templates refactor deep within,
Common labels now align,
Version bumps make charts shine,
VictoriaMetrics grows so fine! 📊

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: upgrading victoria-metrics-operator from v0.68.1 to v0.68.4, which is reflected throughout the changeset in Chart.yaml, dependencies, and release notes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/victoria-metrics-operator-v0.68.4

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Trivy (0.69.3)

Failed to read Trivy output file: ENOENT: no such file or directory, open '/inmem/1273/nsjail-01e7ec6a-9bd4-42bc-95e9-b1b92bc2faad/merged/.trivy-output.json'

Warning

Review ran into problems

🔥 Problems

Timed out fetching pipeline failures after 30000ms


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@dosubot dosubot Bot added the size/M This PR changes 30-99 lines, ignoring generated files label Apr 20, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/victoria-metrics-common/templates/_helpers.tpl (1)

177-183: Use deepCopy when assigning .extraLabels to prevent future mutation bugs.

vm.selectorLabels (line 233) and vm.metaLabels (line 180) both mutate .extraLabels directly via set. While the current code structure—where template outputs are serialized to YAML text and re-parsed in callers—prevents mutations from leaking, this pattern is fragile. Future refactoring that directly reuses maps instead of parsing text could reintroduce mutation bugs. Applying deepCopy to avoid referencing mutable context maps is a defensive practice that eliminates this risk.

Proposed fix
 {{- define "vm.metaLabels" -}}
   {{- include "vm.validate.args" . -}}
   {{- $Release := (.helm).Release | default .Release -}}
-  {{- $labels := .extraLabels | default dict -}}
+  {{- $labels := deepCopy (.extraLabels | default dict) -}}
   {{- $_ := set $labels "helm.sh/chart" (include "vm.chart" .) -}}
   {{- $_ := set $labels "app.kubernetes.io/managed-by" $Release.Service -}}
   {{- toYaml $labels -}}
 {{- end -}}
 {{- define "vm.selectorLabels" -}}
-  {{- $labels := .extraLabels | default dict -}}
+  {{- $labels := deepCopy (.extraLabels | default dict) -}}
   {{- $_ := set $labels "app.kubernetes.io/name" (include "vm.name" .) -}}
   {{- $_ := set $labels "app.kubernetes.io/instance" (include "vm.release" .) -}}
   {{- with (include "vm.app.name" .) -}}
     {{- $_ := set $labels "app" . -}}

Also applies to: 198–208, 232–249

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/victoria-metrics-common/templates/_helpers.tpl`
around lines 177 - 183, The templates vm.metaLabels and vm.selectorLabels
currently assign $labels := .extraLabels then mutate it with set, which risks
mutating the shared context; change those assignments to create an isolated copy
first, e.g. use deepCopy on the defaulted map: set $labels to deepCopy (default
dict .extraLabels) before any $_ := set calls, and apply the same pattern to the
other occurrences noted (the blocks around the other set usages). This ensures
you never call set directly on the original .extraLabels map and prevents future
mutation bugs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/victoria-metrics-common/README.md`:
- Around line 3-4: Replace the non-descriptive link text "here" with meaningful,
accessible text: update the first link to read something like "Victoria Metrics
Common chart documentation" (linking to
https://docs.victoriametrics.com/helm/victoria-metrics-common/) and update the
second link to read "Victoria Metrics Common changelog" (linking to
https://docs.victoriametrics.com/helm/victoria-metrics-common/changelog/),
ensuring the README.md uses descriptive anchor text to satisfy markdownlint
MD059.

In
`@packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/README.md`:
- Around line 3-4: Replace non-descriptive "here" link text with descriptive
link labels: change "Chart documentation is available [here](...)" to "Chart
documentation is available at the VictoriaMetrics Operator Helm chart docs"
(linking the same URL) and change "Changelog is [here](...)" to "Changelog for
the VictoriaMetrics Operator Helm chart" (linking the same URL); update the
README.md lines that contain those link occurrences so the link text describes
the target rather than using "here".

In
`@packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/templates/webhook.yaml`:
- Around line 17-28: The annotations block currently emits cert-manager keys and
then separately renders $certManager.annotations and $webhooks.annotations which
can produce duplicate keys; change the template to merge the maps into a single
annotations map (e.g., using the existing mustMerge helper pattern used in
monitor.yaml) so certmanager.k8s.io/inject-ca-from and
cert-manager.io/inject-ca-from are included in a base map and then mustMerge
with $certManager.annotations and $webhooks.annotations, then render that single
merged map with toYaml | nindent 4 to avoid duplicate YAML keys.

In
`@packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/values.yaml`:
- Around line 279-284: The PDB defaults currently set both minAvailable: 0 and
maxUnavailable: 0 which Helm treats as falsy so neither renders; update values
so only one PDB field is set and the other is empty (for example set
maxUnavailable to 0 and set minAvailable to an empty string/omitted) or
alternatively change templates/pdb.yaml to explicitly render numeric zero values
(handle "0" or use explicit equality checks) so that either minAvailable or
maxUnavailable is present; reference the minAvailable, maxUnavailable and
unhealthyPodEvictionPolicy entries in values.yaml and the templates/pdb.yaml
rendering logic when making this change.

---

Nitpick comments:
In
`@packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/victoria-metrics-common/templates/_helpers.tpl`:
- Around line 177-183: The templates vm.metaLabels and vm.selectorLabels
currently assign $labels := .extraLabels then mutate it with set, which risks
mutating the shared context; change those assignments to create an isolated copy
first, e.g. use deepCopy on the defaulted map: set $labels to deepCopy (default
dict .extraLabels) before any $_ := set calls, and apply the same pattern to the
other occurrences noted (the blocks around the other set usages). This ensures
you never call set directly on the original .extraLabels map and prevents future
mutation bugs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: df790bfb-9ee8-41ee-b4dd-74e838b87e7d

📥 Commits

Reviewing files that changed from the base of the PR and between 171c793 and 83ae237.

⛔ Files ignored due to path filters (2)
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/Chart.lock is excluded by !**/*.lock
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/crds/files/crd.yaml.bz2 is excluded by !**/*.bz2
📒 Files selected for processing (16)
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/Chart.yaml
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/README.md
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/RELEASE_NOTES
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/crds/crds/crd.yaml
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/victoria-metrics-common/Chart.yaml
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/victoria-metrics-common/README.md
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/victoria-metrics-common/RELEASE_NOTES
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/victoria-metrics-common/templates/_helpers.tpl
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/victoria-metrics-common/templates/_image.tpl
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/victoria-metrics-common/templates/_pod.tpl
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/victoria-metrics-common/templates/_service.tpl
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/templates/NOTES.txt
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/templates/pdb.yaml
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/templates/server.yaml
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/templates/webhook.yaml
  • packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/values.yaml

Comment on lines +3 to +4
Chart documentation is available [here](https://docs.victoriametrics.com/helm/victoria-metrics-common/).
Changelog is [here](https://docs.victoriametrics.com/helm/victoria-metrics-common/changelog/).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use descriptive link text.

here is non-descriptive and matches the markdownlint MD059 warning.

Proposed docs wording
-Chart documentation is available [here](https://docs.victoriametrics.com/helm/victoria-metrics-common/).
-Changelog is [here](https://docs.victoriametrics.com/helm/victoria-metrics-common/changelog/).
+See the [VictoriaMetrics Common Helm chart documentation](https://docs.victoriametrics.com/helm/victoria-metrics-common/).
+See the [VictoriaMetrics Common Helm chart changelog](https://docs.victoriametrics.com/helm/victoria-metrics-common/changelog/).
🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 3-3: Link text should be descriptive

(MD059, descriptive-link-text)


[warning] 4-4: Link text should be descriptive

(MD059, descriptive-link-text)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/victoria-metrics-common/README.md`
around lines 3 - 4, Replace the non-descriptive link text "here" with
meaningful, accessible text: update the first link to read something like
"Victoria Metrics Common chart documentation" (linking to
https://docs.victoriametrics.com/helm/victoria-metrics-common/) and update the
second link to read "Victoria Metrics Common changelog" (linking to
https://docs.victoriametrics.com/helm/victoria-metrics-common/changelog/),
ensuring the README.md uses descriptive anchor text to satisfy markdownlint
MD059.

Comment on lines +3 to +4
Chart documentation is available [here](https://docs.victoriametrics.com/helm/victoria-metrics-operator/).
Changelog is [here](https://docs.victoriametrics.com/helm/victoria-metrics-operator/changelog/).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use descriptive link text.

Avoid here so the README remains clear in rendered docs and link-only navigation.

Proposed docs wording
-Chart documentation is available [here](https://docs.victoriametrics.com/helm/victoria-metrics-operator/).
-Changelog is [here](https://docs.victoriametrics.com/helm/victoria-metrics-operator/changelog/).
+See the [VictoriaMetrics Operator Helm chart documentation](https://docs.victoriametrics.com/helm/victoria-metrics-operator/).
+See the [VictoriaMetrics Operator Helm chart changelog](https://docs.victoriametrics.com/helm/victoria-metrics-operator/changelog/).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Chart documentation is available [here](https://docs.victoriametrics.com/helm/victoria-metrics-operator/).
Changelog is [here](https://docs.victoriametrics.com/helm/victoria-metrics-operator/changelog/).
See the [VictoriaMetrics Operator Helm chart documentation](https://docs.victoriametrics.com/helm/victoria-metrics-operator/).
See the [VictoriaMetrics Operator Helm chart changelog](https://docs.victoriametrics.com/helm/victoria-metrics-operator/changelog/).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/README.md`
around lines 3 - 4, Replace non-descriptive "here" link text with descriptive
link labels: change "Chart documentation is available [here](...)" to "Chart
documentation is available at the VictoriaMetrics Operator Helm chart docs"
(linking the same URL) and change "Changelog is [here](...)" to "Changelog for
the VictoriaMetrics Operator Helm chart" (linking the same URL); update the
README.md lines that contain those link occurrences so the link text describes
the target rather than using "here".

Comment on lines +17 to +28
{{- if or $certManager.enabled $webhooks.annotations }}
annotations:
{{- if $certManager.enabled }}
certmanager.k8s.io/inject-ca-from: {{ printf "%s/%s-validation" $ns $fullname | quote }}
cert-manager.io/inject-ca-from: {{ printf "%s/%s-validation" $ns $fullname | quote }}
{{- end }}
{{- with $certManager.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $webhooks.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C3 'certmanager\.k8s\.io/inject-ca-from|cert-manager\.io/inject-ca-from|\$certManager\.annotations|\$webhooks\.annotations' \
  packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/templates/webhook.yaml

Repository: cozystack/cozystack

Length of output: 684


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check the full webhook.yaml file to understand context and confirm no other issues
cat -n packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/templates/webhook.yaml

Repository: cozystack/cozystack

Length of output: 5580


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Search for mergeOverwrite or similar annotation merging patterns in the entire chart
rg -n 'mergeOverwrite|merge|annotations' \
  packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/templates/ \
  --type yaml -A 2 -B 2

Repository: cozystack/cozystack

Length of output: 14707


Merge annotations before rendering to avoid duplicate YAML keys.

The annotations block renders three separate sources sequentially: hardcoded cert-manager keys (lines 20–21), $certManager.annotations, and $webhooks.annotations. If either user-provided annotation source contains a key matching the cert-manager keys, that key will appear multiple times in the same YAML map. While YAML parsers handle this by using the last occurrence, this is error-prone and violates the principle of explicit configuration.

Merge all annotation sources into a single map before rendering, following the pattern already used elsewhere in the chart (e.g., monitor.yaml line 3 with mustMerge):

🛠️ Proposed fix
-  {{- if or $certManager.enabled $webhooks.annotations }}
-  annotations:
-    {{- if $certManager.enabled }}
-    certmanager.k8s.io/inject-ca-from: {{ printf "%s/%s-validation" $ns $fullname | quote }}
-    cert-manager.io/inject-ca-from: {{ printf "%s/%s-validation" $ns $fullname | quote }}
-    {{- end }}
-    {{- with $certManager.annotations }}
-    {{- toYaml . | nindent 4 }}
-    {{- end }}
-    {{- with $webhooks.annotations }}
-    {{- toYaml . | nindent 4 }}
-    {{- end }}
+  {{- $mergedAnnotations := dict }}
+  {{- if $certManager.enabled }}
+    {{- $_ := set $mergedAnnotations "certmanager.k8s.io/inject-ca-from" (printf "%s/%s-validation" $ns $fullname) }}
+    {{- $_ := set $mergedAnnotations "cert-manager.io/inject-ca-from" (printf "%s/%s-validation" $ns $fullname) }}
+  {{- end }}
+  {{- $mergedAnnotations = mergeOverwrite $mergedAnnotations ($certManager.annotations | default dict) ($webhooks.annotations | default dict) }}
+  {{- if or $certManager.enabled $webhooks.annotations }}
+  annotations: {{ toYaml $mergedAnnotations | nindent 4 }}
+  {{- end }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/templates/webhook.yaml`
around lines 17 - 28, The annotations block currently emits cert-manager keys
and then separately renders $certManager.annotations and $webhooks.annotations
which can produce duplicate keys; change the template to merge the maps into a
single annotations map (e.g., using the existing mustMerge helper pattern used
in monitor.yaml) so certmanager.k8s.io/inject-ca-from and
cert-manager.io/inject-ca-from are included in a base map and then mustMerge
with $certManager.annotations and $webhooks.annotations, then render that single
merged map with toYaml | nindent 4 to avoid duplicate YAML keys.

Comment on lines +279 to +284
# -- min number or percentage of pods that can be unavailable
minAvailable: 0
# -- max number or percentage of pods that can be unavailable
maxUnavailable: 0
# -- Defines criteria when unhealthy pods should be considered for eviction
unhealthyPodEvictionPolicy:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C4 'podDisruptionBudget:|minAvailable: 0|maxUnavailable: 0|with \$pdb\.(minAvailable|maxUnavailable)' \
  packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/values.yaml \
  packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/templates/pdb.yaml

Repository: cozystack/cozystack

Length of output: 3401


🌐 Web query:

Helm Go template "with" numeric zero falsy behavior

💡 Result:

Yes, in Helm (Go templates), the "with" action treats a numeric zero value (0, 0.0) as falsy/empty, causing it to skip the block entirely, just like "if". This follows Go template semantics where pipelines in control structures like "if" and "with" evaluate to false/empty for: boolean false, numeric zero, empty string, nil, or empty collections. Official Helm docs confirm this for "if": "A pipeline is evaluated as false if the value is: a boolean false, a numeric zero, an empty string, a nil (empty or null), [or] an empty collection." Helm docs explicitly state for "with": "the block after with only executes if the value of PIPELINE is not empty." Go template docs confirm: "{{with pipeline}} ... {{end}}" behaves like "if" - skips if pipeline is empty (includes numeric zero). This causes common issues in Helm charts, e.g., setting replicaCount: 0 in values.yaml skips rendering the replicas field (treated as falsy in {{- if .Values.replicaCount }}), defaulting to 1. Workarounds use hasKey, kindIs "float64", or ne 0.

Citations:


🌐 Web query:

Kubernetes PodDisruptionBudget API spec minAvailable maxUnavailable required

💡 Result:

In the Kubernetes PodDisruptionBudget (PDB) API (policy/v1), the spec fields minAvailable and maxUnavailable are optional and mutually exclusive. Exactly one of them must be specified to define the disruption budget, but neither is strictly required if the other is provided. The selector field is required. Status fields like currentHealthy, desiredHealthy, disruptionsAllowed, and expectedPods are required.

Citations:


Fix the PDB defaults to render a valid Kubernetes spec.

The current defaults set both minAvailable: 0 and maxUnavailable: 0. Helm's with blocks treat numeric 0 as falsy, so neither field renders when PDB is enabled. Kubernetes PodDisruptionBudget requires at least one of these fields to be specified.

Set one field to a valid value and leave the other empty:

Proposed fix
   # -- min number or percentage of pods that can be unavailable
-  minAvailable: 0
+  minAvailable:
   # -- max number or percentage of pods that can be unavailable
-  maxUnavailable: 0
+  maxUnavailable: 1

Alternatively, update templates/pdb.yaml to render explicit zero values and ensure only one of the fields is set.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# -- min number or percentage of pods that can be unavailable
minAvailable: 0
# -- max number or percentage of pods that can be unavailable
maxUnavailable: 0
# -- Defines criteria when unhealthy pods should be considered for eviction
unhealthyPodEvictionPolicy:
# -- min number or percentage of pods that can be unavailable
minAvailable:
# -- max number or percentage of pods that can be unavailable
maxUnavailable: 1
# -- Defines criteria when unhealthy pods should be considered for eviction
unhealthyPodEvictionPolicy:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/values.yaml`
around lines 279 - 284, The PDB defaults currently set both minAvailable: 0 and
maxUnavailable: 0 which Helm treats as falsy so neither renders; update values
so only one PDB field is set and the other is empty (for example set
maxUnavailable to 0 and set minAvailable to an empty string/omitted) or
alternatively change templates/pdb.yaml to explicitly render numeric zero values
(handle "0" or use explicit equality checks) so that either minAvailable or
maxUnavailable is present; reference the minAvailable, maxUnavailable and
unhealthyPodEvictionPolicy entries in values.yaml and the templates/pdb.yaml
rendering logic when making this change.

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 20, 2026
@myasnikovdaniil
myasnikovdaniil merged commit 7287b02 into main Apr 21, 2026
11 checks passed
@myasnikovdaniil
myasnikovdaniil deleted the feat/victoria-metrics-operator-v0.68.4 branch April 21, 2026 10:13
Andrei Kvapil (kvaps) added a commit that referenced this pull request May 20, 2026
## What this PR does

Follow-up to #2675. Fixes four broken references in
`docs/changelogs/v1.4.0.md` that were caught by re-verifying every link
in the merged changelog:

| Where | Was | Now |
|---|---|---|
| Resource Presets doc link (Feature Highlights) |
`cozystack.io/docs/operations/resource-presets/` (404) |
`cozystack.io/docs/v1.4/guides/resource-management/` |
| HAMi doc link (Feature Highlights) |
`cozystack.io/docs/operations/kubernetes/hami/` (404) |
`cozystack.io/docs/v1.4/kubernetes/gpu-sharing/` |
| Upgrade notes — resource presets PR ref | `#2426` (`feat(monitoring):
upgrade victoria-metrics-operator`) | `#2607` (`feat(apps):
instance-type resource presets`) |
| Upgrade notes — postgres parameters PR ref | `#2475` (unrelated open
issue about bundle YAML) | `#2466` (`feat(postgres)!: support all
PostgreSQL configuration parameters`) |

The Feature Highlights / Major Features sections already cited #2607 and
#2466 correctly; only the Upgrade Notes section pointed at the wrong PR
numbers.

### Release note

```release-note
NONE
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Updated changelog documentation links to reflect new resource
management guides location.
* Refreshed HAMi compatibility references to point to current
GPU-sharing documentation.
  * Updated related PR references in upgrade notes for accuracy.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/cozystack/cozystack/pull/2693?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sergei Makarov (SerjioTT) pushed a commit to SerjioTT/cozystack that referenced this pull request May 20, 2026
- Resource Presets doc URL: /docs/operations/resource-presets/ → /docs/v1.4/guides/resource-management/ (was 404)
- HAMi doc URL: /docs/operations/kubernetes/hami/ → /docs/v1.4/kubernetes/gpu-sharing/ (was 404)
- Upgrade-notes PR ref for presets: cozystack#2426 → cozystack#2607
- Upgrade-notes PR ref for postgres parameters: cozystack#2475 → cozystack#2466

Assisted-By: Claude <[email protected]>
Signed-off-by: Myasnikov Daniil <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size/M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants