Skip to content

chore(base-cluster/logs): only delete volumes on deletion#1721

Merged
cwrau merged 1 commit into
mainfrom
chore/loki/volume-improvements
Oct 16, 2025
Merged

chore(base-cluster/logs): only delete volumes on deletion#1721
cwrau merged 1 commit into
mainfrom
chore/loki/volume-improvements

Conversation

@cwrau
Copy link
Copy Markdown
Member

@cwrau cwrau commented Oct 9, 2025

chore(base-cluster/logs): optimize volume chown; this speeds up startup

Summary by CodeRabbit

  • New Features
    • Introduced filesystem group security policy for Loki pods to improve default security posture.
    • Added persistence lifecycle controls for Loki storage: retain data on scale events and delete on resource removal for clearer data management.
  • Chores
    • Upgraded Loki chart dependency to 6.42.0 for the latest stability and improvements.

chore(base-cluster/logs): optimize volume chown; this speeds up startup
Copilot AI review requested due to automatic review settings October 9, 2025 13:11
@cwrau cwrau enabled auto-merge October 9, 2025 13:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes Loki startup performance by updating the Loki Helm chart version and configuring volume ownership handling to only perform expensive operations when necessary.

  • Updated Loki Helm chart from version 6.33.0 to 6.42.0
  • Added fsGroupChangePolicy: OnRootMismatch to avoid unnecessary chown operations on startup
  • Configured persistence policy to retain volumes when scaling but delete when the deployment is removed

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
charts/base-cluster/values.yaml Updates Loki chart version to 6.42.0
charts/base-cluster/templates/monitoring/logs/loki.yaml Adds volume ownership optimization and persistence policies

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Oct 9, 2025

Walkthrough

Updated Loki Helm template to add podSecurityContext fsGroupChangePolicy and persistence lifecycle hooks. Bumped Grafana Loki chart version in values.yaml from 6.33.0 to 6.42.0.

Changes

Cohort / File(s) Summary
Loki Helm template updates
charts/base-cluster/templates/monitoring/logs/loki.yaml
Added podSecurityContext with fsGroupChangePolicy: OnRootMismatch; defined persistence lifecycle hooks whenScaled: Retain and whenDeleted: Delete.
Chart values update
charts/base-cluster/values.yaml
Bumped grafana.loki chart version from 6.33.0 to 6.42.0.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Dev as Helm (values.yaml)
  participant K8s as Kubernetes API
  participant STS as StatefulSet/PVC
  participant Loki as Loki Pod

  rect rgb(230,245,255)
  note over Dev: Upgrade Loki chart 6.33.0 ➜ 6.42.0
  Dev->>K8s: helm upgrade --values values.yaml
  end

  K8s->>STS: Reconcile StatefulSet & PVC
  STS-->>Loki: Create/Update Pod

  rect rgb(235,255,235)
  note over Loki: podSecurityContext.fsGroupChangePolicy=OnRootMismatch
  Loki->>Loki: Apply fsGroup adjustments on root mismatch
  end

  alt Scale event
    note over STS: Persistence whenScaled=Retain
    STS->>STS: Keep PVCs during scaling
  else Deletion
    note over STS: Persistence whenDeleted=Delete
    STS->>K8s: Delete PVCs on resource deletion
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump my paws—new charts arise,
Loki hums beneath the skies.
Groups set right, on roots we check,
Scale? We keep. Delete? We deck.
Version hops with gentle cheer—
Logs will whisper, crisp and clear. 🐇📜✨

Pre-merge checks and finishing touches

✅ 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 new persistence lifecycle behavior by indicating that volumes are only deleted on resource deletion, which is one of the primary changes in the patch. It uses concise and clear language without extraneous detail. While it omits mention of the fsGroupChangePolicy update for optimized chown behavior, it still correctly highlights a key aspect of the changeset.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/loki/volume-improvements

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 104f986 and d495feb.

📒 Files selected for processing (2)
  • charts/base-cluster/templates/monitoring/logs/loki.yaml (2 hunks)
  • charts/base-cluster/values.yaml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: check licenses
  • GitHub Check: Update release-please config file for a possibly new chart
  • GitHub Check: lint helm chart (base-cluster)
🔇 Additional comments (1)
charts/base-cluster/values.yaml (1)

112-112: Approve Loki chart bump; retention policy & fsGroup confirmed.

6.42.0 supports singleBinary.persistence.enableStatefulSetAutoDeletePVC for emitting whenDeleted/whenScaled; default podSecurityContext.fsGroup remains 10001.

Comment thread charts/base-cluster/templates/monitoring/logs/loki.yaml
Comment thread charts/base-cluster/templates/monitoring/logs/loki.yaml
@cwrau cwrau added this pull request to the merge queue Oct 16, 2025
Merged via the queue into main with commit 36b657a Oct 16, 2025
30 of 35 checks passed
@cwrau cwrau deleted the chore/loki/volume-improvements branch October 16, 2025 13:15
github-merge-queue Bot pushed a commit that referenced this pull request Oct 23, 2025
🤖 I have created a release *beep* *boop*
---


##
[10.0.0](base-cluster-v9.4.0...base-cluster-v10.0.0)
(2025-10-23)


### ⚠ BREAKING CHANGES

* **base-cluster/backup:** add k8up provider
([#1751](#1751))

### Features

* **base-cluster/backup:** add k8up provider
([#1751](#1751))
([0f36225](0f36225))


### Bug Fixes

* **base-cluster/kyverno:** change kubectl image
([#1734](#1734))
([cb42f26](cb42f26))
* **base-cluster:** conditions must the `true`, not just truthy
([#1738](#1738))
([7f46f4e](7f46f4e))
* **base-cluster:** migrate promtail leftovers to alloy
([#1720](#1720))
([8b7d062](8b7d062))


### Miscellaneous Chores

* **base-cluster/external-dns:** migrate domainFilters syntax
([#1681](#1681))
([51a42a2](51a42a2))
* **base-cluster/kdave:** remove kdave
([#1724](#1724))
([723c049](723c049))
* **base-cluster/logs:** only delete volumes on deletion
([#1721](#1721))
([36b657a](36b657a))
* **base-cluster/logs:** optimize volume chown; this speeds up startup
([36b657a](36b657a))
* **base-cluster/traces:** delete tempo volumes on deletion
([#1722](#1722))
([0afce96](0afce96))
* **base-cluster:** use upstream kubectl image instead of rancher
([#1718](#1718))
([d4daf94](d4daf94))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

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

## Summary by CodeRabbit

## Release Notes - Version 10.0.0

* **Breaking Changes**
* base-cluster/backup provider modifications require attention during
upgrade.

* **New Features**
  * base-cluster/backup enhancements.

* **Bug Fixes**
  * Kyverno configuration improvements.
  * kubectl image handling optimizations.
  * Boolean condition evaluation corrections.
  * Promtail migration cleanup.
  * Tempo volume deletion fixes.

* **Chores**
  * Infrastructure syntax and dependency updates.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants