GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(platform): add OpenCost as an optional package by dwkop · Pull Request #5262 · cozystack/cozystack

Conversation

@dwkop

@dwkop Daniel (dwkop) commented Nov 9, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

What this PR does

packages/system/opencost has shipped for a while, but no PackageSource references it, so operators cannot enable it through the platform and have to install it outside the platform lifecycle. This PR exposes it as cozystack.opencost, opt-in via bundles.enabledPackages, the same way KEDA is offered. It is not part of any variant's defaults.

  • packages/core/platform/sources/opencost.yaml: PackageSource, installs system/opencost into cozy-opencost. dependsOn lists install-order dependencies only: cozystack.networking, and cozystack.victoria-metrics-operator for the VMServiceScrape CRD. OpenCost reads the tenant-root vmselect at runtime, which is not a package and so is not listed.
  • templates/bundles/system.yaml: one package.optional.default line.
  • packages/system/opencost: honorLabels: true on the VMServiceScrape. OpenCost exports metrics such as container_cpu_allocation labelled with the namespace and pod of the measured workload. Without honorLabels the scrape overwrites them with the exporter's own target labels, so every cost series ends up attributed to cozy-opencost and per-namespace cost views are empty.

Tests: helm-unittest suites for the package: not emitted by default, emitted when listed in enabledPackages, disabledPackages wins, and the PackageSource dependencies and namespace. helm unittest packages/core/platform passes (289 tests).

Running it: we run the same chart, with honorLabels, on a Cozystack v1.6.4 lab cluster. Per-namespace allocations plus idle match the node price within 2 %, and a test pod with fixed requests is priced exactly as computed by hand.

Related: #4201 asks for per-tenant cost data. This PR covers only making OpenCost installable; the Rook/Ceph part and exposing cost data through the Cozystack API are out of scope.

Screenshots

No UI changes.

Downstream repositories

  • No downstream repository is affected by this change
  • cozystack/website - follow-up:
  • cozystack/terraform-provider-cozystack - follow-up:
  • cozystack/ansible-cozystack - follow-up:
  • cozystack/ccp - follow-up:
  • cozystack/talm - follow-up:
  • cozystack/cozyhr - follow-up:
  • cozystack/cozy-proxy - follow-up:
  • cozystack/cozystack-telemetry-server - follow-up:
  • cozystack/external-apps-example - follow-up:
  • cozystack/examples - follow-up:
  • cozystack/community - follow-up:

Walked the trigger map against the diff. The only entry it may hit is cozystack/website "Add or remove a platform component" (guides/platform-stack/_index.md, operations/configuration/licenses.md): this adds an opt-in PackageSource for a chart that already ships in packages/system, and no variant enables it. Nothing under packages/apps/packages/extra, packages/core/platform/values.yaml, variants, CRDs, hack/ or the installer changes, so the other repositories are not touched. Whether an opt-in package counts as a platform component for the website is a maintainer decision, so all boxes are left empty; happy to open the website issue or PR if wanted.

Release note

feat(platform): OpenCost can be enabled as an optional package by adding `cozystack.opencost` to `bundles.enabledPackages`. Its metrics scrape now keeps the namespace and pod labels of the measured workloads.

Summary by CodeRabbit

  • New Features

    • Added OpenCost as an optional system package. Enable it through the system bundle’s package settings.
    • OpenCost installs with its required networking and metrics components.
  • Bug Fixes

    • Cost metrics now preserve the measured workloads’ namespace and pod labels instead of using the exporter’s labels.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Daniel (dwkop) added 2 commits November 8, 2026 13:48
@dwkop
feat(platform): add OpenCost as an optional package
33effee
The opencost chart has shipped in packages/system for a long time but no PackageSource references it, so operators cannot enable it without installing it outside the platform lifecycle. Expose it as cozystack.opencost, opt-in via bundles.enabledPackages, so per-tenant cost allocation is available on demand without adding a default workload to every cluster.

Assisted-by: LLM
Signed-off-by: Daniel Kopeinig <[email protected]>
@dwkop
fix(opencost): keep workload labels on scraped cost metrics
5827a60
OpenCost exports metrics such as container_cpu_allocation labelled with the namespace and pod of the measured workload. Without honorLabels the scrape overwrites them with the exporter's own target labels, so every cost series ends up attributed to cozy-opencost and per-namespace dashboards are empty.

Assisted-by: LLM
Signed-off-by: Daniel Kopeinig <[email protected]>
@dwkop
Daniel (dwkop) requested review from IvanHunters, Kingdon Barrett (kingdonb), Andrei Kvapil (kvaps), Aleksei Sviridkin (lexfrei), Timofei Larkin (lllamnyp), mattia-eleuteri, myasnikovdaniil and Kirill Ilin (sircthulhu) as code owners November 9, 2026 21:31
@github-actions github-actions Bot added area/platform Issues or PRs related to platform infrastructure (bundle, flux, talos, installer) kind/feature Categorizes issue or PR as related to a new feature size/L This PR changes 100-499 lines, ignoring generated files labels Nov 9, 2026
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The changes add an optional OpenCost package source and system bundle entry, tests for its configuration and inclusion rules, and honorLabels: true on its VMServiceScrape endpoint.

Changes: OpenCost integration

Layer / File(s) Summary
Package registration and bundle inclusion
packages/core/platform/sources/opencost.yaml, packages/core/platform/templates/bundles/system.yaml, packages/core/platform/tests/sources_opencost_dependson_test.yaml, packages/core/platform/tests/bundles_opencost_default_test.yaml
Adds the OpenCost package source with two install-order dependencies and an optional system bundle entry. Tests check the source configuration and that the package is absent by default, included when enabled, and absent when disabled.
OpenCost metric label handling
packages/system/opencost/templates/vmservicescrape.yaml
Sets honorLabels: true on the scrape endpoint.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Possibly related PRs

  • cozystack/cozystack#5237: Configures CA trust for the platform OCI source and propagates it to the cozystack-packages source used by OpenCost.

Suggested labels: kind/feature, area/platform, area/monitoring, size/L

Suggested reviewers: kvaps

Merge Risk: Minimal · up to 5827a

This adds an optional OpenCost package that stays off unless an operator enables it. Operators need the monitoring stack in place before enabling it, and removing an installed Package requires deleting it manually. No blocking issue was established.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main change: adding OpenCost as an optional platform package.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (5 skipped: 5 unsupported.)

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

  • X
  • Mastodon
  • Reddit
  • LinkedIn
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

coderabbitai[bot]
coderabbitai Bot reviewed Nov 9, 2026
View reviewed changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Additional comments: 2

packages/core/platform/templates/bundles/system.yaml-383-383: 1

383-383: Minor · Functional Correctness · Quick win

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Document how to remove an installed OpenCost Package.

If an operator removes cozystack.opencost from enabledPackages or adds it to disabledPackages, this helper stops rendering the Package. Its helm.sh/resource-policy: keep annotation leaves an existing Package running, so the values change does not stop OpenCost. Document the required manual Package deletion with the opt-out instructions. The bundle already describes the same behavior for another kept Package. (raw.githubusercontent.com)

packages/core/platform/sources/opencost.yaml-21-23: 1

21-23: Major · Functional Correctness · Heavy lift

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Require the monitoring stack before enabling OpenCost on slim variants.

On a clean isp-slim installation, enabling only cozystack.opencost emits this Package, but the bundle does not emit cozystack.monitoring-application or cozystack.monitoring-agents by default. OpenCost then has no vmselect-shortterm.tenant-root.svc backend for its configured queries and cannot calculate costs. Make the opt-in include those prerequisites, or reject the combination with a clear render error. (raw.githubusercontent.com)

Review info

Run configuration

  • Source mode: Auto
  • Repository: cozystack/cozystack
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: b53ca1f
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5f6f1ca6-d625-4743-be64-4e21176cf789
Commits

Reviewing files that changed from the base of the PR and between b53ca1f and 5827a60.

Files selected for processing: 5

  • packages/core/platform/sources/opencost.yaml
  • packages/core/platform/templates/bundles/system.yaml
  • packages/core/platform/tests/bundles_opencost_default_test.yaml
  • packages/core/platform/tests/sources_opencost_dependson_test.yaml
  • packages/system/opencost/templates/vmservicescrape.yaml

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments
@kvaps Andrei Kvapil (kvaps) Awaiting requested review from kvaps kvaps is a code owner
@lllamnyp Timofei Larkin (lllamnyp) Awaiting requested review from lllamnyp lllamnyp is a code owner
@lexfrei Aleksei Sviridkin (lexfrei) Awaiting requested review from lexfrei lexfrei is a code owner
@myasnikovdaniil myasnikovdaniil Awaiting requested review from myasnikovdaniil myasnikovdaniil is a code owner
@IvanHunters IvanHunters Awaiting requested review from IvanHunters IvanHunters is a code owner
@sircthulhu Kirill Ilin (sircthulhu) Awaiting requested review from sircthulhu sircthulhu is a code owner
@mattia-eleuteri mattia-eleuteri Awaiting requested review from mattia-eleuteri mattia-eleuteri is a code owner
@kingdonb Kingdon Barrett (kingdonb) Awaiting requested review from kingdonb kingdonb is a code owner

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

area/platform Issues or PRs related to platform infrastructure (bundle, flux, talos, installer) kind/feature Categorizes issue or PR as related to a new feature size/L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dwkop
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.