Skip to content

feat(apps): instance-type resource presets with five series - #2607

Merged
Andrei Kvapil (kvaps) merged 10 commits into
cozystack:mainfrom
lexfrei:feat/instance-type-presets
May 12, 2026
Merged

Andrei Kvapil (kvaps) merged 10 commits into
cozystack:mainfrom
lexfrei:feat/instance-type-presets

Conversation

@lexfrei

@lexfrei Aleksei Sviridkin (lexfrei) commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

Closes #1959.

Continuation of Matthieu ROBIN (@matthieu-robin)'s instance-type resource presets work, addressing the migration gaps and resource regressions surfaced during the review of #1959.

Resource presets now follow a cloud-style <series>.<size> naming convention. Five series cover the full CPU-to-memory ratio range, each with eight sizes (nano through 4xlarge):

Series Ratio Use case
t1 1:0.5 Tiny / burstable, low memory
c1 1:1 Compute-balanced
s1 1:2 Standard — proxies, caches
u1 1:4 Universal — databases, messaging
m1 1:8 Memory — search, analytics

40 instance-type presets in total. The seven legacy flat names (nano, micro, small, medium, large, xlarge, 2xlarge) remain accepted as deprecated aliases.

Upgrade path

The combination of three mechanisms makes the rename a no-op for existing deployments:

  1. cozy-lib legacy aliases — preserve the exact pre-rename CPU and memory for every legacy name. helm template ... --set resourcesPreset=small continues to render 1 CPU / 512Mi, identical to before. No HelmRelease that already lives on the cluster breaks.
  2. Migration 39 — a pre-upgrade hook walks every HelmRelease.spec.values and every app CR under apps.cozystack.io/v1alpha1, rewriting legacy values to their 1:1 instance-type equivalents (nano → t1.nano, medium → c1.small, etc). Idempotent, best-effort, dry-runnable via MIGRATION_DRY_RUN=1, distinguishes "no items" from "kubectl errored" so a broken cluster cannot silently stamp the version.
  3. cozystack-api deprecation warning — every Create and Update on an app CR with a legacy value emits a klog warning naming the JSON path and the 1:1 replacement, so operators discover any remaining legacy data after the platform upgrade.

The legacy-to-instance-type mapping is 1:1 by CPU and memory:

Legacy CPU Memory Instance-type
nano 250m 128Mi t1.nano
micro 500m 256Mi t1.micro
small 1 512Mi t1.small
medium 1 1Gi c1.small
large 2 2Gi c1.medium
xlarge 4 4Gi c1.large
2xlarge 8 8Gi c1.xlarge

Mirrored in four places (cozy-lib template, Go package, migration jq, docs) with cross-reference comments so drift is visible.

Why not just #1959

The implementation in #1959 had three blockers that motivated this rewrite:

  • cozy-lib lost the legacy names entirely, so any existing HelmRelease with resourcesPreset: small failed render with Preset key 'small' invalid. Aliases close this hole.
  • Migration only touched HelmReleases, leaving app CRs unmigrated; the next kubectl edit would fail enum validation. The new migration walks both.
  • Defaults silently inflated memory, e.g. Redis nano → m1.nano jumped from 128Mi to 2Gi (×16). With two replicas plus sentinel the e2e VM ran out of memory, producing the Redis 90s timeout that blocked the original PR. New defaults preserve resources 1:1.

Deprecation timeline

Legacy aliases are scheduled for removal in a future cozystack release. The combination of migration + operator warnings is expected to converge production clusters before then. Removal will land as a separate PR with its own migration cleanup pass.

Test plan

  • make unit-tests — Go tests for the preset walker + warning helper, helm unittest legacy↔instance-type parity suites for postgres/clickhouse/opensearch, RD schema invariance check via hack/check-rd-presets.sh.
  • make generate is idempotent.
  • helm template ./packages/apps/redis with the new default renders 250m / 128Mi (matches pre-rename Redis exactly — closes the e2e blocker).
  • helm template ./packages/apps/postgres --set resourcesPreset=small renders 1 / 512Mi (legacy alias works).
  • Migration dry-run is exercised via MIGRATION_DRY_RUN=1.

Documentation

See docs/operations/resource-presets.md for the full size matrix and migration table.

Release note

feat(cozy-lib): introduce `<series>.<size>` instance-type resource presets (t1/c1/s1/u1/m1 × 8 sizes). Legacy flat names (nano…2xlarge) remain accepted as deprecated 1:1 aliases; migration 39 rewrites stored values to the new form. CPU and memory are preserved exactly across the rename.

Summary by CodeRabbit

  • New Features

    • Expanded resource preset options to instance-style names (e.g., t1., c1., m1.*); legacy flat names remain supported as deprecated aliases.
    • Deprecation warnings now surface when legacy presets are detected.
  • Documentation

    • Added a comprehensive resource-presets guide and updated chart/app docs to the new naming convention.
  • Tests

    • Added compatibility tests ensuring legacy ↔ instance-type presets render identical resources.
  • Chores

    • Migration and CI checks to detect/upgrade legacy preset values.

Review Change Stack

…y aliases

Restructure the resource preset table into a flat <series>.<size> naming
convention inspired by KubeVirt and cloud-provider instance types. Five
series cover the full CPU-to-memory ratio range:

  t1 (Tiny,      1:0.5) — burstable, low memory
  c1 (Compute,   1:1)   — CPU-balanced, CPU-bound workloads
  s1 (Standard,  1:2)   — proxies, caches, lightweight services
  u1 (Universal, 1:4)   — databases and messaging
  m1 (Memory,    1:8)   — search and analytics

Each series provides eight sizes (nano, micro, small, medium, large,
xlarge, 2xlarge, 4xlarge), yielding 40 presets in total. Ephemeral
storage remains 2Gi for every preset.

The seven legacy flat names (nano, micro, small, medium, large, xlarge,
2xlarge) are retained as backward-compatibility aliases returning their
original CPU and memory values. Existing HelmReleases and app CRs
continue to render identical resources without a migration step. The
legacy block is deprecated and will be removed in a future release; the
1:1 conversion table is:

  nano    -> t1.nano       (250m / 128Mi)
  micro   -> t1.micro      (500m / 256Mi)
  small   -> t1.small      (1    / 512Mi)
  medium  -> c1.small      (1    / 1Gi)
  large   -> c1.medium     (2    / 2Gi)
  xlarge  -> c1.large      (4    / 4Gi)
  2xlarge -> c1.xlarge     (8    / 8Gi)

Also fix the preset helper docstring to pass the preset string straight
to unsanitizedPreset, replacing the prior list applied-to-tuple form
that silently invoked the dot value as a function.

Co-authored-by: Matthieu ROBIN <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
Rewrite resourcesPreset values in every apps/* and extras/* chart from
the legacy flat names to the new instance-type form, using the 1:1
mapping:

  nano    -> t1.nano       micro   -> t1.micro
  small   -> t1.small      medium  -> c1.small
  large   -> c1.medium     xlarge  -> c1.large
  2xlarge -> c1.xlarge

Each affected values.yaml carries the canonical 47-value enum (40
instance-type names plus 7 legacy aliases) so the schema accepts both
forms during the deprecation window. cozyvalues-gen regenerates the
matching api/apps/v1alpha1/*/types.go kubebuilder enum and defaults,
the chart values.schema.json, the README parameter table, and the
ApplicationDefinition openAPISchema in packages/system/*-rd/cozyrds.

Three hardcoded legacy literals in chart templates migrated:
  - packages/apps/harbor/templates/harbor.yaml:121 (portal)
  - packages/apps/opensearch/templates/opensearch.yaml:43 (dashboards)
  - packages/system/keycloak/templates/sts.yaml:115 (heap fallback)

packages/apps/foundationdb/Makefile gains the missing hack/update-crd.sh
call. Without it, every regen left foundationdb-rd cozyrds stale and
new FoundationDB app CRs through cozystack-api were rejected at
validation for any non-legacy resourcesPreset value.

Every default-rendered chart produces identical CPU and memory to the
value applied before the rename, courtesy of the legacy alias table in
cozy-lib and the 1:1 default mapping.

Co-authored-by: Matthieu ROBIN <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
cozystack-api now scans each app CR Create and Update for the legacy
flat resourcesPreset names (nano, micro, small, medium, large, xlarge,
2xlarge) and emits a klog warning per occurrence with the dotted JSON
path inside the spec and the suggested 1:1 instance-type replacement.

Example log line:

  Postgres/foo in tenant-x uses deprecated resourcesPreset "small" at
  spec.resourcesPreset; migrate to "t1.small" (1:1 equivalent CPU and
  memory)

Warnings are non-blocking. Legacy values still render correctly through
the cozy-lib legacy alias table; the warning helps operators discover
remaining legacy data after the platform upgrade.

The mapping table lives in pkg/apis/apps/presets/legacy.go and is the
single Go-side source of truth. The walker handles top-level, nested,
in-array, non-string and malformed-spec inputs. The wrapper warns are
emitted via a pure helper deprecationMessagesFor so the message format
is unit-testable without intercepting klog.

Co-authored-by: Matthieu ROBIN <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
Add a new pre-upgrade hook migration that walks every HelmRelease
spec.values and every app CR spec under apps.cozystack.io/v1alpha1, and
rewrites legacy flat resourcesPreset values (nano/micro/small/medium/
large/xlarge/2xlarge) to their instance-type equivalents (t1/c1).

Mapping is 1:1 by CPU and memory — the migration never bumps resource
usage. The same table lives in cozy-lib (legacy aliases) and in
pkg/apis/apps/presets/legacy.go.

Properties:

  - Idempotent: re-running on a converted cluster is a no-op because
    non-legacy values fall through the jq map_legacy else arm.
  - Best-effort: a single failed patch logs a warning and continues;
    cozy-lib legacy aliases keep charts rendering with identical CPU
    and memory even if the migration is incomplete. kubectl patch
    stderr is captured and surfaced in the WARN line so operators see
    why a patch was rejected.
  - Distinguishes "no items" from "kubectl errored" (RBAC stripped,
    network down, CRD missing) so a broken cluster cannot look
    identical to a clean no-op run and stamp the version
    unconditionally.
  - Dry-run: MIGRATION_DRY_RUN=1 prints the would-be patches and
    leaves the version stamp at 39.
  - Final summary echoed to both stdout and stderr.
  - Version stamp only advances to 40 on a fully successful real run.

Bump migrations.targetVersion 39 -> 40 so the hook executes on the
next platform upgrade.

Co-authored-by: Matthieu ROBIN <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
Pin the 1:1 equivalence between legacy flat preset names and their
instance-type counterparts in helm-unittest for three charts that
exercise different preset shapes:

  - postgres   — top-level only
  - clickhouse — top + nested clickhouseKeeper preset
  - opensearch — top + nested dashboards preset

Each case asserts that nano <-> t1.nano, small <-> t1.small,
medium <-> c1.small, large <-> c1.medium, and micro <-> t1.micro
render the same CPU and memory.

packages/apps/{clickhouse,opensearch}/Makefile gain a `test:` target
that calls helm unittest so hack/helm-unit-tests.sh actually runs the
new suites in CI; without it the suites would land as dead weight.

hack/check-rd-presets.sh enforces two invariants in `make unit-tests`:

  - every packages/system/*-rd/cozyrds/*.yaml openAPISchema carries
    the canonical 47-preset enum (40 instance-type + 7 legacy);
  - no chart template carries a hardcoded legacy preset literal in
    a defaultingSanitize (list "<legacy>" ...) form.

Both turn an accidental drop of a per-chart Makefile step or an
accidental legacy hardcode into a CI failure rather than silent
production-time validation rejection.

Co-authored-by: Matthieu ROBIN <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
Document the five instance-type series (t1/c1/s1/u1/m1) introduced
alongside the legacy preset deprecation, the per-size CPU and memory
matrix, and the 1:1 legacy-to-instance-type mapping table that powers
cozy-lib aliases, migration 39, and the operator-side deprecation
warning.

Single source of truth referenced from:
  - packages/library/cozy-lib/templates/_resourcepresets.tpl
  - packages/core/platform/images/migrations/migrations/39
  - pkg/apis/apps/presets/legacy.go

Includes an explicit callout that legacy `medium` (1 CPU / 1Gi) and
instance-type `*.medium` (2 CPU) are not the same — same word,
different resources.

Replace inline preset tables in packages/apps/postgres/README.md and
packages/apps/kafka/README.md with a short paragraph that names the
five series and points at the canonical doc, since the per-app
inline tables listed only the legacy seven and would drift further
as the canonical matrix evolves.

Co-authored-by: Matthieu ROBIN <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added size/XXL This PR changes 1000+ lines, ignoring generated files area/uncategorized PR auto-labeler could not map title scope to a known area/*; please review kind/feature Categorizes issue or PR as related to a new feature labels May 11, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a structured naming convention for resource presets, replacing legacy flat names with a series-based system that provides better clarity on CPU-to-memory ratios. The changes include a robust upgrade path consisting of backward-compatible aliases, an automated migration script for existing cluster resources, and operator-facing warnings to facilitate the transition to the new naming scheme.

Highlights

  • Resource Presets Renaming: Introduced a new cloud-style <series>.<size> naming convention for resource presets (t1, c1, s1, u1, m1 series) to better represent CPU-to-memory ratios.
  • Backward Compatibility: Legacy flat names (nano, micro, small, medium, large, xlarge, 2xlarge) are preserved as deprecated aliases, ensuring existing deployments remain functional.
  • Automated Migration: Implemented Migration 39 to automatically rewrite legacy resourcesPreset values to the new instance-type format in HelmReleases and Application CRs.
  • Operator Warnings: Added klog warnings in cozystack-api to notify operators of any remaining legacy preset values during Create/Update operations.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment Gemini (@gemini-code-assist) Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@coderabbitai

coderabbitai Bot commented May 11, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds instance-type resource presets, updates defaults/enums across APIs, charts, and system schemas, includes a migration to rewrite legacy values, server-side deprecation warnings, CI checks, and refreshed docs/tests.

Changes

Instance-type resource presets rollout

Layer / File(s) Summary
Library: preset catalog and helpers
packages/library/cozy-lib/templates/_resourcepresets.tpl, packages/library/cozy-lib/templates/_resources.tpl
Defines instance-type presets with legacy aliases; updates helper docs.
Server: legacy preset detection and warnings
pkg/apis/apps/presets/*, pkg/registry/apps/application/rest.go, pkg/registry/apps/application/rest_legacy_presets_test.go
Maps legacy → new, finds occurrences, formats warnings, wires into Create/Update; tests added.
Platform migration 39→40 and version bump
packages/core/platform/images/migrations/migrations/39, packages/core/platform/values.yaml
jq-based rewrite of legacy preset strings; bumps target version to 40.
Repo CI: preset schema guard and Makefile wiring
Makefile, hack/check-rd-presets.sh
Adds rd-presets-check and script to validate RD schemas and detect hardcoded legacy presets.
API CRD annotations: defaults and enums
api/apps/v1alpha1/*/types.go
Kubebuilder defaults updated to new presets; validation enums expanded.
System ApplicationDefinition schemas and system template
packages/system/*-rd/cozyrds/*.yaml, packages/system/keycloak/templates/sts.yaml
RD openAPISchema enums/defaults expanded; Keycloak/defaulting adjusted.
Apps and extras: values, schemas, templates, tests, docs
packages/apps/*, packages/extra/*
Chart values/schema defaults and enums updated; templates/tests/docs aligned; some Makefile test targets added.
Documentation: resource-presets reference
docs/operations/resource-presets.md
Adds series/size tables, legacy alias mapping, and migration notes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

I twitch my nose at t1 dawn,
Small to micro, the charts move on.
Old names rest as gentle aliases,
Migrations hop through cluster valleys.
CI hums — presets bloom anew. 🥕

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a new cloud-style resource preset naming convention (.) across the platform, updating numerous application charts, documentation, and the cozy-lib library. It includes a migration script to transition existing resources and updates the API server to provide deprecation warnings. Feedback includes improving the robustness of the preset validation script's jq filters, ensuring explicit error handling during JSON unmarshalling in the API registry, and addressing the mutability of the exported legacy mapping configuration to prevent accidental modification.

// LegacyMapping is the canonical 1:1 conversion table from legacy flat
// preset names to their instance-type equivalents. CPU and memory of the
// returned preset match the legacy value exactly.
var LegacyMapping = map[string]string{

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.

low

The LegacyMapping map is exported and mutable. While it is intended to be a canonical constant, Go does not support constant maps. To prevent accidental modification by other packages, consider making it private and providing a public getter function that returns a copy, or explicitly documenting it as read-only.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

LegacyMapping is exported intentionally as a read-only canonical reference. The package doc-comment names the three other places the table is mirrored (cozy-lib _resourcepresets.tpl, migration 39, and docs/operations/resource-presets.md), so the table being directly inspectable from outside the package is the point — wrapping it in a getter that returns a defensive copy adds allocation on every lookup for no real safety win, since nothing in the codebase mutates it. Will revisit if a need arises to actually pass the map to code that might write to it.

Comment thread pkg/registry/apps/application/rest.go Outdated
Comment on lines +1775 to +1777
if err := json.Unmarshal(app.Spec.Raw, &spec); err != nil {
return nil
}

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.

low

The error from json.Unmarshal is silently ignored. While app.Spec.Raw is expected to be valid JSON at this stage due to previous validation, it is better practice to log the error or handle it explicitly to avoid silent failures if the internal state is somehow corrupted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in af46317. deprecationMessagesFor now logs klog.V(2) with kind, name, namespace and the underlying error before returning on a JSON parse failure. Kept at debug verbosity because the helper is purely informational — upstream validation (validateNoInternalKeys plus the structural-schema check in Create/Update) owns rejecting invalid specs, and a hard error here would fire on transient inputs the caller is about to reject anyway.

Comment thread hack/check-rd-presets.sh Outdated
fi
# The schema is a JSON blob. Pull every resourcesPreset enum out of it.
enums=$(printf '%s' "$schema" | jq -r '
[.. | objects | select(has("enum") and (.description? // "" | test("preset"; "i")))]

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.

low

The jq filter uses a heuristic test("preset"; "i") to identify the resourcesPreset enum. While effective for the current schema, it might produce false positives if other fields have "preset" in their description. Consider a more robust path-based selector if the schema structure is guaranteed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 9d9750e. The jq selector now keys on the JSON path suffix resourcesPreset rather than the description-substring heuristic, so an unrelated field whose description happens to contain "preset" cannot match. Verified locally that the check still passes against every existing RD schema.

@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: 9

🧹 Nitpick comments (4)
hack/check-rd-presets.sh (3)

19-23: 💤 Low value

Guard against the no-match glob expansion.

With set -euo pipefail and no nullglob, if packages/system/*-rd/cozyrds/*.yaml matches nothing, the loop runs once with the literal pattern as $f and yq will fail on a non-existent file. Not currently a problem since the files exist, but a quick guard (shopt -s nullglob before the loop) makes the script robust if directories are reorganized.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@hack/check-rd-presets.sh` around lines 19 - 23, The for-loop over the glob
pattern packages/system/*-rd/cozyrds/*.yaml can iterate once with the literal
pattern when no files match under set -euo pipefail; enable bash nullglob before
the loop (e.g., call shopt -s nullglob) so unmatched globs expand to nothing and
the loop is skipped, then restore previous nullglob state if needed; target the
loop that defines variable f and the glob expression to apply this change.

25-28: ⚡ Quick win

Description-based enum discovery is fragile.

The jq filter selects enum-bearing objects whose description matches preset (case-insensitive). If a future RD schema rewords the description (e.g., "Default sizing for replicas"), the check will silently skip that schema and never enforce the canonical preset set. Consider keying off the JSON path / property name (resourcesPreset) instead, e.g., walk the schema tree and collect enum from any property literally named resourcesPreset (including under properties chains).

♻️ Proposed jq filter (property-name based)
-  enums=$(printf '%s' "$schema" | jq -r '
-    [.. | objects | select(has("enum") and (.description? // "" | test("preset"; "i")))]
-    | .[].enum[]
-  ' 2>/dev/null || true)
+  enums=$(printf '%s' "$schema" | jq -r '
+    [.. | objects | .properties? // {} | .resourcesPreset? // empty | select(.enum?)]
+    | .[].enum[]?
+  ' 2>/dev/null || true)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@hack/check-rd-presets.sh` around lines 25 - 28, The current jq expression
that builds the enums variable matches objects by description text which is
brittle; update the jq filter used to set enums so it walks the schema tree and
selects any property literally named "resourcesPreset" (e.g., look for objects
under "properties" whose key == "resourcesPreset") and then extracts their enum
arrays instead of matching on .description; modify the command that assigns
enums (the jq invocation that feeds printf '%s' "$schema") to implement this
property-name-based traversal and collection so enums contains the canonical
preset values even if descriptions change.

55-56: ⚡ Quick win

Widen the regex pattern to catch prefixed preset names in hardcoded values.

The current pattern only matches unprefixed literals (nano, micro, small, etc.), but actual templates use prefixed presets like "t1.small" and "t1.nano". This gap allows the check to miss legacy presets when they appear with vendor prefixes. Expand the pattern to include these variants and also allow flexible whitespace around the list delimiter.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@hack/check-rd-presets.sh` around lines 55 - 56, The grep command that
populates legacy_hits uses a narrow regex matching unprefixed names; update that
regex to allow optional vendor prefixes and flexible whitespace by matching an
optional namespace/prefix before the preset names (e.g., allow something like
"[a-z0-9]+." before nano|micro|...) and permit spaces around the list delimiter
and quotes; modify the pattern used in the legacy_hits assignment so it will
match both "nano" and "t1.nano" (and similar prefixed variants) and also
tolerate whitespace between list, parentheses and the quoted values.
packages/system/foundationdb-rd/cozyrds/foundationdb.yaml (1)

28-30: 💤 Low value

Remove the stale # keysOrder: [] comment.

Line 28 keeps the old placeholder while Line 30 defines the real keysOrder. Leaving the commented form is confusing and likely to mislead future edits.

🧹 Proposed cleanup
-    # keysOrder: []
-
     keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ...]
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/system/foundationdb-rd/cozyrds/foundationdb.yaml` around lines 28 -
30, Remove the stale commented placeholder "# keysOrder: []" so only the real
keysOrder mapping remains; locate the commented line near the existing keysOrder
key in foundationdb.yaml and delete that single commented line to avoid
confusion while keeping the current keysOrder array intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@hack/check-rd-presets.sh`:
- Around line 33-37: The loop that checks EXPECTED entries uses grep -qx "$want"
which treats "$want" as a regex; update the check in the for-loop that iterates
over EXPECTED/want and inspects the enums variable to use fixed-string matching
(add the -F flag, e.g. grep -Fxq) so comparisons are literal and dots or other
regex meta-characters in entries like t1.nano are not treated as regexes; leave
the surrounding logic that appends to missing unchanged.

In `@packages/apps/kubernetes/README.md`:
- Around line 169-195: The README's preset reference is out of date: update the
human-readable preset section to document the new control-plane defaults (e.g.,
controlPlane.apiServer.resourcesPreset -> c1.medium and
controlPlane.controllerManager.resourcesPreset /
controlPlane.scheduler.resourcesPreset /
controlPlane.konnectivity.server.resourcesPreset -> t1.micro) or replace that
entire preset paragraph with a canonical pointer to the resource-preset doc,
then run the docs generator (make generate / cozyvalues-gen) so the ##
Parameters block (which includes controlPlane and images keys) is regenerated
consistently.

In `@packages/apps/mariadb/README.md`:
- Around line 78-79: Update the MariaDB preset reference to include the new
instance-type families and the new default `t1.nano` for `resourcesPreset`, and
mark legacy aliases (e.g., `nano`…`2xlarge`) as deprecated; instead of editing
only README.md, update the cozyvalues generator/upstream source that generates
the preset table so `resourcesPreset` and the generated preset list reflect the
new families and defaults and include a deprecation note for legacy names.

In `@packages/apps/nats/README.md`:
- Around line 10-17: The README's parameters table now defaults resourcesPreset
to "t1.nano" but the later reference still only lists presets `nano`…`2xlarge`,
so update the package README.md to document the new t1.* preset family: expand
the table row for `resourcesPreset` (or add a small subsection) to list t1.nano,
t1.small, t1.medium, etc., or add an explicit link to the shared resource-preset
doc; ensure the `## Parameters` block in this README.md is updated (since
cozyvalues-gen rewrites that block on make generate) and mention
`resourcesPreset`/`t1.nano` consistently so the default is explained.

In `@packages/apps/qdrant/README.md`:
- Around line 22-23: The docs are inconsistent: the parameter resourcesPreset
now defaults to "t1.small" but the presets table only lists legacy names (e.g.,
nano…2xlarge); update the presets reference so it includes the new instance-type
names (e.g., t1.small, t1.medium, etc.) and map legacy aliases to the new names,
or add a clear deprecation note indicating legacy aliases (nano…2xlarge) are
deprecated in favor of the t1.* presets; ensure references to resourcesPreset
and size remain accurate and that the table rows explicitly show both the
current preset values and any legacy aliases.

In `@packages/apps/redis/README.md`:
- Around line 22-23: Update the Parameters/reference documentation so
`resourcesPreset` lists the new preset series (`t1`, `c1`, `s1`, `u1`, `m1` with
their size variants) and show `t1.nano` as the current default while marking
legacy names as deprecated aliases; do this by updating the generator source
used to produce package READMEs (cozyvalues-gen) to include the new preset
mapping and alias/deprecation metadata, then regenerate the README for the Redis
package so the `resourcesPreset` table (and the `size` description if needed)
reflects the new names and deprecation notes.

In `@packages/apps/tcp-balancer/README.md`:
- Around line 15-22: The README shows a default resourcesPreset of `t1.nano` but
the presets table still lists legacy names; update the generator/template that
produces this README so the `resourcesPreset` examples and the preset table use
the new "<series>.<size>" naming (e.g., `t1.nano`) or add a canonical-presets
reference link, and ensure the generated field descriptions for
`resourcesPreset` and the presets table (the template that emits the presets
list) are aligned to the new naming convention rather than patching the README
manually.

In `@packages/apps/vpn/README.md`:
- Around line 28-29: Update the README preset reference table to reflect the new
default family by changing the documented default for resourcesPreset from
legacy names to the new instance-type presets (e.g., include t1.nano as the
default family), add entries mapping legacy aliases to their new instance-type
equivalents and mark those legacy aliases as deprecated, and ensure the table
rows referencing `resourcesPreset` (and any related examples) show the new
default while noting deprecation; keep the `external` description unchanged.

In `@pkg/apis/apps/presets/legacy_test.go`:
- Around line 145-151: The test compares slices `got` and `want` but the inner
loop only iterates over `got`, so if `got` is shorter than `want` missing
expected entries are not reported; change the comparison to iterate up to the
larger length (or explicitly check lengths first) and for each index i compare
presence and value, reporting when i >= len(got) (missing actual) or i >=
len(want) (unexpected extra) or got[i] != want[i]; update the loop around the
existing reflect.DeepEqual check (references: variables `got`, `want` and the
t.Errorf call) to ensure missing/extra elements are surfaced in test output.

---

Nitpick comments:
In `@hack/check-rd-presets.sh`:
- Around line 19-23: The for-loop over the glob pattern
packages/system/*-rd/cozyrds/*.yaml can iterate once with the literal pattern
when no files match under set -euo pipefail; enable bash nullglob before the
loop (e.g., call shopt -s nullglob) so unmatched globs expand to nothing and the
loop is skipped, then restore previous nullglob state if needed; target the loop
that defines variable f and the glob expression to apply this change.
- Around line 25-28: The current jq expression that builds the enums variable
matches objects by description text which is brittle; update the jq filter used
to set enums so it walks the schema tree and selects any property literally
named "resourcesPreset" (e.g., look for objects under "properties" whose key ==
"resourcesPreset") and then extracts their enum arrays instead of matching on
.description; modify the command that assigns enums (the jq invocation that
feeds printf '%s' "$schema") to implement this property-name-based traversal and
collection so enums contains the canonical preset values even if descriptions
change.
- Around line 55-56: The grep command that populates legacy_hits uses a narrow
regex matching unprefixed names; update that regex to allow optional vendor
prefixes and flexible whitespace by matching an optional namespace/prefix before
the preset names (e.g., allow something like "[a-z0-9]+." before nano|micro|...)
and permit spaces around the list delimiter and quotes; modify the pattern used
in the legacy_hits assignment so it will match both "nano" and "t1.nano" (and
similar prefixed variants) and also tolerate whitespace between list,
parentheses and the quoted values.

In `@packages/system/foundationdb-rd/cozyrds/foundationdb.yaml`:
- Around line 28-30: Remove the stale commented placeholder "# keysOrder: []" so
only the real keysOrder mapping remains; locate the commented line near the
existing keysOrder key in foundationdb.yaml and delete that single commented
line to avoid confusion while keeping the current keysOrder array intact.
🪄 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: 976dbb6a-3c17-411d-a7fa-93ae840996cf

📥 Commits

Reviewing files that changed from the base of the PR and between 86f5267 and cca54d8.

📒 Files selected for processing (117)
  • Makefile
  • api/apps/v1alpha1/clickhouse/types.go
  • api/apps/v1alpha1/foundationdb/types.go
  • api/apps/v1alpha1/harbor/types.go
  • api/apps/v1alpha1/httpcache/types.go
  • api/apps/v1alpha1/kafka/types.go
  • api/apps/v1alpha1/kubernetes/types.go
  • api/apps/v1alpha1/mariadb/types.go
  • api/apps/v1alpha1/mongodb/types.go
  • api/apps/v1alpha1/nats/types.go
  • api/apps/v1alpha1/openbao/types.go
  • api/apps/v1alpha1/opensearch/types.go
  • api/apps/v1alpha1/postgresql/types.go
  • api/apps/v1alpha1/qdrant/types.go
  • api/apps/v1alpha1/rabbitmq/types.go
  • api/apps/v1alpha1/redis/types.go
  • api/apps/v1alpha1/tcpbalancer/types.go
  • api/apps/v1alpha1/vpn/types.go
  • docs/operations/resource-presets.md
  • hack/check-rd-presets.sh
  • packages/apps/clickhouse/Makefile
  • packages/apps/clickhouse/README.md
  • packages/apps/clickhouse/tests/resourcepreset_test.yaml
  • packages/apps/clickhouse/values.schema.json
  • packages/apps/clickhouse/values.yaml
  • packages/apps/foundationdb/Makefile
  • packages/apps/foundationdb/README.md
  • packages/apps/foundationdb/values.schema.json
  • packages/apps/foundationdb/values.yaml
  • packages/apps/harbor/README.md
  • packages/apps/harbor/templates/harbor.yaml
  • packages/apps/harbor/values.schema.json
  • packages/apps/harbor/values.yaml
  • packages/apps/http-cache/README.md
  • packages/apps/http-cache/values.schema.json
  • packages/apps/http-cache/values.yaml
  • packages/apps/kafka/README.md
  • packages/apps/kafka/values.schema.json
  • packages/apps/kafka/values.yaml
  • packages/apps/kubernetes/README.md
  • packages/apps/kubernetes/values.schema.json
  • packages/apps/kubernetes/values.yaml
  • packages/apps/mariadb/README.md
  • packages/apps/mariadb/values.schema.json
  • packages/apps/mariadb/values.yaml
  • packages/apps/mongodb/README.md
  • packages/apps/mongodb/values.schema.json
  • packages/apps/mongodb/values.yaml
  • packages/apps/nats/README.md
  • packages/apps/nats/values.schema.json
  • packages/apps/nats/values.yaml
  • packages/apps/openbao/README.md
  • packages/apps/openbao/values.schema.json
  • packages/apps/openbao/values.yaml
  • packages/apps/opensearch/Makefile
  • packages/apps/opensearch/README.md
  • packages/apps/opensearch/templates/opensearch.yaml
  • packages/apps/opensearch/tests/resourcepreset_test.yaml
  • packages/apps/opensearch/values.schema.json
  • packages/apps/opensearch/values.yaml
  • packages/apps/postgres/README.md
  • packages/apps/postgres/tests/resourcepreset_test.yaml
  • packages/apps/postgres/values.schema.json
  • packages/apps/postgres/values.yaml
  • packages/apps/qdrant/README.md
  • packages/apps/qdrant/values.schema.json
  • packages/apps/qdrant/values.yaml
  • packages/apps/rabbitmq/README.md
  • packages/apps/rabbitmq/values.schema.json
  • packages/apps/rabbitmq/values.yaml
  • packages/apps/redis/README.md
  • packages/apps/redis/values.schema.json
  • packages/apps/redis/values.yaml
  • packages/apps/tcp-balancer/README.md
  • packages/apps/tcp-balancer/values.schema.json
  • packages/apps/tcp-balancer/values.yaml
  • packages/apps/vpn/README.md
  • packages/apps/vpn/values.schema.json
  • packages/apps/vpn/values.yaml
  • packages/core/platform/images/migrations/migrations/39
  • packages/core/platform/values.yaml
  • packages/extra/external-dns/README.md
  • packages/extra/external-dns/values.schema.json
  • packages/extra/external-dns/values.yaml
  • packages/extra/ingress/README.md
  • packages/extra/ingress/values.schema.json
  • packages/extra/ingress/values.yaml
  • packages/extra/seaweedfs/README.md
  • packages/extra/seaweedfs/values.schema.json
  • packages/extra/seaweedfs/values.yaml
  • packages/library/cozy-lib/templates/_resourcepresets.tpl
  • packages/library/cozy-lib/templates/_resources.tpl
  • packages/system/clickhouse-rd/cozyrds/clickhouse.yaml
  • packages/system/external-dns-rd/cozyrds/external-dns.yaml
  • packages/system/foundationdb-rd/cozyrds/foundationdb.yaml
  • packages/system/harbor-rd/cozyrds/harbor.yaml
  • packages/system/http-cache-rd/cozyrds/http-cache.yaml
  • packages/system/ingress-rd/cozyrds/ingress.yaml
  • packages/system/kafka-rd/cozyrds/kafka.yaml
  • packages/system/keycloak/templates/sts.yaml
  • packages/system/kubernetes-rd/cozyrds/kubernetes.yaml
  • packages/system/mariadb-rd/cozyrds/mariadb.yaml
  • packages/system/mongodb-rd/cozyrds/mongodb.yaml
  • packages/system/nats-rd/cozyrds/nats.yaml
  • packages/system/openbao-rd/cozyrds/openbao.yaml
  • packages/system/opensearch-rd/cozyrds/opensearch.yaml
  • packages/system/postgres-rd/cozyrds/postgres.yaml
  • packages/system/qdrant-rd/cozyrds/qdrant.yaml
  • packages/system/rabbitmq-rd/cozyrds/rabbitmq.yaml
  • packages/system/redis-rd/cozyrds/redis.yaml
  • packages/system/seaweedfs-rd/cozyrds/seaweedfs.yaml
  • packages/system/tcp-balancer-rd/cozyrds/tcp-balancer.yaml
  • packages/system/vpn-rd/cozyrds/vpn.yaml
  • pkg/apis/apps/presets/legacy.go
  • pkg/apis/apps/presets/legacy_test.go
  • pkg/registry/apps/application/rest.go
  • pkg/registry/apps/application/rest_legacy_presets_test.go

Comment thread hack/check-rd-presets.sh
Comment thread packages/apps/kubernetes/README.md
Comment thread packages/apps/mariadb/README.md
Comment thread packages/apps/nats/README.md
Comment thread packages/apps/qdrant/README.md
Comment thread packages/apps/redis/README.md
Comment thread packages/apps/tcp-balancer/README.md
Comment thread packages/apps/vpn/README.md
Comment thread pkg/apis/apps/presets/legacy_test.go
Aleksei Sviridkin (lexfrei) added a commit to lexfrei/cozystack-website that referenced this pull request May 11, 2026
Update the resource-management guide to describe the new
`<series>.<size>` instance-type preset scheme:

  - five series (t1, c1, s1, u1, m1) covering CPU:memory ratios from
    1:0.5 to 1:8
  - eight sizes (nano through 4xlarge) per series
  - explicit callout that legacy `medium` (1 CPU / 1Gi) and new
    `*.medium` (2 CPU) names overlap but resources do not
  - 1:1 legacy-to-instance-type mapping table for the seven deprecated
    flat names that remain accepted as aliases
  - mention of the API-server deprecation warning and the platform
    upgrade migration that rewrites stored values

Also correct CPU values in the prior table that disagreed with the
actual cozy-lib library (nano was listed as 100m / 128Mi but
cozy-lib has always rendered 250m / 128Mi for nano, and so on for
every row); pin the table on the values cozy-lib actually returns.

Track corresponding code change at cozystack/cozystack#2607.

Assisted-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
Aleksei Sviridkin (lexfrei) added a commit to lexfrei/cozystack-website that referenced this pull request May 12, 2026
Update the resource-management guide to describe the new
`<series>.<size>` instance-type preset scheme:

  - five series (t1, c1, s1, u1, m1) covering CPU:memory ratios from
    1:0.5 to 1:8
  - eight sizes (nano through 4xlarge) per series
  - explicit callout that legacy `medium` (1 CPU / 1Gi) and new
    `*.medium` (2 CPU) names overlap but resources do not
  - 1:1 legacy-to-instance-type mapping table for the seven deprecated
    flat names that remain accepted as aliases
  - mention of the API-server deprecation warning and the platform
    upgrade migration that rewrites stored values

Also correct CPU values in the prior table that disagreed with the
actual cozy-lib library (nano was listed as 100m / 128Mi but
cozy-lib has always rendered 250m / 128Mi for nano, and so on for
every row); pin the table on the values cozy-lib actually returns.

Track corresponding code change at cozystack/cozystack#2607.

Assisted-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
Address review feedback from gemini-code-assist on hack/check-rd-presets.sh:26
and coderabbitai on hack/check-rd-presets.sh:37.

- Switch the jq enum extractor from a description-substring heuristic
  (test("preset"; "i")) to a JSON path-suffix selector that matches
  fields literally named resourcesPreset. Eliminates false positives
  from unrelated fields whose descriptions happen to mention "preset".
- Use grep -F for literal enum membership so the "." in entries like
  t1.nano cannot accidentally match arbitrary characters (e.g. a typo
  t1xnano would have satisfied t1.nano under basic regex).

Signed-off-by: Aleksei Sviridkin <[email protected]>
Address review feedback from gemini-code-assist on
pkg/registry/apps/application/rest.go:1777.

When app.Spec.Raw cannot be unmarshalled to map[string]any the
deprecation walker now logs a klog.V(2) line naming the kind, name,
namespace and the underlying error before returning. Upstream
validation still owns rejecting invalid specs (this hook is purely
informational), so the log stays at debug verbosity rather than
surfacing as a warning that would fire on transient inputs the
caller is about to reject anyway.

Helper signature changed to (kind, namespace, name string, raw []byte)
so the malformed-input path is reachable from existing unit tests
without forcing a fake Application wrapper.

Signed-off-by: Aleksei Sviridkin <[email protected]>
Address review feedback from coderabbitai on
pkg/apis/apps/presets/legacy_test.go:151.

Replace the index-by-index loop over `got` with a single t.Fatalf
that prints both slices via %#v. The previous loop iterated only
across `got`, so extra entries in `want` would slip past unreported
when `got` was shorter than `want`; t.Fatalf with full slice
representations names both sides regardless of length.

Signed-off-by: Aleksei Sviridkin <[email protected]>
Address review feedback from coderabbitai across:
  - packages/apps/kubernetes/README.md
  - packages/apps/mariadb/README.md
  - packages/apps/nats/README.md
  - packages/apps/qdrant/README.md
  - packages/apps/redis/README.md
  - packages/apps/tcp-balancer/README.md
  - packages/apps/vpn/README.md

Each of these READMEs left an inline 7-row preset table listing only
the legacy flat names after the parameters block above already
defaulted to an instance-type value (e.g. `t1.nano`). cozyvalues-gen
only regenerates the `## Parameters` block, so the hand-written
section drifted.

Replace the inline tables with the same short paragraph already used
by postgres and kafka READMEs: name the five series, note that the
seven legacy names remain accepted as deprecated aliases, and link to
the canonical reference at docs/operations/resource-presets.md so the
full size matrix and legacy mapping live in exactly one place.

Signed-off-by: Aleksei Sviridkin <[email protected]>

@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.

♻️ Duplicate comments (1)
packages/apps/kubernetes/README.md (1)

214-217: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Canonical link was added, but stale preset catalog below still contradicts it.

Good change here, but the following ### instanceType Resources/series sections still document retired families and old sizes, which conflicts with this new canonical guidance. Please remove or update that stale catalog to avoid mixed instructions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/apps/kubernetes/README.md` around lines 214 - 217, The README
currently contains a stale catalog under the "### instanceType Resources"
heading that contradicts the new canonical naming guidance (series.<size> and
the five series t1/c1/s1/u1/m1 plus nano→4xlarge sizes and deprecated legacy
aliases); remove or update the entire legacy catalog sections (the "###
instanceType Resources" heading and each series subsection) so they reflect the
canonical series.<size matrix and the legacy-to-instance-type mapping linked in
docs/operations/resource-presets.md, ensuring the documented series names (t1,
c1, s1, u1, m1), sizes (nano..4xlarge) and deprecated aliases are accurate and
not duplicated elsewhere in the file.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@packages/apps/kubernetes/README.md`:
- Around line 214-217: The README currently contains a stale catalog under the
"### instanceType Resources" heading that contradicts the new canonical naming
guidance (series.<size> and the five series t1/c1/s1/u1/m1 plus nano→4xlarge
sizes and deprecated legacy aliases); remove or update the entire legacy catalog
sections (the "### instanceType Resources" heading and each series subsection)
so they reflect the canonical series.<size matrix and the
legacy-to-instance-type mapping linked in docs/operations/resource-presets.md,
ensuring the documented series names (t1, c1, s1, u1, m1), sizes (nano..4xlarge)
and deprecated aliases are accurate and not duplicated elsewhere in the file.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: dd1c0f99-92ab-4ce7-897e-8bda851194ff

📥 Commits

Reviewing files that changed from the base of the PR and between cca54d8 and 55a98b8.

📒 Files selected for processing (11)
  • hack/check-rd-presets.sh
  • packages/apps/kubernetes/README.md
  • packages/apps/mariadb/README.md
  • packages/apps/nats/README.md
  • packages/apps/qdrant/README.md
  • packages/apps/redis/README.md
  • packages/apps/tcp-balancer/README.md
  • packages/apps/vpn/README.md
  • pkg/apis/apps/presets/legacy_test.go
  • pkg/registry/apps/application/rest.go
  • pkg/registry/apps/application/rest_legacy_presets_test.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/apis/apps/presets/legacy_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/registry/apps/application/rest.go
  • pkg/registry/apps/application/rest_legacy_presets_test.go

@YohanSciubukgian

Copy link
Copy Markdown

Is it only about CPU & Memory presets ?
Do you plan for Storage Optimized, GPU oriented or Confidential presets as well ?

Cloud Family could be quite complex in naming convention with all alternatives and combinations :
https://learn.microsoft.com/en-us/azure/virtual-machines/sizes/overview

@lexfrei

Copy link
Copy Markdown
Contributor Author

YohanS (@YohanSciubukgian) not in this PR. Feel free to contribute!

@kvaps Andrei Kvapil (kvaps) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM (also covers companion docs PR website#535).

Verified the rename's upgrade path is safe in three layers:

  • cozy-lib retains legacy aliases with original CPU/memory, so existing HelmReleases keep rendering identical resources without any migration.
  • Migration 39 walks both HelmReleases (.spec.values) and every app CR under apps.cozystack.io; the jq walk catches nested presets (clickhouseKeeper, dashboards), it is idempotent, dry-run via MIGRATION_DRY_RUN=1, and only advances the version stamp on a failure-free run.
  • The cozystack-api Create/Update hook emits klog warnings naming the JSON path and the 1:1 instance-type replacement.

Spot-checked: all 20 schema defaults migrate 1:1 (micro→t1.micro, medium→c1.small, …), hardcoded chart literals (harbor, opensearch, keycloak) preserve resources, CRD + JSON-schema enums are supersets so existing CRs keep validating, the 1:1 table is mirrored consistently across cozy-lib, the migration jq, pkg/apis/apps/presets/legacy.go, and the docs, and hack/check-rd-presets.sh enforces RD invariance plus a chart-template lint against new legacy literals.

@kvaps
Andrei Kvapil (kvaps) merged commit c247bf4 into cozystack:main May 12, 2026
11 checks passed
Aleksei Sviridkin (lexfrei) added a commit to cozystack/website that referenced this pull request May 12, 2026
## What this PR does

Companion to
[cozystack/cozystack#2607](cozystack/cozystack#2607).

> **Merge order:** must land after cozystack/cozystack#2607. The new
closing paragraph links to `docs/operations/resource-presets.md` in the
cozystack repo, which is created by #2607 — the link 404s until #2607 is
merged.

Updates the resource-management guide to describe the new
`<series>.<size>` instance-type preset scheme rolled out across all
Cozystack apps:

- Five series covering the full CPU-to-memory ratio range (`t1` 1:0.5,
`c1` 1:1, `s1` 1:2, `u1` 1:4, `m1` 1:8) with eight sizes each.
- Explicit callout that legacy `medium` (1 CPU / 1Gi) and instance-type
`*.medium` (2 CPU) names overlap but resources do not.
- 1:1 legacy-to-instance-type mapping table for the seven deprecated
flat names that remain accepted as aliases.
- Mention of the API-server deprecation warning and the platform upgrade
migration (Migration 39) that rewrites stored values.

### Fixes pre-existing CPU drift in three tables on the same page

The previous tables listed `nano = 100m`, `micro = 250m`, `small =
500m`, etc. — values that never matched what `cozy-lib` actually
rendered. The library returns `nano = 250m / 128Mi`, `micro = 500m /
256Mi`, `small = 1 / 512Mi`, and so on. Pin all three preset tables (the
main one and both `cpu-allocation-ratio` example tables) on the values
the library actually returns, and switch the example tables to
instance-type names while we're there.

### Other cleanups

- Fix typos in the line: `If both resources and resourcesPreset are
defined, resource is used and resourcsePreset is ignored.` (was missing
the trailing `s` on `resource` and had `resourcsePreset` instead of
`resourcesPreset`).

### Release note

```release-note
docs(resource-management): describe instance-type preset scheme (t1/c1/s1/u1/m1 × 8 sizes), add legacy-to-instance-type mapping table, correct CPU values across all three preset tables to match the cozy-lib library.
```
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

area/uncategorized PR auto-labeler could not map title scope to a known area/*; please review kind/feature Categorizes issue or PR as related to a new feature size/XXL This PR changes 1000+ lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants