Skip to content

Conversation

@kvaps
Copy link
Member

@kvaps kvaps commented Jan 15, 2026

What this PR does

Renames CozystackResourceDefinition CRD to ApplicationDefinition for better clarity and consistency.

Changes include:

  • Renamed all Go types (ApplicationDefinition, ApplicationDefinitionList, ApplicationDefinitionSpec, etc.)
  • Renamed controller files and reconciler structs
  • Updated all packages that use these types (dashboard, lineagecontrollerwebhook, crdmem, etc.)
  • Renamed CRD Helm chart from cozystack-resource-definition-crd to application-definition-crd
  • Updated all 25 cozyrds YAML manifests to use kind: ApplicationDefinition
  • Added migration 23 to remove old cozystack-resource-definition-crd HelmRelease

Release note

[api] Rename CozystackResourceDefinition CRD to ApplicationDefinition

Summary by CodeRabbit

  • Refactor
    • Renamed the primary custom resource from CozystackResourceDefinition to ApplicationDefinition across the platform, dashboards, controllers, and manifests.
    • Updated packaging and Helm charts to use ApplicationDefinition consistently.
  • Chores
    • Bumped platform migration target to v24 and added a migration to apply the new resource CRD.
  • Bug Fix
    • Restored deep-copy support for Component-related types.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 15, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Renames the custom resource and all related public types from CozystackResourceDefinition to ApplicationDefinition across APIs, controllers, webhooks, dashboard code, CRD manifests, packaging, and tooling.

Changes

Cohort / File(s) Summary
API Type Definitions
api/v1alpha1/applicationdefinitions_types.go, api/v1alpha1/zz_generated.deepcopy.go
Rename CRD types and nested types (CozystackResourceDefinition* → ApplicationDefinition*). Update SchemeBuilder registration and DeepCopy signatures; reintroduce deepcopy for Component and ComponentInstall.
Controller Reconcilers & Main
internal/controller/applicationdefinition_controller.go, internal/controller/applicationdefinition_helmreconciler.go, cmd/cozystack-controller/main.go
Rename reconcilers and receivers, update Reconcile/SetupWithManager targets and log strings to ApplicationDefinition; adapt helper function signatures and internal references.
Dashboard Controller & Helpers
internal/controller/dashboard/...
(breadcrumb.go, customcolumns.go, customformsoverride.go, customformsprefill.go, factory.go, helpers.go, manager.go, marketplacepanel.go, sidebar.go, tableurimapping.go)
Update function signatures and internals to accept/operate on cozyv1alpha1.ApplicationDefinition instead of CozystackResourceDefinition; rename EnsureForCRD → EnsureForAppDef and related helpers.
Lineage Controller Webhook
internal/lineagecontrollerwebhook/{config.go,controller.go,matcher.go,webhook.go}
Switch in-memory maps, RBAC annotation, list types, function params, and matching helpers to ApplicationDefinition and ApplicationDefinitionResources/selectors.
Shared In-Memory CRD Cache
internal/shared/crdmem/memory.go
Change Memory storage and public APIs to store/return ApplicationDefinition and use ApplicationDefinitionList for priming/listing.
Codegen & CRD Generation Scripts
hack/update-codegen.sh, hack/update-crd.sh
Update CRD directory and generated filenames/kind used in skeleton/yq steps from resource-definition → application-definition.
CRD Package & Helm Chart
packages/system/application-definition-crd/{Chart.yaml,Makefile,definition/cozystack.io_applicationdefinitions.yaml,templates/crd.yaml}, removed template change in packages/system/cozystack-resource-definition-crd/templates/crd.yaml
Rename chart and packaging identifiers; update CRD metadata, kind, listKind, plural/singular, and schema descriptions to ApplicationDefinition; adjust template inclusions.
Resource Definition Manifests
packages/system/*-rd/cozyrds/*.yaml (multiple: bootbox, bucket, clickhouse, etc.)
Change top-level kind in ~28 CozyRDS manifests from CozystackResourceDefinition → ApplicationDefinition.
Platform & Migrations
packages/core/platform/images/migrations/migrations/23, packages/core/platform/sources/cozystack-engine.yaml, packages/core/platform/values.yaml
Add migration script to remove old HelmRelease and stamp version=24; update component names and dependsOn references to application-definition-crd; bump migration target version.
Server Startup
pkg/cmd/server/start.go
Use ApplicationDefinitionList when initially listing CRDs; update related error/log messages.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰 A tiny hop, a naming spree,
The fields all shift from old to new —
From CozyRD to AppDef free,
Through charts and code the changes flew.
I twitch my nose and clap my paws, hooray — the repo's fresh and true!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'refactor(api): rename CozystackResourceDefinition to ApplicationDefinition' is clear, specific, and directly describes the primary change across the codebase—a systematic rename of the CRD API type and all dependent code.

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

✨ Finishing touches
  • 📝 Generate docstrings

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
Contributor

Summary of Changes

Hello @kvaps, 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 undertakes a significant refactoring effort to standardize the naming of a critical API resource. By renaming CozystackResourceDefinition to ApplicationDefinition, the change aims to enhance the understandability and maintainability of the system's core components. This involves a comprehensive update across various layers of the application, from Go type definitions and controller logic to Helm chart configurations and existing resource manifests, ensuring a consistent and clear API surface.

Highlights

  • API Renaming: The core Custom Resource Definition (CRD) CozystackResourceDefinition has been renamed to ApplicationDefinition for improved clarity and consistency across the API.
  • Codebase Refactoring: All Go types, controller files, and reconciler structs associated with the old CRD name have been updated to reflect ApplicationDefinition. This includes changes in the dashboard, lineage controller webhook, and CRD memory management packages.
  • Helm Chart and Manifest Updates: The CRD Helm chart has been renamed from cozystack-resource-definition-crd to application-definition-crd. Additionally, 25 existing YAML manifests have been updated to use kind: ApplicationDefinition.
  • Migration Strategy: A new migration script (migration 23) has been added to ensure the removal of the old cozystack-resource-definition-crd HelmRelease during the upgrade process, facilitating a clean transition to the new naming.

🧠 New Feature in Public Preview: You can now enable Memory 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-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 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 counter productive. You can react with 👍 and 👎 on @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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 is a large-scale refactoring that renames CozystackResourceDefinition to ApplicationDefinition. The changes are extensive and appear to be correctly applied across the codebase, including Go types, controllers, YAML manifests, and scripts. A new migration script is also included to handle the change. My review focuses on ensuring the renaming is complete and consistent. I've pointed out a few minor areas where old naming conventions (CRD, crd) still exist in function and variable names, which could be updated for better clarity and maintainability. Overall, this is a solid refactoring.

Comment on lines 69 to 72
type crdHashView struct {
Name string `json:"name"`
Spec cozyv1alpha1.CozystackResourceDefinitionSpec `json:"spec"`
Name string `json:"name"`
Spec cozyv1alpha1.ApplicationDefinitionSpec `json:"spec"`
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For consistency with the refactoring, consider renaming crdHashView to appDefHashView. This would make it clearer that this struct is specific to ApplicationDefinition.

Suggested change
type crdHashView struct {
Name string `json:"name"`
Spec cozyv1alpha1.CozystackResourceDefinitionSpec `json:"spec"`
Name string `json:"name"`
Spec cozyv1alpha1.ApplicationDefinitionSpec `json:"spec"`
}
type appDefHashView struct {
Name string `json:"name"`
Spec cozyv1alpha1.ApplicationDefinitionSpec `json:"spec"`
}

// updateHelmReleasesForCRD updates all HelmReleases that match the application labels from CozystackResourceDefinition
func (r *CozystackResourceDefinitionHelmReconciler) updateHelmReleasesForCRD(ctx context.Context, crd *cozyv1alpha1.CozystackResourceDefinition) error {
// updateHelmReleasesForCRD updates all HelmReleases that match the application labels from ApplicationDefinition
func (r *ApplicationDefinitionHelmReconciler) updateHelmReleasesForCRD(ctx context.Context, crd *cozyv1alpha1.ApplicationDefinition) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While technically correct since ApplicationDefinition is a CRD, the function name updateHelmReleasesForCRD and the parameter crd are remnants of the previous naming. To improve clarity and consistency with the refactoring, consider renaming the function to updateHelmReleasesForApplicationDefinition and the parameter crd to appDef.

Suggested change
func (r *ApplicationDefinitionHelmReconciler) updateHelmReleasesForCRD(ctx context.Context, crd *cozyv1alpha1.ApplicationDefinition) error {
func (r *ApplicationDefinitionHelmReconciler) updateHelmReleasesForApplicationDefinition(ctx context.Context, appDef *cozyv1alpha1.ApplicationDefinition) error {

// - ensureSidebar (implemented)
// - ensureTableUriMapping (implemented)
func (m *Manager) EnsureForCRD(ctx context.Context, crd *cozyv1alpha1.CozystackResourceDefinition) (reconcile.Result, error) {
func (m *Manager) EnsureForCRD(ctx context.Context, crd *cozyv1alpha1.ApplicationDefinition) (reconcile.Result, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For consistency with the refactoring, consider renaming EnsureForCRD to EnsureForApplicationDefinition. The crd parameter could also be renamed to appDef to be more specific.

Suggested change
func (m *Manager) EnsureForCRD(ctx context.Context, crd *cozyv1alpha1.ApplicationDefinition) (reconcile.Result, error) {
func (m *Manager) EnsureForApplicationDefinition(ctx context.Context, appDef *cozyv1alpha1.ApplicationDefinition) (reconcile.Result, error) {

@kvaps kvaps marked this pull request as ready for review January 15, 2026 19:32
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Jan 15, 2026
Copy link
Contributor

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

🤖 Fix all issues with AI agents
In `@packages/core/platform/images/migrations/migrations/23`:
- Around line 1-4: The script uses a non-POSIX option: replace the incompatible
combination by either changing the shebang to a Bash interpreter or removing the
Bash-only option; specifically, update the top of the migration script so that
the shebang "#!/bin/sh" is changed to "#!/bin/bash" (or "#!/usr/bin/env bash")
if you want to keep "set -euo pipefail", or alternatively keep "#!/bin/sh" and
remove "pipefail" from the "set -euo pipefail" line (e.g., use "set -eu" or add
a portable pipe failure handling), ensuring the line containing "set -euo
pipefail" is adjusted accordingly.
♻️ Duplicate comments (1)
internal/controller/dashboard/manager.go (1)

102-106: Consider renaming crd parameter to appDef for consistency.

The method was renamed from EnsureForCRD to EnsureForAppDef, but the parameter is still named crd. For consistency with the broader rename, consider updating the parameter name to appDef throughout this file (also in addDashboardLabels, pickGVK, pickPlural, etc.).

🧹 Nitpick comments (4)
internal/controller/dashboard/customformsoverride.go (1)

17-18: Type update is correct; consider renaming the parameter for clarity.

The parameter type has been correctly updated to ApplicationDefinition. However, the parameter name crd and the comment "for the given CRD" are now slightly misleading since this is an ApplicationDefinition, not a CustomResourceDefinition. Consider renaming to appDef for consistency with the broader refactor (as noted in the commit messages).

Optional: Rename for consistency
-// ensureCustomFormsOverride creates or updates a CustomFormsOverride resource for the given CRD
-func (m *Manager) ensureCustomFormsOverride(ctx context.Context, crd *cozyv1alpha1.ApplicationDefinition) error {
-	g, v, kind := pickGVK(crd)
-	plural := pickPlural(kind, crd)
+// ensureCustomFormsOverride creates or updates a CustomFormsOverride resource for the given ApplicationDefinition
+func (m *Manager) ensureCustomFormsOverride(ctx context.Context, appDef *cozyv1alpha1.ApplicationDefinition) error {
+	g, v, kind := pickGVK(appDef)
+	plural := pickPlural(kind, appDef)

This would require updating all crd references in the function body to appDef.

pkg/cmd/server/start.go (1)

158-180: Consider renaming crdList variable for consistency.

The resource conversion logic is correct. For consistency with the rename (as mentioned in the commit messages about renaming internal variables), consider renaming crdList to appDefList or similar.

Optional: Variable rename for consistency
-	crdList := &v1alpha1.ApplicationDefinitionList{}
+	appDefList := &v1alpha1.ApplicationDefinitionList{}
 
 	// ... retry loop using appDefList ...
 
-	for _, crd := range crdList.Items {
+	for _, appDef := range appDefList.Items {
 		resource := config.Resource{
 			Application: config.ApplicationConfig{
-				Kind:          crd.Spec.Application.Kind,
+				Kind:          appDef.Spec.Application.Kind,
 				// ... etc
internal/controller/dashboard/tableurimapping.go (1)

9-12: Consider renaming the crd parameter to appDef for consistency.

The type has been correctly updated to ApplicationDefinition, but the parameter is still named crd. Per the PR objectives, the follow-up commit was intended to rename crd parameters to appDef for naming consistency across the codebase. This is a minor nit since the current naming still conveys meaning.

♻️ Suggested rename for consistency
-// ensureTableUriMapping creates or updates a TableUriMapping resource for the given CRD
-func (m *Manager) ensureTableUriMapping(ctx context.Context, crd *cozyv1alpha1.ApplicationDefinition) error {
+// ensureTableUriMapping creates or updates a TableUriMapping resource for the given ApplicationDefinition
+func (m *Manager) ensureTableUriMapping(ctx context.Context, appDef *cozyv1alpha1.ApplicationDefinition) error {
 	// Links are fully managed by the CustomColumnsOverride.
 	return nil
 }
internal/controller/dashboard/factory.go (1)

558-568: Unused crd parameter in factoryFeatureFlags.

The type change is correct, but the crd parameter is not used in the function body—it just returns hardcoded true values for all flags. The comment suggests it should "try several conventional locations" but the implementation doesn't access the CRD at all.

This appears intentional (perhaps for future expansion), but consider either:

  1. Removing the parameter if feature flags are always enabled, or
  2. Adding a _ = crd or //nolint:unused to signal intentional non-use
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd54647 and 3a0cd67.

📒 Files selected for processing (57)
  • api/v1alpha1/applicationdefinitions_types.go
  • api/v1alpha1/zz_generated.deepcopy.go
  • cmd/cozystack-controller/main.go
  • hack/update-codegen.sh
  • hack/update-crd.sh
  • internal/controller/applicationdefinition_controller.go
  • internal/controller/applicationdefinition_helmreconciler.go
  • internal/controller/dashboard/breadcrumb.go
  • internal/controller/dashboard/customcolumns.go
  • internal/controller/dashboard/customformsoverride.go
  • internal/controller/dashboard/customformsprefill.go
  • internal/controller/dashboard/factory.go
  • internal/controller/dashboard/helpers.go
  • internal/controller/dashboard/manager.go
  • internal/controller/dashboard/marketplacepanel.go
  • internal/controller/dashboard/sidebar.go
  • internal/controller/dashboard/tableurimapping.go
  • internal/lineagecontrollerwebhook/config.go
  • internal/lineagecontrollerwebhook/controller.go
  • internal/lineagecontrollerwebhook/matcher.go
  • internal/lineagecontrollerwebhook/webhook.go
  • internal/shared/crdmem/memory.go
  • packages/core/platform/images/migrations/migrations/23
  • packages/core/platform/sources/cozystack-engine.yaml
  • packages/core/platform/values.yaml
  • packages/system/application-definition-crd/Chart.yaml
  • packages/system/application-definition-crd/Makefile
  • packages/system/application-definition-crd/definition/cozystack.io_applicationdefinitions.yaml
  • packages/system/application-definition-crd/templates/crd.yaml
  • packages/system/application-definition-crd/values.yaml
  • packages/system/bootbox-rd/cozyrds/bootbox.yaml
  • packages/system/bucket-rd/cozyrds/bucket.yaml
  • packages/system/clickhouse-rd/cozyrds/clickhouse.yaml
  • packages/system/cozystack-resource-definition-crd/templates/crd.yaml
  • packages/system/etcd-rd/cozyrds/etcd.yaml
  • packages/system/ferretdb-rd/cozyrds/ferretdb.yaml
  • packages/system/foundationdb-rd/cozyrds/foundationdb.yaml
  • packages/system/http-cache-rd/cozyrds/http-cache.yaml
  • packages/system/info-rd/cozyrds/info.yaml
  • packages/system/ingress-rd/cozyrds/ingress.yaml
  • packages/system/kafka-rd/cozyrds/kafka.yaml
  • packages/system/kubernetes-rd/cozyrds/kubernetes.yaml
  • packages/system/monitoring-rd/cozyrds/monitoring.yaml
  • packages/system/mysql-rd/cozyrds/mysql.yaml
  • packages/system/nats-rd/cozyrds/nats.yaml
  • packages/system/postgres-rd/cozyrds/postgres.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/tenant-rd/cozyrds/tenant.yaml
  • packages/system/virtual-machine-rd/cozyrds/virtual-machine.yaml
  • packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml
  • packages/system/vm-disk-rd/cozyrds/vm-disk.yaml
  • packages/system/vm-instance-rd/cozyrds/vm-instance.yaml
  • packages/system/vpn-rd/cozyrds/vpn.yaml
  • pkg/cmd/server/start.go
💤 Files with no reviewable changes (1)
  • packages/system/cozystack-resource-definition-crd/templates/crd.yaml
🧰 Additional context used
📓 Path-based instructions (8)
internal/**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

Follow controller-runtime patterns and kubebuilder style for Go code in internal directory

Files:

  • internal/controller/dashboard/customformsoverride.go
  • internal/controller/dashboard/tableurimapping.go
  • internal/controller/dashboard/marketplacepanel.go
  • internal/controller/dashboard/factory.go
  • internal/controller/dashboard/breadcrumb.go
  • internal/controller/dashboard/customformsprefill.go
  • internal/controller/dashboard/helpers.go
  • internal/lineagecontrollerwebhook/webhook.go
  • internal/lineagecontrollerwebhook/config.go
  • internal/lineagecontrollerwebhook/matcher.go
  • internal/controller/dashboard/customcolumns.go
  • internal/controller/applicationdefinition_helmreconciler.go
  • internal/controller/dashboard/sidebar.go
  • internal/shared/crdmem/memory.go
  • internal/lineagecontrollerwebhook/controller.go
  • internal/controller/applicationdefinition_controller.go
  • internal/controller/dashboard/manager.go
**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

Do NOT manually edit vendor/ directory or auto-generated files (zz_generated.*.go)

Files:

  • internal/controller/dashboard/customformsoverride.go
  • internal/controller/dashboard/tableurimapping.go
  • internal/controller/dashboard/marketplacepanel.go
  • internal/controller/dashboard/factory.go
  • pkg/cmd/server/start.go
  • internal/controller/dashboard/breadcrumb.go
  • internal/controller/dashboard/customformsprefill.go
  • internal/controller/dashboard/helpers.go
  • internal/lineagecontrollerwebhook/webhook.go
  • internal/lineagecontrollerwebhook/config.go
  • cmd/cozystack-controller/main.go
  • internal/lineagecontrollerwebhook/matcher.go
  • internal/controller/dashboard/customcolumns.go
  • api/v1alpha1/applicationdefinitions_types.go
  • internal/controller/applicationdefinition_helmreconciler.go
  • internal/controller/dashboard/sidebar.go
  • internal/shared/crdmem/memory.go
  • internal/lineagecontrollerwebhook/controller.go
  • internal/controller/applicationdefinition_controller.go
  • internal/controller/dashboard/manager.go
  • api/v1alpha1/zz_generated.deepcopy.go
packages/system/**

📄 CodeRabbit inference engine (AGENTS.md)

Use Helm Chart umbrella pattern with vendored upstream charts in charts/ directory

Files:

  • packages/system/seaweedfs-rd/cozyrds/seaweedfs.yaml
  • packages/system/postgres-rd/cozyrds/postgres.yaml
  • packages/system/rabbitmq-rd/cozyrds/rabbitmq.yaml
  • packages/system/application-definition-crd/Makefile
  • packages/system/tcp-balancer-rd/cozyrds/tcp-balancer.yaml
  • packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml
  • packages/system/info-rd/cozyrds/info.yaml
  • packages/system/http-cache-rd/cozyrds/http-cache.yaml
  • packages/system/vm-disk-rd/cozyrds/vm-disk.yaml
  • packages/system/etcd-rd/cozyrds/etcd.yaml
  • packages/system/ingress-rd/cozyrds/ingress.yaml
  • packages/system/kafka-rd/cozyrds/kafka.yaml
  • packages/system/virtual-machine-rd/cozyrds/virtual-machine.yaml
  • packages/system/monitoring-rd/cozyrds/monitoring.yaml
  • packages/system/clickhouse-rd/cozyrds/clickhouse.yaml
  • packages/system/kubernetes-rd/cozyrds/kubernetes.yaml
  • packages/system/foundationdb-rd/cozyrds/foundationdb.yaml
  • packages/system/vpn-rd/cozyrds/vpn.yaml
  • packages/system/nats-rd/cozyrds/nats.yaml
  • packages/system/redis-rd/cozyrds/redis.yaml
  • packages/system/bucket-rd/cozyrds/bucket.yaml
  • packages/system/application-definition-crd/Chart.yaml
  • packages/system/application-definition-crd/templates/crd.yaml
  • packages/system/ferretdb-rd/cozyrds/ferretdb.yaml
  • packages/system/application-definition-crd/definition/cozystack.io_applicationdefinitions.yaml
  • packages/system/mysql-rd/cozyrds/mysql.yaml
  • packages/system/vm-instance-rd/cozyrds/vm-instance.yaml
  • packages/system/bootbox-rd/cozyrds/bootbox.yaml
  • packages/system/tenant-rd/cozyrds/tenant.yaml
**/*.yaml

📄 CodeRabbit inference engine (AGENTS.md)

Do NOT directly edit upstream Helm charts in vendored charts directory; use proper chart vendoring mechanisms

Files:

  • packages/system/seaweedfs-rd/cozyrds/seaweedfs.yaml
  • packages/core/platform/values.yaml
  • packages/system/postgres-rd/cozyrds/postgres.yaml
  • packages/system/rabbitmq-rd/cozyrds/rabbitmq.yaml
  • packages/system/tcp-balancer-rd/cozyrds/tcp-balancer.yaml
  • packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml
  • packages/system/info-rd/cozyrds/info.yaml
  • packages/system/http-cache-rd/cozyrds/http-cache.yaml
  • packages/system/vm-disk-rd/cozyrds/vm-disk.yaml
  • packages/system/etcd-rd/cozyrds/etcd.yaml
  • packages/system/ingress-rd/cozyrds/ingress.yaml
  • packages/system/kafka-rd/cozyrds/kafka.yaml
  • packages/core/platform/sources/cozystack-engine.yaml
  • packages/system/virtual-machine-rd/cozyrds/virtual-machine.yaml
  • packages/system/monitoring-rd/cozyrds/monitoring.yaml
  • packages/system/clickhouse-rd/cozyrds/clickhouse.yaml
  • packages/system/kubernetes-rd/cozyrds/kubernetes.yaml
  • packages/system/foundationdb-rd/cozyrds/foundationdb.yaml
  • packages/system/vpn-rd/cozyrds/vpn.yaml
  • packages/system/nats-rd/cozyrds/nats.yaml
  • packages/system/redis-rd/cozyrds/redis.yaml
  • packages/system/bucket-rd/cozyrds/bucket.yaml
  • packages/system/application-definition-crd/Chart.yaml
  • packages/system/application-definition-crd/templates/crd.yaml
  • packages/system/ferretdb-rd/cozyrds/ferretdb.yaml
  • packages/system/application-definition-crd/definition/cozystack.io_applicationdefinitions.yaml
  • packages/system/mysql-rd/cozyrds/mysql.yaml
  • packages/system/vm-instance-rd/cozyrds/vm-instance.yaml
  • packages/system/bootbox-rd/cozyrds/bootbox.yaml
  • packages/system/tenant-rd/cozyrds/tenant.yaml
packages/core/**

📄 CodeRabbit inference engine (AGENTS.md)

Use Helm Chart umbrella pattern with vendored upstream charts in charts/ directory

Files:

  • packages/core/platform/values.yaml
  • packages/core/platform/sources/cozystack-engine.yaml
  • packages/core/platform/images/migrations/migrations/23
pkg/**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

Follow controller-runtime patterns and kubebuilder style for Go code in pkg directory

Files:

  • pkg/cmd/server/start.go
cmd/**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

Follow controller-runtime patterns and kubebuilder style for Go code in cmd directory

Files:

  • cmd/cozystack-controller/main.go
api/**

📄 CodeRabbit inference engine (AGENTS.md)

Define Kubernetes CRDs in the api directory following kubebuilder conventions

Files:

  • api/v1alpha1/applicationdefinitions_types.go
  • api/v1alpha1/zz_generated.deepcopy.go
🧠 Learnings (9)
📓 Common learnings
Learnt from: lllamnyp
Repo: cozystack/cozystack PR: 1130
File: hack/e2e-apps/kubernetes.bats:101-101
Timestamp: 2025-07-11T06:11:25.438Z
Learning: In cozystack, the plural form for the Kubernetes custom resource is `kuberneteses.apps.cozystack.io`, not `kubernetes.apps.cozystack.io`. This is defined in the API schema even though it's not grammatically perfect.
📚 Learning: 2025-07-11T06:11:25.438Z
Learnt from: lllamnyp
Repo: cozystack/cozystack PR: 1130
File: hack/e2e-apps/kubernetes.bats:101-101
Timestamp: 2025-07-11T06:11:25.438Z
Learning: In cozystack, the plural form for the Kubernetes custom resource is `kuberneteses.apps.cozystack.io`, not `kubernetes.apps.cozystack.io`. This is defined in the API schema even though it's not grammatically perfect.

Applied to files:

  • packages/system/seaweedfs-rd/cozyrds/seaweedfs.yaml
  • packages/system/postgres-rd/cozyrds/postgres.yaml
  • packages/system/rabbitmq-rd/cozyrds/rabbitmq.yaml
  • packages/system/tcp-balancer-rd/cozyrds/tcp-balancer.yaml
  • packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml
  • packages/system/info-rd/cozyrds/info.yaml
  • packages/system/http-cache-rd/cozyrds/http-cache.yaml
  • packages/system/vm-disk-rd/cozyrds/vm-disk.yaml
  • packages/system/etcd-rd/cozyrds/etcd.yaml
  • packages/system/ingress-rd/cozyrds/ingress.yaml
  • packages/system/kafka-rd/cozyrds/kafka.yaml
  • packages/core/platform/sources/cozystack-engine.yaml
  • packages/system/virtual-machine-rd/cozyrds/virtual-machine.yaml
  • internal/controller/dashboard/helpers.go
  • packages/system/monitoring-rd/cozyrds/monitoring.yaml
  • packages/system/clickhouse-rd/cozyrds/clickhouse.yaml
  • packages/system/kubernetes-rd/cozyrds/kubernetes.yaml
  • packages/system/foundationdb-rd/cozyrds/foundationdb.yaml
  • packages/system/vpn-rd/cozyrds/vpn.yaml
  • packages/system/nats-rd/cozyrds/nats.yaml
  • packages/system/redis-rd/cozyrds/redis.yaml
  • packages/system/bucket-rd/cozyrds/bucket.yaml
  • packages/system/application-definition-crd/Chart.yaml
  • api/v1alpha1/applicationdefinitions_types.go
  • packages/system/ferretdb-rd/cozyrds/ferretdb.yaml
  • packages/system/application-definition-crd/definition/cozystack.io_applicationdefinitions.yaml
  • packages/system/mysql-rd/cozyrds/mysql.yaml
  • packages/system/vm-instance-rd/cozyrds/vm-instance.yaml
  • packages/system/bootbox-rd/cozyrds/bootbox.yaml
  • packages/system/tenant-rd/cozyrds/tenant.yaml
📚 Learning: 2025-11-28T21:26:10.771Z
Learnt from: kvaps
Repo: cozystack/cozystack PR: 1671
File: packages/apps/postgres/files/versions.yaml:1-6
Timestamp: 2025-11-28T21:26:10.771Z
Learning: In packages/apps/postgres/files/versions.yaml, the version mappings are sourced from the CloudNativePG container registry (ghcr.io/cloudnative-pg/postgresql), not from PostgreSQL project releases. The versions should reflect what's actually published in the CloudNativePG registry, which is automatically fetched by the hack/update-versions.sh script.

Applied to files:

  • packages/system/postgres-rd/cozyrds/postgres.yaml
📚 Learning: 2025-07-26T18:12:05.641Z
Learnt from: NickVolynkin
Repo: cozystack/cozystack PR: 1216
File: packages/apps/virtual-machine/values.yaml:0-0
Timestamp: 2025-07-26T18:12:05.641Z
Learning: In the cozystack repository, for the virtual-machine app's resources.sockets parameter, the value is intentionally kept as a string in values.yaml despite being documented as {int} type, because the string-to-integer parsing happens elsewhere in the system pipeline rather than at the YAML validation level.

Applied to files:

  • packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml
  • packages/system/vm-disk-rd/cozyrds/vm-disk.yaml
  • packages/system/virtual-machine-rd/cozyrds/virtual-machine.yaml
  • packages/system/vm-instance-rd/cozyrds/vm-instance.yaml
📚 Learning: 2025-07-03T05:54:51.264Z
Learnt from: NickVolynkin
Repo: cozystack/cozystack PR: 1120
File: packages/apps/clickhouse/README.md:60-67
Timestamp: 2025-07-03T05:54:51.264Z
Learning: The `cozy-lib.resources.sanitize` function in packages/library/cozy-lib/templates/_resources.tpl supports both standard Kubernetes resource format (with limits:/requests: sections) and flat format (direct resource specifications). The flat format takes priority over nested values. CozyStack apps include cozy-lib as a chart dependency through symlinks in packages/apps/*/charts/cozy-lib directories.

Applied to files:

  • packages/core/platform/sources/cozystack-engine.yaml
📚 Learning: 2025-12-25T15:24:00.888Z
Learnt from: kvaps
Repo: cozystack/cozystack PR: 1760
File: packages/core/platform/sources/goldpinger.yaml:20-23
Timestamp: 2025-12-25T15:24:00.888Z
Learning: In Goldpinger YAML configurations (e.g., packages/core/platform/sources/goldpinger.yaml), when hostNetwork is enabled, set privileged: true to ensure required host-level capabilities for cross-node network monitoring. Apply this rule to similar Goldpinger YAML files under the same directory. Confirm privileges are limited to scenarios that truly require host access and are scoped to this component.

Applied to files:

  • packages/core/platform/sources/cozystack-engine.yaml
📚 Learning: 2025-07-24T13:21:17.388Z
Learnt from: lllamnyp
Repo: cozystack/cozystack PR: 1239
File: packages/extra/seaweedfs/templates/external/cosi-bucket-class.yaml:3-15
Timestamp: 2025-07-24T13:21:17.388Z
Learning: In COSI (Container Object Storage Interface), BucketAccessClass resources have fields like driverName and authenticationType at the top level, not under a spec block. Only BucketClass resources require a spec block for fields like driverName and deletionPolicy.

Applied to files:

  • packages/system/bucket-rd/cozyrds/bucket.yaml
📚 Learning: 2025-12-25T09:45:26.524Z
Learnt from: CR
Repo: cozystack/cozystack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-25T09:45:26.524Z
Learning: Applies to packages/apps/** : Use Helm Chart umbrella pattern with vendored upstream charts in `charts/` directory

Applied to files:

  • internal/controller/applicationdefinition_helmreconciler.go
  • hack/update-crd.sh
📚 Learning: 2025-12-25T09:45:26.524Z
Learnt from: CR
Repo: cozystack/cozystack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-25T09:45:26.524Z
Learning: Applies to **/*.yaml : Do NOT directly edit upstream Helm charts in vendored charts directory; use proper chart vendoring mechanisms

Applied to files:

  • hack/update-crd.sh
🧬 Code graph analysis (18)
internal/controller/dashboard/customformsoverride.go (2)
internal/controller/dashboard/manager.go (1)
  • Manager (45-48)
api/v1alpha1/applicationdefinitions_types.go (1)
  • ApplicationDefinition (28-33)
internal/controller/dashboard/tableurimapping.go (2)
internal/controller/dashboard/manager.go (1)
  • Manager (45-48)
api/v1alpha1/applicationdefinitions_types.go (1)
  • ApplicationDefinition (28-33)
internal/controller/dashboard/marketplacepanel.go (2)
internal/controller/dashboard/manager.go (1)
  • Manager (45-48)
api/v1alpha1/applicationdefinitions_types.go (1)
  • ApplicationDefinition (28-33)
internal/controller/dashboard/factory.go (2)
internal/controller/dashboard/manager.go (1)
  • Manager (45-48)
api/v1alpha1/applicationdefinitions_types.go (1)
  • ApplicationDefinition (28-33)
pkg/cmd/server/start.go (1)
api/v1alpha1/applicationdefinitions_types.go (1)
  • ApplicationDefinitionList (38-42)
internal/controller/dashboard/breadcrumb.go (2)
internal/controller/dashboard/manager.go (1)
  • Manager (45-48)
api/v1alpha1/applicationdefinitions_types.go (1)
  • ApplicationDefinition (28-33)
internal/controller/dashboard/customformsprefill.go (1)
api/v1alpha1/applicationdefinitions_types.go (1)
  • ApplicationDefinition (28-33)
internal/lineagecontrollerwebhook/webhook.go (2)
internal/lineagecontrollerwebhook/types.go (1)
  • LineageControllerWebhook (15-23)
api/v1alpha1/applicationdefinitions_types.go (2)
  • ApplicationDefinition (28-33)
  • ApplicationDefinitionResources (116-126)
internal/lineagecontrollerwebhook/config.go (2)
api/v1alpha1/applicationdefinitions_types.go (1)
  • ApplicationDefinition (28-33)
internal/lineagecontrollerwebhook/types.go (1)
  • LineageControllerWebhook (15-23)
cmd/cozystack-controller/main.go (3)
internal/controller/applicationdefinition_controller.go (1)
  • ApplicationDefinitionReconciler (26-37)
pkg/apiserver/apiserver.go (1)
  • Scheme (53-53)
internal/controller/applicationdefinition_helmreconciler.go (1)
  • ApplicationDefinitionHelmReconciler (24-27)
internal/lineagecontrollerwebhook/matcher.go (1)
api/v1alpha1/applicationdefinitions_types.go (2)
  • ApplicationDefinitionResourceSelector (108-114)
  • ApplicationDefinitionResources (116-126)
internal/controller/dashboard/customcolumns.go (2)
internal/controller/dashboard/manager.go (1)
  • Manager (45-48)
api/v1alpha1/applicationdefinitions_types.go (1)
  • ApplicationDefinition (28-33)
internal/controller/applicationdefinition_helmreconciler.go (3)
pkg/apiserver/apiserver.go (1)
  • Scheme (53-53)
api/v1alpha1/applicationdefinitions_types.go (1)
  • ApplicationDefinition (28-33)
internal/controller/dashboard/manager.go (1)
  • Manager (45-48)
internal/shared/crdmem/memory.go (1)
api/v1alpha1/applicationdefinitions_types.go (2)
  • ApplicationDefinition (28-33)
  • ApplicationDefinitionList (38-42)
internal/lineagecontrollerwebhook/controller.go (2)
internal/lineagecontrollerwebhook/types.go (1)
  • LineageControllerWebhook (15-23)
api/v1alpha1/applicationdefinitions_types.go (2)
  • ApplicationDefinition (28-33)
  • ApplicationDefinitionList (38-42)
internal/controller/applicationdefinition_controller.go (2)
internal/controller/dashboard/manager.go (1)
  • Manager (45-48)
api/v1alpha1/applicationdefinitions_types.go (3)
  • ApplicationDefinition (28-33)
  • ApplicationDefinitionSpec (48-63)
  • ApplicationDefinitionList (38-42)
internal/controller/dashboard/manager.go (1)
api/v1alpha1/applicationdefinitions_types.go (2)
  • ApplicationDefinition (28-33)
  • ApplicationDefinitionList (38-42)
api/v1alpha1/zz_generated.deepcopy.go (2)
api/v1alpha1/applicationdefinitions_types.go (8)
  • ApplicationDefinition (28-33)
  • ApplicationDefinitionApplication (65-74)
  • ApplicationDefinitionDashboard (143-177)
  • ApplicationDefinitionList (38-42)
  • ApplicationDefinitionRelease (76-83)
  • ApplicationDefinitionResourceSelector (108-114)
  • ApplicationDefinitionResources (116-126)
  • ApplicationDefinitionSpec (48-63)
api/v1alpha1/packagesource_types.go (2)
  • Component (138-159)
  • ComponentInstall (118-135)
🪛 checkmake (0.2.2)
packages/system/application-definition-crd/Makefile

[warning] 1-1: Missing required phony target "all"

(minphony)


[warning] 1-1: Missing required phony target "clean"

(minphony)


[warning] 1-1: Missing required phony target "test"

(minphony)

🔇 Additional comments (77)
packages/system/redis-rd/cozyrds/redis.yaml (1)

1-2: LGTM!

The rename from CozystackResourceDefinition to ApplicationDefinition is correctly applied while preserving the same API version (cozystack.io/v1alpha1). The rest of the resource definition remains unchanged, which is expected for this refactoring PR.

packages/system/mysql-rd/cozyrds/mysql.yaml (1)

1-2: LGTM!

The kind rename from CozystackResourceDefinition to ApplicationDefinition is correctly applied while maintaining the same apiVersion. This aligns with the broader PR refactoring.

packages/system/application-definition-crd/Chart.yaml (1)

1-3: LGTM!

The chart name rename to application-definition-crd correctly reflects the CRD type rename and follows consistent kebab-case naming conventions.

packages/system/monitoring-rd/cozyrds/monitoring.yaml (1)

1-2: LGTM!

The kind rename to ApplicationDefinition is correctly applied, consistent with the other resource definition manifests in this PR.

packages/system/ferretdb-rd/cozyrds/ferretdb.yaml (1)

1-2: LGTM!

The kind rename to ApplicationDefinition is correctly applied, maintaining consistency across all resource definition manifests.

packages/core/platform/values.yaml (1)

6-9: LGTM!

The targetVersion bump to 24 is correct. Migration 23 (which brings the system to version 24) properly removes the old cozystack-resource-definition-crd HelmRelease as part of the rename refactor.

Likely an incorrect or invalid review comment.

packages/system/bucket-rd/cozyrds/bucket.yaml (1)

1-2: LGTM!

The kind field is correctly updated from CozystackResourceDefinition to ApplicationDefinition, consistent with the PR-wide CRD rename. The apiVersion remains unchanged, which is correct.

packages/system/nats-rd/cozyrds/nats.yaml (1)

1-2: LGTM!

The kind field is correctly updated to ApplicationDefinition, aligning with the CRD rename across the codebase.

packages/system/application-definition-crd/Makefile (1)

1-4: LGTM!

The NAME export is correctly updated to application-definition-crd, consistent with the CRD rename and the new chart directory name.

The static analysis warnings about missing all, clean, and test phony targets are false positives—these are likely provided by the included package.mk script.

packages/system/seaweedfs-rd/cozyrds/seaweedfs.yaml (1)

1-2: LGTM!

The kind field is correctly updated to ApplicationDefinition, consistent with the project-wide CRD rename.

packages/system/vpn-rd/cozyrds/vpn.yaml (1)

1-2: LGTM!

The kind field is correctly updated to ApplicationDefinition, completing the rename for this VPN resource definition manifest.

packages/system/info-rd/cozyrds/info.yaml (1)

1-2: LGTM!

The kind field correctly updated to ApplicationDefinition, consistent with the PR's CRD rename objective. The apiVersion and manifest structure remain properly aligned.

packages/system/vm-disk-rd/cozyrds/vm-disk.yaml (1)

1-2: LGTM!

The kind field correctly updated to ApplicationDefinition, aligning with the broader CRD rename across the repository.

packages/system/vm-instance-rd/cozyrds/vm-instance.yaml (1)

1-2: LGTM!

The kind field correctly updated to ApplicationDefinition, consistent with the API type rename throughout the codebase.

packages/system/ingress-rd/cozyrds/ingress.yaml (1)

1-2: LGTM!

The kind field correctly updated to ApplicationDefinition, matching the renamed CRD definition.

packages/system/bootbox-rd/cozyrds/bootbox.yaml (1)

1-2: LGTM!

The kind field correctly updated to ApplicationDefinition, completing the rename for this manifest.

packages/system/kubernetes-rd/cozyrds/kubernetes.yaml (1)

1-2: LGTM!

The kind field is correctly updated to ApplicationDefinition while maintaining the correct apiVersion. The plural form kuberneteses is intentionally non-standard as per the API schema definition. Based on learnings, this naming convention is expected.

packages/system/kafka-rd/cozyrds/kafka.yaml (1)

1-2: LGTM!

The kind field is correctly updated to ApplicationDefinition, consistent with the API rename across the repository.

packages/core/platform/sources/cozystack-engine.yaml (3)

20-24: LGTM!

The component definition is correctly renamed from cozystack-resource-definition-crd to application-definition-crd with consistent updates to name, path, and releaseName.


30-56: LGTM!

All dependsOn references in the default variant are correctly updated to application-definition-crd, maintaining the proper dependency chain for controller, API, webhook, and dashboard components.


66-103: LGTM!

The oidc variant changes are consistent with the default variant, ensuring both deployment configurations reference the renamed application-definition-crd component.

packages/system/http-cache-rd/cozyrds/http-cache.yaml (1)

1-2: LGTM!

The kind field is correctly updated to ApplicationDefinition, consistent with the API rename across all CRD manifests.

packages/system/application-definition-crd/templates/crd.yaml (1)

1-2: I don't see a review comment to rewrite. Please provide the review comment within <review_comment> tags along with the context (file path, code changes, etc.) so I can verify and rewrite it according to the required format.

packages/system/etcd-rd/cozyrds/etcd.yaml (1)

1-2: LGTM!

The kind field is correctly updated from CozystackResourceDefinition to ApplicationDefinition, consistent with the CRD rename across the codebase. The apiVersion appropriately remains cozystack.io/v1alpha1.

hack/update-codegen.sh (2)

29-29: LGTM!

The CRD directory path is correctly updated to application-definition-crd, aligning with the renamed Helm chart and CRD package.


69-70: LGTM!

The generated CRD filename is correctly updated from cozystackio_cozystackresourcedefinitions.yaml to cozystack.io_applicationdefinitions.yaml. This matches the expected output from controller-gen after renaming the Go types to ApplicationDefinition.

packages/system/virtual-machine-rd/cozyrds/virtual-machine.yaml (1)

1-2: LGTM!

The kind field is correctly updated to ApplicationDefinition, consistent with the CRD rename across the codebase.

packages/system/tenant-rd/cozyrds/tenant.yaml (1)

1-2: LGTM!

The kind field is correctly updated to ApplicationDefinition, consistent with the CRD rename across the codebase.

packages/system/tcp-balancer-rd/cozyrds/tcp-balancer.yaml (1)

1-2: LGTM!

The kind field is correctly updated to ApplicationDefinition, consistent with the CRD rename across the codebase.

packages/system/foundationdb-rd/cozyrds/foundationdb.yaml (1)

1-2: LGTM!

The kind update from CozystackResourceDefinition to ApplicationDefinition is consistent with the PR-wide CRD rename and aligns with the updated API types.

packages/system/clickhouse-rd/cozyrds/clickhouse.yaml (1)

1-2: LGTM!

The kind update to ApplicationDefinition is consistent with the CRD rename across the codebase.

internal/lineagecontrollerwebhook/config.go (2)

16-18: LGTM!

The type reference update from CozystackResourceDefinition to ApplicationDefinition is correct and aligns with the renamed API types.


20-28: LGTM!

The map initialization correctly uses the renamed ApplicationDefinition type, maintaining consistency with the struct field definition.

packages/system/postgres-rd/cozyrds/postgres.yaml (1)

1-2: LGTM!

The kind update to ApplicationDefinition is consistent with the CRD rename across all system resource definitions.

packages/system/rabbitmq-rd/cozyrds/rabbitmq.yaml (1)

1-2: LGTM!

The kind update to ApplicationDefinition is consistent with the CRD rename, completing the alignment with the new API types.

packages/core/platform/images/migrations/migrations/23 (1)

6-11: Migration logic looks correct.

The migration properly removes the old cozystack-resource-definition-crd HelmRelease (with --ignore-not-found for idempotency) and stamps the version to 24. This aligns with the CRD rename from CozystackResourceDefinition to ApplicationDefinition.

packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml (1)

1-4: Kind rename looks correct.

The kind field has been correctly updated from CozystackResourceDefinition to ApplicationDefinition while preserving the apiVersion and all other manifest fields.

hack/update-crd.sh (2)

80-87: Skeleton creation updated correctly.

The skeleton template now uses ApplicationDefinition as the default kind for newly created CRD files.


133-136: LGTM: yq update uses correct default.

The conditional assignment (.kind // "ApplicationDefinition") correctly defaults to the new kind while preserving any explicitly set values, maintaining backward compatibility during migration.

internal/controller/dashboard/customformsoverride.go (2)

87-130: Schema parsing logic is sound.

The buildMultilineStringSchema function correctly handles empty schemas, JSON parsing errors (with graceful degradation), and recursively processes the OpenAPI schema structure.


132-194: Recursive schema processing handles nested structures well.

The processSpecProperties function correctly handles string fields (adding multilineString type when no enum), nested objects, and arrays with object items. The type assertions with ok checks prevent panics on unexpected schema structures.

pkg/cmd/server/start.go (2)

127-127: Type update is correct.

The list type has been correctly updated to ApplicationDefinitionList, matching the renamed API type defined in api/v1alpha1/applicationdefinitions_types.go.


145-149: Log and error messages correctly updated.

Both the error message (line 145) and the retry log message (line 149) now correctly reference "ApplicationDefinitions" instead of the old name.

internal/controller/dashboard/breadcrumb.go (1)

16-17: Type change looks correct.

The parameter type update to ApplicationDefinition is properly applied. All accesses to crd.Spec.Dashboard and the owner reference operations are valid with the new type. The same optional rename consideration (crdappDef) applies here as in other dashboard files.

internal/controller/dashboard/customformsprefill.go (1)

18-19: Type change is correct and properly integrated.

The signature update to ApplicationDefinition is correctly applied. The function's accesses to crd.Spec.Application and crd.Spec.Dashboard align with the ApplicationDefinitionSpec structure. The helper calls (pickGVK, pickPlural) and owner reference operations are consistent with the broader rename.

internal/controller/dashboard/marketplacepanel.go (1)

18-19: Type update correctly applied.

The parameter type change to ApplicationDefinition is correctly implemented. The function's conditional logic for handling modules and tenant resources (lines 26, 42) and the spec field accesses (Dashboard, Application) all align with the ApplicationDefinitionSpec structure.

internal/controller/dashboard/factory.go (1)

17-18: Type change correctly applied to ensureFactory.

The parameter type update to ApplicationDefinition is correct. The function properly accesses crd.Spec.Dashboard and crd.Spec.Application which are valid fields on the new type.

internal/controller/dashboard/customcolumns.go (1)

24-24: LGTM!

The function signature update from *cozyv1alpha1.CozystackResourceDefinition to *cozyv1alpha1.ApplicationDefinition is consistent with the broader CRD rename. The internal logic correctly delegates to the updated pickGVK and pickPlural helpers, and the owner reference/labeling remains properly integrated.

internal/controller/dashboard/helpers.go (1)

26-55: LGTM!

The pickGVK and pickPlural function signatures are correctly updated to accept the new *cozyv1alpha1.ApplicationDefinition type. The internal logic accessing crd.Spec.Application.* fields remains unchanged and properly handles GVK extraction and pluralization. Based on learnings, the custom plural handling is important for cases like kuberneteses.apps.cozystack.io.

cmd/cozystack-controller/main.go (1)

207-222: LGTM!

The controller wiring correctly uses the renamed ApplicationDefinitionReconciler and ApplicationDefinitionHelmReconciler types. The error log messages have been properly updated to reflect the new controller names, maintaining consistency with the internal controller package changes.

internal/lineagecontrollerwebhook/controller.go (1)

11-27: LGTM!

The controller updates are correctly aligned with the ApplicationDefinition rename:

  • RBAC marker properly references applicationdefinitions resource
  • Controller watches the correct ApplicationDefinition type
  • List and map types are properly updated to use ApplicationDefinitionList and *ApplicationDefinition
  • Error message reflects the new terminology
internal/lineagecontrollerwebhook/webhook.go (1)

36-48: LGTM!

The getResourceSelectors function signature is correctly updated to use *cozyv1alpha1.ApplicationDefinition parameter and *cozyv1alpha1.ApplicationDefinitionResources return type. The internal logic accessing crd.Spec.Secrets, crd.Spec.Services, and crd.Spec.Ingresses remains unchanged and correctly returns the appropriate resource selectors based on the GroupKind.

internal/lineagecontrollerwebhook/matcher.go (1)

45-73: LGTM!

The type substitutions from CozystackResourceDefinition* to ApplicationDefinition* types are consistent with the API rename. The core matching logic remains unchanged:

  • matchResourceToSelector correctly accepts *ApplicationDefinitionResourceSelector
  • matchResourceToSelectorArray correctly accepts []*ApplicationDefinitionResourceSelector
  • matchResourceToExcludeInclude correctly accepts *ApplicationDefinitionResources
internal/shared/crdmem/memory.go (1)

12-99: LGTM!

The in-memory cache has been correctly updated to store and operate on ApplicationDefinition types:

  • Data map correctly stores cozyv1alpha1.ApplicationDefinition values
  • Upsert, Snapshot, and ListFromCacheOrAPI signatures properly updated
  • Priming logic correctly uses ApplicationDefinitionList for listing resources
  • DeepCopy() call preserved to ensure safe storage of objects
internal/controller/dashboard/manager.go (2)

56-70: LGTM!

The controller setup correctly watches ApplicationDefinition resources and the reconcile loop properly handles the new type. The cache sync and static resource initialization flow is appropriate.


197-228: LGTM!

The CleanupOrphanedResources method correctly uses ApplicationDefinitionList to list all current definitions and build the expected resource set.

packages/system/application-definition-crd/definition/cozystack.io_applicationdefinitions.yaml (1)

1-21: LGTM!

The CRD manifest correctly reflects the rename:

  • metadata.name: applicationdefinitions.cozystack.io
  • kind: ApplicationDefinition
  • listKind: ApplicationDefinitionList
  • plural: applicationdefinitions
  • singular: applicationdefinition

The file is generated by controller-gen.kubebuilder.io/version: v0.16.4, so ensure changes to the CRD are made via the Go API types in api/v1alpha1/applicationdefinitions_types.go and regenerated.

internal/controller/dashboard/sidebar.go (3)

31-41: LGTM!

The ensureSidebar method correctly uses ApplicationDefinition and ApplicationDefinitionList types for fetching and iterating over all definitions to build the sidebar menu.


264-327: LGTM!

The upsertMultipleSidebars method correctly accepts *ApplicationDefinition and properly handles owner references and labels for both dynamic and static sidebars.


373-381: LGTM!

The safeCategory helper correctly accepts *ApplicationDefinition and provides a safe fallback to "Resources" when the dashboard config is missing.

api/v1alpha1/applicationdefinitions_types.go (6)

24-33: LGTM! ApplicationDefinition root type is well-structured.

The kubebuilder markers correctly declare this as a cluster-scoped resource. The type follows standard Kubernetes API conventions with TypeMeta and ObjectMeta embedded.


35-46: LGTM! List type and SchemeBuilder registration look correct.

The ApplicationDefinitionList properly embeds TypeMeta and ListMeta, and the init() function correctly registers both types with the SchemeBuilder.


48-63: LGTM! Spec structure is comprehensive.

The ApplicationDefinitionSpec cleanly organizes application configuration, release settings, resource selectors (secrets, services, ingresses), and dashboard configuration. Field comments are helpful.


65-83: LGTM! Application and Release types are well-defined.

ApplicationDefinitionApplication captures API/UI metadata, and ApplicationDefinitionRelease correctly references Flux's CrossNamespaceSourceReference for chart sourcing.


85-126: LGTM! Resource selector types are well-documented.

The ApplicationDefinitionResourceSelector has excellent documentation explaining the Go template variables and usage patterns. The ApplicationDefinitionResources type correctly uses pointer slices for the include/exclude selectors, allowing nil checks.


128-177: LGTM! Dashboard types are comprehensive.

The DashboardTab enum has proper kubebuilder validation, and ApplicationDefinitionDashboard covers all UI configuration needs with appropriate optional markers.

internal/controller/applicationdefinition_helmreconciler.go (5)

17-27: LGTM! RBAC markers and reconciler struct are properly defined.

The RBAC permissions are appropriately scoped for read-only access to applicationdefinitions and update/patch access to helmreleases.


29-53: LGTM! Reconcile and SetupWithManager methods are clean.

The reconciler correctly fetches the ApplicationDefinition, handles not-found errors gracefully with client.IgnoreNotFound, and the controller is properly named applicationdefinition-helm-reconciler.


55-98: LGTM! HelmRelease update logic is sound.

The function correctly builds label selectors using the application kind and group, validates that applicationKind is non-empty before proceeding, and iterates through matching HelmReleases. The continue on error (line 93-94) is appropriate to ensure one failing update doesn't block others.


100-125: LGTM! Helper functions are well-implemented.

expectedValuesFrom provides a consistent configuration, and valuesFromEqual performs a thorough field-by-field comparison of ValuesReference slices.


127-189: LGTM! Chart update logic is defensive and complete.

The updateHelmReleaseChart function properly validates ChartRef before use, handles the transition from Chart to ChartRef (clearing the old field), and only issues an update when changes are detected. Label propagation is also handled correctly.

internal/controller/applicationdefinition_controller.go (5)

26-43: LGTM! Reconciler struct and Reconcile method are well-structured.

The struct includes proper synchronization primitives for debouncing, and the Reconcile method correctly delegates to the debounced restart logic while noting that HelmRelease reconciliation is handled separately.


45-67: LGTM! Controller setup with watches is correct.

The controller is properly named applicationdefinition-controller, watches ApplicationDefinition resources, and enqueues a fixed request to the cozystack-api workload in cozy-system namespace. The debounce default of 5 seconds is reasonable.


69-95: LGTM! Config hash computation is deterministic.

The appDefHashView struct captures only the relevant fields for hashing. Using slices.SortFunc with sortAppDefs ensures consistent ordering, and SHA-256 provides a reliable hash.


97-152: LGTM! Debounced restart logic is robust.

The implementation correctly handles timing edge cases, compares hashes to avoid unnecessary restarts, and updates the pod template annotation to trigger a rollout. The mutex protects shared state appropriately.


154-189: LGTM! Workload helper and sorting function are correct.

getWorkload abstracts over Deployment/DaemonSet based on CozystackAPIKind, initializes annotations if nil, and returns necessary objects for patching. The sortAppDefs comparator follows the standard three-way comparison contract.

api/v1alpha1/zz_generated.deepcopy.go (1)

1-29: Auto-generated file - no manual review needed.

This file is generated by controller-gen (as indicated by the header comment "Code generated by controller-gen. DO NOT EDIT."). The deepcopy functions for the renamed ApplicationDefinition* types and the new Component/ComponentInstall types appear correctly generated. As per coding guidelines, this file should not be manually edited.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

…ition

Rename the CRD and all related types for better clarity:
- CozystackResourceDefinition -> ApplicationDefinition
- CozystackResourceDefinitionList -> ApplicationDefinitionList
- CozystackResourceDefinitionSpec -> ApplicationDefinitionSpec
- All related nested types updated accordingly

Updated components:
- API types and generated deepcopy code
- Controllers and reconcilers
- Dashboard, lineagecontrollerwebhook, crdmem packages
- CRD YAML definition and Helm chart
- All 25 cozyrds YAML manifests
- Migration scripts and documentation

Added migration 23 to remove old cozystack-resource-definition-crd HelmRelease.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@kvaps kvaps force-pushed the refactor/rename-cozystackresourcedefinition-to-applicationdefinition branch from 3a0cd67 to 57c8cc2 Compare January 15, 2026 21:36
Copy link
Contributor

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/lineagecontrollerwebhook/webhook.go (1)

36-47: Guard against nil crd to avoid a panic.

If cfg.appCRDMap misses the key, crd is nil and crd.Spec will panic. A simple nil check keeps the webhook resilient.

🛡️ Proposed defensive guard
 func (h *LineageControllerWebhook) getResourceSelectors(gk schema.GroupKind, crd *cozyv1alpha1.ApplicationDefinition) *cozyv1alpha1.ApplicationDefinitionResources {
+	if crd == nil {
+		return nil
+	}
 	switch {
 	case gk.Group == "" && gk.Kind == "Secret":
 		return &crd.Spec.Secrets
 	case gk.Group == "" && gk.Kind == "Service":
🤖 Fix all issues with AI agents
In `@hack/update-crd.sh`:
- Around line 134-136: The jq transformation in hack/update-crd.sh only assigns
.kind when missing (uses //) so existing manifests with the old
"CozystackResourceDefinition" kind are not rewritten; update the jq pipeline
that sets .kind (currently using .kind = (.kind // "ApplicationDefinition")) to
unconditionally replace the value (e.g., set .kind = "ApplicationDefinition") or
add an explicit conditional that maps "CozystackResourceDefinition" to
"ApplicationDefinition" so that all existing files are migrated; modify the
expression referencing .kind to perform the unconditional or explicit
replacement.
🧹 Nitpick comments (2)
packages/system/application-definition-crd/templates/crd.yaml (1)

1-2: Guard against missing embedded CRD file.

If the file path is wrong, Helm renders an empty CRD without failing. Consider using required to hard-fail.

♻️ Suggested hard-fail guard
 ---
-{{ .Files.Get "definition/cozystack.io_applicationdefinitions.yaml" }}
+{{- required "missing CRD definition: definition/cozystack.io_applicationdefinitions.yaml" (.Files.Get "definition/cozystack.io_applicationdefinitions.yaml") }}
internal/lineagecontrollerwebhook/controller.go (1)

21-41: Consider renaming variables for consistency.

The variables crds and crd still suggest CRD terminology while now holding ApplicationDefinition types. Consider renaming to appDefs/appDef for clarity, though this is optional.

♻️ Suggested variable rename
-	crds := &cozyv1alpha1.ApplicationDefinitionList{}
-	if err := c.List(ctx, crds); err != nil {
+	appDefs := &cozyv1alpha1.ApplicationDefinitionList{}
+	if err := c.List(ctx, appDefs); err != nil {
 		l.Error(err, "failed reading ApplicationDefinitions")
 		return ctrl.Result{}, err
 	}
 	cfg := &runtimeConfig{
 		appCRDMap: make(map[appRef]*cozyv1alpha1.ApplicationDefinition),
 	}
-	for _, crd := range crds.Items {
+	for _, appDef := range appDefs.Items {
 		appRef := appRef{
 			"apps.cozystack.io",
-			crd.Spec.Application.Kind,
+			appDef.Spec.Application.Kind,
 		}
 
-		newRef := crd
+		newRef := appDef
 		if _, exists := cfg.appCRDMap[appRef]; exists {
 			l.Info("duplicate app mapping detected; ignoring subsequent entry", "key", appRef)
 		} else {
 			cfg.appCRDMap[appRef] = &newRef
 		}
 	}
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3a0cd67 and 57c8cc2.

📒 Files selected for processing (57)
  • api/v1alpha1/applicationdefinitions_types.go
  • api/v1alpha1/zz_generated.deepcopy.go
  • cmd/cozystack-controller/main.go
  • hack/update-codegen.sh
  • hack/update-crd.sh
  • internal/controller/applicationdefinition_controller.go
  • internal/controller/applicationdefinition_helmreconciler.go
  • internal/controller/dashboard/breadcrumb.go
  • internal/controller/dashboard/customcolumns.go
  • internal/controller/dashboard/customformsoverride.go
  • internal/controller/dashboard/customformsprefill.go
  • internal/controller/dashboard/factory.go
  • internal/controller/dashboard/helpers.go
  • internal/controller/dashboard/manager.go
  • internal/controller/dashboard/marketplacepanel.go
  • internal/controller/dashboard/sidebar.go
  • internal/controller/dashboard/tableurimapping.go
  • internal/lineagecontrollerwebhook/config.go
  • internal/lineagecontrollerwebhook/controller.go
  • internal/lineagecontrollerwebhook/matcher.go
  • internal/lineagecontrollerwebhook/webhook.go
  • internal/shared/crdmem/memory.go
  • packages/core/platform/images/migrations/migrations/23
  • packages/core/platform/sources/cozystack-engine.yaml
  • packages/core/platform/values.yaml
  • packages/system/application-definition-crd/Chart.yaml
  • packages/system/application-definition-crd/Makefile
  • packages/system/application-definition-crd/definition/cozystack.io_applicationdefinitions.yaml
  • packages/system/application-definition-crd/templates/crd.yaml
  • packages/system/application-definition-crd/values.yaml
  • packages/system/bootbox-rd/cozyrds/bootbox.yaml
  • packages/system/bucket-rd/cozyrds/bucket.yaml
  • packages/system/clickhouse-rd/cozyrds/clickhouse.yaml
  • packages/system/cozystack-resource-definition-crd/templates/crd.yaml
  • packages/system/etcd-rd/cozyrds/etcd.yaml
  • packages/system/ferretdb-rd/cozyrds/ferretdb.yaml
  • packages/system/foundationdb-rd/cozyrds/foundationdb.yaml
  • packages/system/http-cache-rd/cozyrds/http-cache.yaml
  • packages/system/info-rd/cozyrds/info.yaml
  • packages/system/ingress-rd/cozyrds/ingress.yaml
  • packages/system/kafka-rd/cozyrds/kafka.yaml
  • packages/system/kubernetes-rd/cozyrds/kubernetes.yaml
  • packages/system/monitoring-rd/cozyrds/monitoring.yaml
  • packages/system/mysql-rd/cozyrds/mysql.yaml
  • packages/system/nats-rd/cozyrds/nats.yaml
  • packages/system/postgres-rd/cozyrds/postgres.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/tenant-rd/cozyrds/tenant.yaml
  • packages/system/virtual-machine-rd/cozyrds/virtual-machine.yaml
  • packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml
  • packages/system/vm-disk-rd/cozyrds/vm-disk.yaml
  • packages/system/vm-instance-rd/cozyrds/vm-instance.yaml
  • packages/system/vpn-rd/cozyrds/vpn.yaml
  • pkg/cmd/server/start.go
💤 Files with no reviewable changes (1)
  • packages/system/cozystack-resource-definition-crd/templates/crd.yaml
🚧 Files skipped from review as they are similar to previous changes (20)
  • internal/controller/dashboard/breadcrumb.go
  • packages/system/bootbox-rd/cozyrds/bootbox.yaml
  • packages/core/platform/values.yaml
  • packages/core/platform/images/migrations/migrations/23
  • packages/system/kafka-rd/cozyrds/kafka.yaml
  • pkg/cmd/server/start.go
  • packages/system/ingress-rd/cozyrds/ingress.yaml
  • internal/controller/dashboard/factory.go
  • packages/system/mysql-rd/cozyrds/mysql.yaml
  • packages/system/tcp-balancer-rd/cozyrds/tcp-balancer.yaml
  • packages/system/redis-rd/cozyrds/redis.yaml
  • packages/system/monitoring-rd/cozyrds/monitoring.yaml
  • packages/system/virtual-machine-rd/cozyrds/virtual-machine.yaml
  • packages/system/info-rd/cozyrds/info.yaml
  • internal/lineagecontrollerwebhook/matcher.go
  • packages/system/application-definition-crd/definition/cozystack.io_applicationdefinitions.yaml
  • packages/system/etcd-rd/cozyrds/etcd.yaml
  • packages/system/clickhouse-rd/cozyrds/clickhouse.yaml
  • internal/controller/dashboard/customformsoverride.go
  • packages/system/nats-rd/cozyrds/nats.yaml
🧰 Additional context used
📓 Path-based instructions (7)
internal/**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

Follow controller-runtime patterns and kubebuilder style for Go code in internal directory

Files:

  • internal/lineagecontrollerwebhook/controller.go
  • internal/controller/dashboard/customformsprefill.go
  • internal/controller/dashboard/marketplacepanel.go
  • internal/controller/dashboard/manager.go
  • internal/lineagecontrollerwebhook/config.go
  • internal/controller/dashboard/customcolumns.go
  • internal/lineagecontrollerwebhook/webhook.go
  • internal/shared/crdmem/memory.go
  • internal/controller/dashboard/tableurimapping.go
  • internal/controller/applicationdefinition_controller.go
  • internal/controller/dashboard/helpers.go
  • internal/controller/applicationdefinition_helmreconciler.go
  • internal/controller/dashboard/sidebar.go
**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

Do NOT manually edit vendor/ directory or auto-generated files (zz_generated.*.go)

Files:

  • internal/lineagecontrollerwebhook/controller.go
  • internal/controller/dashboard/customformsprefill.go
  • internal/controller/dashboard/marketplacepanel.go
  • internal/controller/dashboard/manager.go
  • internal/lineagecontrollerwebhook/config.go
  • api/v1alpha1/applicationdefinitions_types.go
  • internal/controller/dashboard/customcolumns.go
  • cmd/cozystack-controller/main.go
  • internal/lineagecontrollerwebhook/webhook.go
  • internal/shared/crdmem/memory.go
  • internal/controller/dashboard/tableurimapping.go
  • internal/controller/applicationdefinition_controller.go
  • api/v1alpha1/zz_generated.deepcopy.go
  • internal/controller/dashboard/helpers.go
  • internal/controller/applicationdefinition_helmreconciler.go
  • internal/controller/dashboard/sidebar.go
packages/system/**

📄 CodeRabbit inference engine (AGENTS.md)

Use Helm Chart umbrella pattern with vendored upstream charts in charts/ directory

Files:

  • packages/system/postgres-rd/cozyrds/postgres.yaml
  • packages/system/application-definition-crd/Makefile
  • packages/system/vm-disk-rd/cozyrds/vm-disk.yaml
  • packages/system/application-definition-crd/templates/crd.yaml
  • packages/system/tenant-rd/cozyrds/tenant.yaml
  • packages/system/bucket-rd/cozyrds/bucket.yaml
  • packages/system/foundationdb-rd/cozyrds/foundationdb.yaml
  • packages/system/http-cache-rd/cozyrds/http-cache.yaml
  • packages/system/ferretdb-rd/cozyrds/ferretdb.yaml
  • packages/system/vpn-rd/cozyrds/vpn.yaml
  • packages/system/seaweedfs-rd/cozyrds/seaweedfs.yaml
  • packages/system/application-definition-crd/Chart.yaml
  • packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml
  • packages/system/vm-instance-rd/cozyrds/vm-instance.yaml
  • packages/system/rabbitmq-rd/cozyrds/rabbitmq.yaml
  • packages/system/kubernetes-rd/cozyrds/kubernetes.yaml
**/*.yaml

📄 CodeRabbit inference engine (AGENTS.md)

Do NOT directly edit upstream Helm charts in vendored charts directory; use proper chart vendoring mechanisms

Files:

  • packages/system/postgres-rd/cozyrds/postgres.yaml
  • packages/system/vm-disk-rd/cozyrds/vm-disk.yaml
  • packages/system/application-definition-crd/templates/crd.yaml
  • packages/system/tenant-rd/cozyrds/tenant.yaml
  • packages/system/bucket-rd/cozyrds/bucket.yaml
  • packages/system/foundationdb-rd/cozyrds/foundationdb.yaml
  • packages/system/http-cache-rd/cozyrds/http-cache.yaml
  • packages/system/ferretdb-rd/cozyrds/ferretdb.yaml
  • packages/system/vpn-rd/cozyrds/vpn.yaml
  • packages/system/seaweedfs-rd/cozyrds/seaweedfs.yaml
  • packages/system/application-definition-crd/Chart.yaml
  • packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml
  • packages/system/vm-instance-rd/cozyrds/vm-instance.yaml
  • packages/system/rabbitmq-rd/cozyrds/rabbitmq.yaml
  • packages/system/kubernetes-rd/cozyrds/kubernetes.yaml
  • packages/core/platform/sources/cozystack-engine.yaml
api/**

📄 CodeRabbit inference engine (AGENTS.md)

Define Kubernetes CRDs in the api directory following kubebuilder conventions

Files:

  • api/v1alpha1/applicationdefinitions_types.go
  • api/v1alpha1/zz_generated.deepcopy.go
cmd/**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

Follow controller-runtime patterns and kubebuilder style for Go code in cmd directory

Files:

  • cmd/cozystack-controller/main.go
packages/core/**

📄 CodeRabbit inference engine (AGENTS.md)

Use Helm Chart umbrella pattern with vendored upstream charts in charts/ directory

Files:

  • packages/core/platform/sources/cozystack-engine.yaml
🧠 Learnings (9)
📓 Common learnings
Learnt from: lllamnyp
Repo: cozystack/cozystack PR: 1130
File: hack/e2e-apps/kubernetes.bats:101-101
Timestamp: 2025-07-11T06:11:25.438Z
Learning: In cozystack, the plural form for the Kubernetes custom resource is `kuberneteses.apps.cozystack.io`, not `kubernetes.apps.cozystack.io`. This is defined in the API schema even though it's not grammatically perfect.
📚 Learning: 2025-11-28T21:26:10.771Z
Learnt from: kvaps
Repo: cozystack/cozystack PR: 1671
File: packages/apps/postgres/files/versions.yaml:1-6
Timestamp: 2025-11-28T21:26:10.771Z
Learning: In packages/apps/postgres/files/versions.yaml, the version mappings are sourced from the CloudNativePG container registry (ghcr.io/cloudnative-pg/postgresql), not from PostgreSQL project releases. The versions should reflect what's actually published in the CloudNativePG registry, which is automatically fetched by the hack/update-versions.sh script.

Applied to files:

  • packages/system/postgres-rd/cozyrds/postgres.yaml
📚 Learning: 2025-07-11T06:11:25.438Z
Learnt from: lllamnyp
Repo: cozystack/cozystack PR: 1130
File: hack/e2e-apps/kubernetes.bats:101-101
Timestamp: 2025-07-11T06:11:25.438Z
Learning: In cozystack, the plural form for the Kubernetes custom resource is `kuberneteses.apps.cozystack.io`, not `kubernetes.apps.cozystack.io`. This is defined in the API schema even though it's not grammatically perfect.

Applied to files:

  • packages/system/postgres-rd/cozyrds/postgres.yaml
  • packages/system/vm-disk-rd/cozyrds/vm-disk.yaml
  • packages/system/tenant-rd/cozyrds/tenant.yaml
  • packages/system/bucket-rd/cozyrds/bucket.yaml
  • packages/system/foundationdb-rd/cozyrds/foundationdb.yaml
  • api/v1alpha1/applicationdefinitions_types.go
  • packages/system/http-cache-rd/cozyrds/http-cache.yaml
  • packages/system/ferretdb-rd/cozyrds/ferretdb.yaml
  • packages/system/vpn-rd/cozyrds/vpn.yaml
  • packages/system/seaweedfs-rd/cozyrds/seaweedfs.yaml
  • packages/system/application-definition-crd/Chart.yaml
  • packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml
  • packages/system/vm-instance-rd/cozyrds/vm-instance.yaml
  • packages/system/rabbitmq-rd/cozyrds/rabbitmq.yaml
  • packages/system/kubernetes-rd/cozyrds/kubernetes.yaml
  • packages/core/platform/sources/cozystack-engine.yaml
  • internal/controller/dashboard/helpers.go
📚 Learning: 2025-12-25T09:45:26.524Z
Learnt from: CR
Repo: cozystack/cozystack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-25T09:45:26.524Z
Learning: Applies to packages/apps/** : Use Helm Chart umbrella pattern with vendored upstream charts in `charts/` directory

Applied to files:

  • hack/update-crd.sh
  • internal/controller/applicationdefinition_helmreconciler.go
📚 Learning: 2025-12-25T09:45:26.524Z
Learnt from: CR
Repo: cozystack/cozystack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-25T09:45:26.524Z
Learning: Applies to **/*.yaml : Do NOT directly edit upstream Helm charts in vendored charts directory; use proper chart vendoring mechanisms

Applied to files:

  • hack/update-crd.sh
📚 Learning: 2025-07-26T18:12:05.641Z
Learnt from: NickVolynkin
Repo: cozystack/cozystack PR: 1216
File: packages/apps/virtual-machine/values.yaml:0-0
Timestamp: 2025-07-26T18:12:05.641Z
Learning: In the cozystack repository, for the virtual-machine app's resources.sockets parameter, the value is intentionally kept as a string in values.yaml despite being documented as {int} type, because the string-to-integer parsing happens elsewhere in the system pipeline rather than at the YAML validation level.

Applied to files:

  • packages/system/vm-disk-rd/cozyrds/vm-disk.yaml
  • packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml
  • packages/system/vm-instance-rd/cozyrds/vm-instance.yaml
📚 Learning: 2025-07-24T13:21:17.388Z
Learnt from: lllamnyp
Repo: cozystack/cozystack PR: 1239
File: packages/extra/seaweedfs/templates/external/cosi-bucket-class.yaml:3-15
Timestamp: 2025-07-24T13:21:17.388Z
Learning: In COSI (Container Object Storage Interface), BucketAccessClass resources have fields like driverName and authenticationType at the top level, not under a spec block. Only BucketClass resources require a spec block for fields like driverName and deletionPolicy.

Applied to files:

  • packages/system/bucket-rd/cozyrds/bucket.yaml
📚 Learning: 2025-07-03T05:54:51.264Z
Learnt from: NickVolynkin
Repo: cozystack/cozystack PR: 1120
File: packages/apps/clickhouse/README.md:60-67
Timestamp: 2025-07-03T05:54:51.264Z
Learning: The `cozy-lib.resources.sanitize` function in packages/library/cozy-lib/templates/_resources.tpl supports both standard Kubernetes resource format (with limits:/requests: sections) and flat format (direct resource specifications). The flat format takes priority over nested values. CozyStack apps include cozy-lib as a chart dependency through symlinks in packages/apps/*/charts/cozy-lib directories.

Applied to files:

  • packages/core/platform/sources/cozystack-engine.yaml
📚 Learning: 2025-12-25T15:24:00.888Z
Learnt from: kvaps
Repo: cozystack/cozystack PR: 1760
File: packages/core/platform/sources/goldpinger.yaml:20-23
Timestamp: 2025-12-25T15:24:00.888Z
Learning: In Goldpinger YAML configurations (e.g., packages/core/platform/sources/goldpinger.yaml), when hostNetwork is enabled, set privileged: true to ensure required host-level capabilities for cross-node network monitoring. Apply this rule to similar Goldpinger YAML files under the same directory. Confirm privileges are limited to scenarios that truly require host access and are scoped to this component.

Applied to files:

  • packages/core/platform/sources/cozystack-engine.yaml
🧬 Code graph analysis (13)
internal/lineagecontrollerwebhook/controller.go (1)
api/v1alpha1/applicationdefinitions_types.go (2)
  • ApplicationDefinition (28-33)
  • ApplicationDefinitionList (38-42)
internal/controller/dashboard/marketplacepanel.go (2)
internal/controller/dashboard/manager.go (1)
  • Manager (45-48)
api/v1alpha1/applicationdefinitions_types.go (1)
  • ApplicationDefinition (28-33)
internal/controller/dashboard/manager.go (1)
api/v1alpha1/applicationdefinitions_types.go (2)
  • ApplicationDefinition (28-33)
  • ApplicationDefinitionList (38-42)
internal/lineagecontrollerwebhook/config.go (2)
api/v1alpha1/applicationdefinitions_types.go (1)
  • ApplicationDefinition (28-33)
internal/lineagecontrollerwebhook/types.go (1)
  • LineageControllerWebhook (15-23)
internal/controller/dashboard/customcolumns.go (1)
api/v1alpha1/applicationdefinitions_types.go (1)
  • ApplicationDefinition (28-33)
cmd/cozystack-controller/main.go (3)
internal/controller/applicationdefinition_controller.go (1)
  • ApplicationDefinitionReconciler (26-37)
pkg/apiserver/apiserver.go (1)
  • Scheme (53-53)
internal/controller/applicationdefinition_helmreconciler.go (1)
  • ApplicationDefinitionHelmReconciler (24-27)
internal/lineagecontrollerwebhook/webhook.go (2)
internal/lineagecontrollerwebhook/types.go (1)
  • LineageControllerWebhook (15-23)
api/v1alpha1/applicationdefinitions_types.go (2)
  • ApplicationDefinition (28-33)
  • ApplicationDefinitionResources (116-126)
internal/shared/crdmem/memory.go (1)
api/v1alpha1/applicationdefinitions_types.go (2)
  • ApplicationDefinition (28-33)
  • ApplicationDefinitionList (38-42)
internal/controller/dashboard/tableurimapping.go (2)
internal/controller/dashboard/manager.go (1)
  • Manager (45-48)
api/v1alpha1/applicationdefinitions_types.go (1)
  • ApplicationDefinition (28-33)
internal/controller/applicationdefinition_controller.go (1)
api/v1alpha1/applicationdefinitions_types.go (3)
  • ApplicationDefinition (28-33)
  • ApplicationDefinitionSpec (48-63)
  • ApplicationDefinitionList (38-42)
internal/controller/dashboard/helpers.go (1)
api/v1alpha1/applicationdefinitions_types.go (1)
  • ApplicationDefinition (28-33)
internal/controller/applicationdefinition_helmreconciler.go (3)
pkg/apiserver/apiserver.go (1)
  • Scheme (53-53)
api/v1alpha1/applicationdefinitions_types.go (1)
  • ApplicationDefinition (28-33)
internal/controller/dashboard/manager.go (1)
  • Manager (45-48)
internal/controller/dashboard/sidebar.go (2)
internal/controller/dashboard/manager.go (1)
  • Manager (45-48)
api/v1alpha1/applicationdefinitions_types.go (2)
  • ApplicationDefinition (28-33)
  • ApplicationDefinitionList (38-42)
🪛 checkmake (0.2.2)
packages/system/application-definition-crd/Makefile

[warning] 1-1: Missing required phony target "all"

(minphony)


[warning] 1-1: Missing required phony target "clean"

(minphony)


[warning] 1-1: Missing required phony target "test"

(minphony)

⏰ 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). (1)
  • GitHub Check: Build
🔇 Additional comments (53)
packages/system/application-definition-crd/Chart.yaml (1)

2-2: Rename aligns with new CRD naming.

Looks consistent with the ApplicationDefinition rename.

packages/system/tenant-rd/cozyrds/tenant.yaml (1)

2-2: Kind rename is consistent.

No issues here.

hack/update-crd.sh (1)

81-85: Skeleton kind updated appropriately.

The generated stub now aligns with ApplicationDefinition.

packages/system/seaweedfs-rd/cozyrds/seaweedfs.yaml (1)

2-2: Kind rename looks correct.

No issues found.

hack/update-codegen.sh (2)

29-30: LGTM!

The path update to application-definition-crd is consistent with the CRD rename.

Minor consideration: The variable name COZY_RD_CRDDIR still uses the "RD" (ResourceDefinition) abbreviation. For full consistency with the rename, consider renaming it to something like APP_DEF_CRDDIR or COZY_APPDEF_CRDDIR. However, this is entirely optional.


69-70: LGTM!

The mv command correctly references the renamed CRD file cozystack.io_applicationdefinitions.yaml and moves it to the updated directory path.

packages/system/vm-instance-rd/cozyrds/vm-instance.yaml (1)

1-2: LGTM!

The kind field is correctly updated to ApplicationDefinition while maintaining the same apiVersion: cozystack.io/v1alpha1. This is consistent with the CRD rename across the codebase.

packages/system/application-definition-crd/Makefile (1)

1-4: LGTM!

The NAME export is correctly updated to application-definition-crd, aligning with the renamed Helm chart and CRD package. The static analysis warnings about missing phony targets are false positives—these are provided by the included package.mk.

packages/system/vm-disk-rd/cozyrds/vm-disk.yaml (1)

1-2: LGTM!

The kind field is correctly updated to ApplicationDefinition, consistent with the broader CRD rename.

packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml (1)

1-2: LGTM!

The kind field is correctly updated to ApplicationDefinition, consistent with the CRD rename across all 25 cozyrds manifests mentioned in the PR.

packages/system/ferretdb-rd/cozyrds/ferretdb.yaml (1)

2-2: Rename looks consistent with the new CRD kind.
No issues spotted with the ApplicationDefinition swap here.

packages/core/platform/sources/cozystack-engine.yaml (2)

20-56: Default variant rename/dependency updates are coherent.
Component name/path/releaseName and dependsOn entries line up with the new CRD identifier.


66-103: OIDC variant rename/dependency updates are coherent.
Same rename and dependency wiring as default; looks consistent.

packages/system/postgres-rd/cozyrds/postgres.yaml (1)

2-2: Rename aligns with ApplicationDefinition rollout.
No additional issues observed.

internal/lineagecontrollerwebhook/config.go (1)

16-25: Type swap to ApplicationDefinition is consistent.
Initialization and map type match the renamed API.

packages/system/vpn-rd/cozyrds/vpn.yaml (1)

2-2: Rename looks consistent with the new CRD kind.
No issues spotted in this manifest update.

packages/system/bucket-rd/cozyrds/bucket.yaml (1)

2-2: LGTM: kind updated to ApplicationDefinition.
Consistent with the global CRD rename.

packages/system/http-cache-rd/cozyrds/http-cache.yaml (1)

2-2: LGTM: kind updated to ApplicationDefinition.

packages/system/rabbitmq-rd/cozyrds/rabbitmq.yaml (1)

2-2: LGTM: kind updated to ApplicationDefinition.

packages/system/kubernetes-rd/cozyrds/kubernetes.yaml (1)

2-2: LGTM: kind updated to ApplicationDefinition.

packages/system/foundationdb-rd/cozyrds/foundationdb.yaml (1)

2-2: LGTM: kind updated to ApplicationDefinition.

internal/controller/dashboard/tableurimapping.go (1)

9-10: LGTM: signature aligned with ApplicationDefinition rename.

internal/controller/dashboard/customformsprefill.go (1)

18-20: LGTM: signature updated consistently with ApplicationDefinition.

internal/controller/dashboard/marketplacepanel.go (1)

18-20: LGTM: MarketplacePanel now targets ApplicationDefinition.

cmd/cozystack-controller/main.go (1)

203-221: LGTM: reconciler wiring updated to ApplicationDefinition.

internal/lineagecontrollerwebhook/controller.go (1)

11-27: LGTM on type rename.

The RBAC annotation, watched type, list type, error messages, and map value type are all correctly updated to use ApplicationDefinition. The logic is preserved.

internal/controller/dashboard/customcolumns.go (1)

24-24: Type parameter correctly updated.

The function signature now accepts *cozyv1alpha1.ApplicationDefinition, aligning with the renamed API type. All internal usage remains consistent.

internal/controller/dashboard/helpers.go (1)

26-55: Helper functions correctly updated for ApplicationDefinition.

Both pickGVK and pickPlural now accept *cozyv1alpha1.ApplicationDefinition. The logic correctly accesses crd.Spec.Application.Kind and crd.Spec.Application.Plural fields. The naive pluralization fallback (adding 's') is appropriate since custom plurals like "kuberneteses" are defined explicitly in the ApplicationDefinition spec.

internal/shared/crdmem/memory.go (3)

12-20: Memory store correctly updated for ApplicationDefinition.

The Memory struct's data map and New() constructor are properly updated to use ApplicationDefinition types.


33-56: Upsert and Snapshot methods correctly typed.

Both methods now operate on ApplicationDefinition types with proper DeepCopy() semantics preserved.


68-98: API list operations updated consistently.

EnsurePrimingWithManager and ListFromCacheOrAPI correctly use ApplicationDefinitionList for Kubernetes API interactions.

internal/controller/dashboard/manager.go (6)

56-70: Controller setup correctly watches ApplicationDefinition.

The SetupWithManager method now watches ApplicationDefinition resources, aligning with the renamed CRD type.


72-89: Reconcile correctly handles ApplicationDefinition.

The reconciler creates and operates on ApplicationDefinition instances and calls the renamed EnsureForAppDef method.


91-143: Entry-point method appropriately renamed.

EnsureForAppDef is a reasonable abbreviation that maintains clarity while being more concise than EnsureForApplicationDefinition. The method signature and all internal calls are correctly updated.


150-172: Label helper correctly typed for ApplicationDefinition.

The addDashboardLabels method accepts *cozyv1alpha1.ApplicationDefinition and correctly extracts GVK/plural information via the updated helper functions.


197-228: Cleanup logic correctly updated for ApplicationDefinition.

CleanupOrphanedResources uses ApplicationDefinitionList for listing and passes items correctly to buildExpectedResourceSet.


230-325: Expected resource set builder correctly typed.

The buildExpectedResourceSet method accepts []cozyv1alpha1.ApplicationDefinition and correctly iterates over the slice, accessing Spec.Dashboard fields appropriately.

internal/controller/dashboard/sidebar.go (3)

31-40: LGTM!

The type substitutions from CozystackResourceDefinition to ApplicationDefinition are applied consistently throughout the function. The local variable declarations and list types are correctly updated to use the new API types.


264-270: LGTM!

The function signature correctly uses the renamed ApplicationDefinition type, consistent with the broader refactoring.


373-381: LGTM!

The helper function is correctly updated to accept the new ApplicationDefinition type.

api/v1alpha1/applicationdefinitions_types.go (3)

24-46: LGTM!

The ApplicationDefinition and ApplicationDefinitionList types are correctly defined with proper kubebuilder markers. The cluster-scoped resource annotation and SchemeBuilder registration are appropriate for a CRD type definition.


48-126: LGTM!

The spec types (ApplicationDefinitionSpec, ApplicationDefinitionApplication, ApplicationDefinitionRelease, ApplicationDefinitionResourceSelector, ApplicationDefinitionResources) are well-structured with clear field documentation. The JSON annotations are preserved correctly, ensuring backward compatibility for serialization.


128-177: LGTM!

The ApplicationDefinitionDashboard type with its validation enum for DashboardTab is correctly defined. The optional fields are properly marked with +optional comments.

internal/controller/applicationdefinition_helmreconciler.go (4)

17-27: LGTM!

The RBAC marker is correctly updated to applicationdefinitions, and the reconciler struct follows controller-runtime patterns with embedded client.Client and Scheme.


29-53: LGTM!

The Reconcile method correctly uses the appDef variable naming convention, and SetupWithManager properly watches ApplicationDefinition resources with an appropriate controller name.


55-98: LGTM!

The method has been renamed from updateHelmReleasesForCRD to updateHelmReleasesForAppDef, addressing the previous review feedback. The logic correctly derives applicationKind from appDef.Spec.Application.Kind and uses appropriate label selectors.


127-189: LGTM!

The updateHelmReleaseChart method correctly uses appDef references for ChartRef, Labels, and related fields. The validation and update logic is sound.

internal/controller/applicationdefinition_controller.go (5)

26-43: LGTM!

The reconciler struct is correctly renamed to ApplicationDefinitionReconciler, and the Reconcile method appropriately delegates to debouncedRestart while noting that HelmRelease reconciliation is handled by the separate ApplicationDefinitionHelmReconciler.


45-67: LGTM!

The SetupWithManager correctly configures the controller with the name applicationdefinition-controller and watches ApplicationDefinition resources. The event handling with debounce logic is properly implemented.


69-95: LGTM!

The hash view struct and computeConfigHash method have been properly renamed (appDefHashView, sortAppDefs), addressing previous review feedback. The logic for computing config hashes over sorted ApplicationDefinition items is correct.


97-152: LGTM!

The debouncedRestart method correctly handles the debounce logic and updates the pod template annotation. The log message at Line 135 has been updated to reference "ApplicationDefinition config" appropriately.


154-189: LGTM!

The getWorkload helper correctly handles both Deployment and DaemonSet workload types, and the sortAppDefs function provides proper ordering for consistent hash computation.

api/v1alpha1/zz_generated.deepcopy.go (1)

1-29: Auto-generated file - no manual review required.

This file is generated by controller-gen and correctly reflects the renamed ApplicationDefinition* types. As per coding guidelines, auto-generated files (zz_generated.*.go) should not be manually edited. The regeneration appears correct following the type renames in applicationdefinitions_types.go.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines 134 to 136
.apiVersion = (.apiVersion // "cozystack.io/v1alpha1") |
.kind = (.kind // "CozystackResourceDefinition") |
.kind = (.kind // "ApplicationDefinition") |
.metadata.name = strenv(RES_NAME) |
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Force kind rewrite during updates.

Line 135 only sets .kind when missing, so existing files with CozystackResourceDefinition won’t be migrated by this script. Make it unconditional (or explicitly replace the old value).

🐛 Proposed fix
-  .kind       = (.kind       // "ApplicationDefinition") |
+  .kind       = "ApplicationDefinition" |
📝 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
.apiVersion = (.apiVersion // "cozystack.io/v1alpha1") |
.kind = (.kind // "CozystackResourceDefinition") |
.kind = (.kind // "ApplicationDefinition") |
.metadata.name = strenv(RES_NAME) |
.apiVersion = (.apiVersion // "cozystack.io/v1alpha1") |
.kind = "ApplicationDefinition" |
.metadata.name = strenv(RES_NAME) |
🤖 Prompt for AI Agents
In `@hack/update-crd.sh` around lines 134 - 136, The jq transformation in
hack/update-crd.sh only assigns .kind when missing (uses //) so existing
manifests with the old "CozystackResourceDefinition" kind are not rewritten;
update the jq pipeline that sets .kind (currently using .kind = (.kind //
"ApplicationDefinition")) to unconditionally replace the value (e.g., set .kind
= "ApplicationDefinition") or add an explicit conditional that maps
"CozystackResourceDefinition" to "ApplicationDefinition" so that all existing
files are migrated; modify the expression referencing .kind to perform the
unconditional or explicit replacement.

@kvaps kvaps merged commit b5e6791 into main Jan 15, 2026
22 checks passed
@kvaps kvaps deleted the refactor/rename-cozystackresourcedefinition-to-applicationdefinition branch January 15, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants