-
Notifications
You must be signed in to change notification settings - Fork 136
refactor(api): rename CozystackResourceDefinition to ApplicationDefinition #1864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(api): rename CozystackResourceDefinition to ApplicationDefinition #1864
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit 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. 📝 WalkthroughWalkthroughRenames the custom resource and all related public types from CozystackResourceDefinition to ApplicationDefinition across APIs, controllers, webhooks, dashboard code, CRD manifests, packaging, and tooling. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
Summary of ChangesHello @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 Highlights
🧠 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 AssistThe 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
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 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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| type crdHashView struct { | ||
| Name string `json:"name"` | ||
| Spec cozyv1alpha1.CozystackResourceDefinitionSpec `json:"spec"` | ||
| Name string `json:"name"` | ||
| Spec cozyv1alpha1.ApplicationDefinitionSpec `json:"spec"` | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with the refactoring, consider renaming crdHashView to appDefHashView. This would make it clearer that this struct is specific to ApplicationDefinition.
| 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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with the refactoring, consider renaming EnsureForCRD to EnsureForApplicationDefinition. The crd parameter could also be renamed to appDef to be more specific.
| 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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 renamingcrdparameter toappDeffor consistency.The method was renamed from
EnsureForCRDtoEnsureForAppDef, but the parameter is still namedcrd. For consistency with the broader rename, consider updating the parameter name toappDefthroughout this file (also inaddDashboardLabels,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 namecrdand the comment "for the given CRD" are now slightly misleading since this is an ApplicationDefinition, not a CustomResourceDefinition. Consider renaming toappDeffor 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
crdreferences in the function body toappDef.pkg/cmd/server/start.go (1)
158-180: Consider renamingcrdListvariable 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
crdListtoappDefListor 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, // ... etcinternal/controller/dashboard/tableurimapping.go (1)
9-12: Consider renaming thecrdparameter toappDeffor consistency.The type has been correctly updated to
ApplicationDefinition, but the parameter is still namedcrd. Per the PR objectives, the follow-up commit was intended to renamecrdparameters toappDeffor 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: Unusedcrdparameter infactoryFeatureFlags.The type change is correct, but the
crdparameter is not used in the function body—it just returns hardcodedtruevalues 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:
- Removing the parameter if feature flags are always enabled, or
- Adding a
_ = crdor//nolint:unusedto signal intentional non-use
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (57)
api/v1alpha1/applicationdefinitions_types.goapi/v1alpha1/zz_generated.deepcopy.gocmd/cozystack-controller/main.gohack/update-codegen.shhack/update-crd.shinternal/controller/applicationdefinition_controller.gointernal/controller/applicationdefinition_helmreconciler.gointernal/controller/dashboard/breadcrumb.gointernal/controller/dashboard/customcolumns.gointernal/controller/dashboard/customformsoverride.gointernal/controller/dashboard/customformsprefill.gointernal/controller/dashboard/factory.gointernal/controller/dashboard/helpers.gointernal/controller/dashboard/manager.gointernal/controller/dashboard/marketplacepanel.gointernal/controller/dashboard/sidebar.gointernal/controller/dashboard/tableurimapping.gointernal/lineagecontrollerwebhook/config.gointernal/lineagecontrollerwebhook/controller.gointernal/lineagecontrollerwebhook/matcher.gointernal/lineagecontrollerwebhook/webhook.gointernal/shared/crdmem/memory.gopackages/core/platform/images/migrations/migrations/23packages/core/platform/sources/cozystack-engine.yamlpackages/core/platform/values.yamlpackages/system/application-definition-crd/Chart.yamlpackages/system/application-definition-crd/Makefilepackages/system/application-definition-crd/definition/cozystack.io_applicationdefinitions.yamlpackages/system/application-definition-crd/templates/crd.yamlpackages/system/application-definition-crd/values.yamlpackages/system/bootbox-rd/cozyrds/bootbox.yamlpackages/system/bucket-rd/cozyrds/bucket.yamlpackages/system/clickhouse-rd/cozyrds/clickhouse.yamlpackages/system/cozystack-resource-definition-crd/templates/crd.yamlpackages/system/etcd-rd/cozyrds/etcd.yamlpackages/system/ferretdb-rd/cozyrds/ferretdb.yamlpackages/system/foundationdb-rd/cozyrds/foundationdb.yamlpackages/system/http-cache-rd/cozyrds/http-cache.yamlpackages/system/info-rd/cozyrds/info.yamlpackages/system/ingress-rd/cozyrds/ingress.yamlpackages/system/kafka-rd/cozyrds/kafka.yamlpackages/system/kubernetes-rd/cozyrds/kubernetes.yamlpackages/system/monitoring-rd/cozyrds/monitoring.yamlpackages/system/mysql-rd/cozyrds/mysql.yamlpackages/system/nats-rd/cozyrds/nats.yamlpackages/system/postgres-rd/cozyrds/postgres.yamlpackages/system/rabbitmq-rd/cozyrds/rabbitmq.yamlpackages/system/redis-rd/cozyrds/redis.yamlpackages/system/seaweedfs-rd/cozyrds/seaweedfs.yamlpackages/system/tcp-balancer-rd/cozyrds/tcp-balancer.yamlpackages/system/tenant-rd/cozyrds/tenant.yamlpackages/system/virtual-machine-rd/cozyrds/virtual-machine.yamlpackages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yamlpackages/system/vm-disk-rd/cozyrds/vm-disk.yamlpackages/system/vm-instance-rd/cozyrds/vm-instance.yamlpackages/system/vpn-rd/cozyrds/vpn.yamlpkg/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.gointernal/controller/dashboard/tableurimapping.gointernal/controller/dashboard/marketplacepanel.gointernal/controller/dashboard/factory.gointernal/controller/dashboard/breadcrumb.gointernal/controller/dashboard/customformsprefill.gointernal/controller/dashboard/helpers.gointernal/lineagecontrollerwebhook/webhook.gointernal/lineagecontrollerwebhook/config.gointernal/lineagecontrollerwebhook/matcher.gointernal/controller/dashboard/customcolumns.gointernal/controller/applicationdefinition_helmreconciler.gointernal/controller/dashboard/sidebar.gointernal/shared/crdmem/memory.gointernal/lineagecontrollerwebhook/controller.gointernal/controller/applicationdefinition_controller.gointernal/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.gointernal/controller/dashboard/tableurimapping.gointernal/controller/dashboard/marketplacepanel.gointernal/controller/dashboard/factory.gopkg/cmd/server/start.gointernal/controller/dashboard/breadcrumb.gointernal/controller/dashboard/customformsprefill.gointernal/controller/dashboard/helpers.gointernal/lineagecontrollerwebhook/webhook.gointernal/lineagecontrollerwebhook/config.gocmd/cozystack-controller/main.gointernal/lineagecontrollerwebhook/matcher.gointernal/controller/dashboard/customcolumns.goapi/v1alpha1/applicationdefinitions_types.gointernal/controller/applicationdefinition_helmreconciler.gointernal/controller/dashboard/sidebar.gointernal/shared/crdmem/memory.gointernal/lineagecontrollerwebhook/controller.gointernal/controller/applicationdefinition_controller.gointernal/controller/dashboard/manager.goapi/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.yamlpackages/system/postgres-rd/cozyrds/postgres.yamlpackages/system/rabbitmq-rd/cozyrds/rabbitmq.yamlpackages/system/application-definition-crd/Makefilepackages/system/tcp-balancer-rd/cozyrds/tcp-balancer.yamlpackages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yamlpackages/system/info-rd/cozyrds/info.yamlpackages/system/http-cache-rd/cozyrds/http-cache.yamlpackages/system/vm-disk-rd/cozyrds/vm-disk.yamlpackages/system/etcd-rd/cozyrds/etcd.yamlpackages/system/ingress-rd/cozyrds/ingress.yamlpackages/system/kafka-rd/cozyrds/kafka.yamlpackages/system/virtual-machine-rd/cozyrds/virtual-machine.yamlpackages/system/monitoring-rd/cozyrds/monitoring.yamlpackages/system/clickhouse-rd/cozyrds/clickhouse.yamlpackages/system/kubernetes-rd/cozyrds/kubernetes.yamlpackages/system/foundationdb-rd/cozyrds/foundationdb.yamlpackages/system/vpn-rd/cozyrds/vpn.yamlpackages/system/nats-rd/cozyrds/nats.yamlpackages/system/redis-rd/cozyrds/redis.yamlpackages/system/bucket-rd/cozyrds/bucket.yamlpackages/system/application-definition-crd/Chart.yamlpackages/system/application-definition-crd/templates/crd.yamlpackages/system/ferretdb-rd/cozyrds/ferretdb.yamlpackages/system/application-definition-crd/definition/cozystack.io_applicationdefinitions.yamlpackages/system/mysql-rd/cozyrds/mysql.yamlpackages/system/vm-instance-rd/cozyrds/vm-instance.yamlpackages/system/bootbox-rd/cozyrds/bootbox.yamlpackages/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.yamlpackages/core/platform/values.yamlpackages/system/postgres-rd/cozyrds/postgres.yamlpackages/system/rabbitmq-rd/cozyrds/rabbitmq.yamlpackages/system/tcp-balancer-rd/cozyrds/tcp-balancer.yamlpackages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yamlpackages/system/info-rd/cozyrds/info.yamlpackages/system/http-cache-rd/cozyrds/http-cache.yamlpackages/system/vm-disk-rd/cozyrds/vm-disk.yamlpackages/system/etcd-rd/cozyrds/etcd.yamlpackages/system/ingress-rd/cozyrds/ingress.yamlpackages/system/kafka-rd/cozyrds/kafka.yamlpackages/core/platform/sources/cozystack-engine.yamlpackages/system/virtual-machine-rd/cozyrds/virtual-machine.yamlpackages/system/monitoring-rd/cozyrds/monitoring.yamlpackages/system/clickhouse-rd/cozyrds/clickhouse.yamlpackages/system/kubernetes-rd/cozyrds/kubernetes.yamlpackages/system/foundationdb-rd/cozyrds/foundationdb.yamlpackages/system/vpn-rd/cozyrds/vpn.yamlpackages/system/nats-rd/cozyrds/nats.yamlpackages/system/redis-rd/cozyrds/redis.yamlpackages/system/bucket-rd/cozyrds/bucket.yamlpackages/system/application-definition-crd/Chart.yamlpackages/system/application-definition-crd/templates/crd.yamlpackages/system/ferretdb-rd/cozyrds/ferretdb.yamlpackages/system/application-definition-crd/definition/cozystack.io_applicationdefinitions.yamlpackages/system/mysql-rd/cozyrds/mysql.yamlpackages/system/vm-instance-rd/cozyrds/vm-instance.yamlpackages/system/bootbox-rd/cozyrds/bootbox.yamlpackages/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.yamlpackages/core/platform/sources/cozystack-engine.yamlpackages/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.goapi/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.yamlpackages/system/postgres-rd/cozyrds/postgres.yamlpackages/system/rabbitmq-rd/cozyrds/rabbitmq.yamlpackages/system/tcp-balancer-rd/cozyrds/tcp-balancer.yamlpackages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yamlpackages/system/info-rd/cozyrds/info.yamlpackages/system/http-cache-rd/cozyrds/http-cache.yamlpackages/system/vm-disk-rd/cozyrds/vm-disk.yamlpackages/system/etcd-rd/cozyrds/etcd.yamlpackages/system/ingress-rd/cozyrds/ingress.yamlpackages/system/kafka-rd/cozyrds/kafka.yamlpackages/core/platform/sources/cozystack-engine.yamlpackages/system/virtual-machine-rd/cozyrds/virtual-machine.yamlinternal/controller/dashboard/helpers.gopackages/system/monitoring-rd/cozyrds/monitoring.yamlpackages/system/clickhouse-rd/cozyrds/clickhouse.yamlpackages/system/kubernetes-rd/cozyrds/kubernetes.yamlpackages/system/foundationdb-rd/cozyrds/foundationdb.yamlpackages/system/vpn-rd/cozyrds/vpn.yamlpackages/system/nats-rd/cozyrds/nats.yamlpackages/system/redis-rd/cozyrds/redis.yamlpackages/system/bucket-rd/cozyrds/bucket.yamlpackages/system/application-definition-crd/Chart.yamlapi/v1alpha1/applicationdefinitions_types.gopackages/system/ferretdb-rd/cozyrds/ferretdb.yamlpackages/system/application-definition-crd/definition/cozystack.io_applicationdefinitions.yamlpackages/system/mysql-rd/cozyrds/mysql.yamlpackages/system/vm-instance-rd/cozyrds/vm-instance.yamlpackages/system/bootbox-rd/cozyrds/bootbox.yamlpackages/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.yamlpackages/system/vm-disk-rd/cozyrds/vm-disk.yamlpackages/system/virtual-machine-rd/cozyrds/virtual-machine.yamlpackages/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.gohack/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
CozystackResourceDefinitiontoApplicationDefinitionis 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
kindrename fromCozystackResourceDefinitiontoApplicationDefinitionis correctly applied while maintaining the sameapiVersion. 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-crdcorrectly reflects the CRD type rename and follows consistent kebab-case naming conventions.packages/system/monitoring-rd/cozyrds/monitoring.yaml (1)
1-2: LGTM!The
kindrename toApplicationDefinitionis correctly applied, consistent with the other resource definition manifests in this PR.packages/system/ferretdb-rd/cozyrds/ferretdb.yaml (1)
1-2: LGTM!The
kindrename toApplicationDefinitionis correctly applied, maintaining consistency across all resource definition manifests.packages/core/platform/values.yaml (1)
6-9: LGTM!The
targetVersionbump to 24 is correct. Migration 23 (which brings the system to version 24) properly removes the oldcozystack-resource-definition-crdHelmRelease 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
kindfield is correctly updated fromCozystackResourceDefinitiontoApplicationDefinition, consistent with the PR-wide CRD rename. TheapiVersionremains unchanged, which is correct.packages/system/nats-rd/cozyrds/nats.yaml (1)
1-2: LGTM!The
kindfield is correctly updated toApplicationDefinition, aligning with the CRD rename across the codebase.packages/system/application-definition-crd/Makefile (1)
1-4: LGTM!The
NAMEexport is correctly updated toapplication-definition-crd, consistent with the CRD rename and the new chart directory name.The static analysis warnings about missing
all,clean, andtestphony targets are false positives—these are likely provided by the includedpackage.mkscript.packages/system/seaweedfs-rd/cozyrds/seaweedfs.yaml (1)
1-2: LGTM!The
kindfield is correctly updated toApplicationDefinition, consistent with the project-wide CRD rename.packages/system/vpn-rd/cozyrds/vpn.yaml (1)
1-2: LGTM!The
kindfield is correctly updated toApplicationDefinition, completing the rename for this VPN resource definition manifest.packages/system/info-rd/cozyrds/info.yaml (1)
1-2: LGTM!The
kindfield correctly updated toApplicationDefinition, consistent with the PR's CRD rename objective. TheapiVersionand manifest structure remain properly aligned.packages/system/vm-disk-rd/cozyrds/vm-disk.yaml (1)
1-2: LGTM!The
kindfield correctly updated toApplicationDefinition, aligning with the broader CRD rename across the repository.packages/system/vm-instance-rd/cozyrds/vm-instance.yaml (1)
1-2: LGTM!The
kindfield correctly updated toApplicationDefinition, consistent with the API type rename throughout the codebase.packages/system/ingress-rd/cozyrds/ingress.yaml (1)
1-2: LGTM!The
kindfield correctly updated toApplicationDefinition, matching the renamed CRD definition.packages/system/bootbox-rd/cozyrds/bootbox.yaml (1)
1-2: LGTM!The
kindfield correctly updated toApplicationDefinition, completing the rename for this manifest.packages/system/kubernetes-rd/cozyrds/kubernetes.yaml (1)
1-2: LGTM!The
kindfield is correctly updated toApplicationDefinitionwhile maintaining the correctapiVersion. The plural formkubernetesesis 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
kindfield is correctly updated toApplicationDefinition, 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-crdtoapplication-definition-crdwith consistent updates toname,path, andreleaseName.
30-56: LGTM!All
dependsOnreferences in the default variant are correctly updated toapplication-definition-crd, maintaining the proper dependency chain for controller, API, webhook, and dashboard components.
66-103: LGTM!The
oidcvariant changes are consistent with thedefaultvariant, ensuring both deployment configurations reference the renamedapplication-definition-crdcomponent.packages/system/http-cache-rd/cozyrds/http-cache.yaml (1)
1-2: LGTM!The
kindfield is correctly updated toApplicationDefinition, 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
kindfield is correctly updated fromCozystackResourceDefinitiontoApplicationDefinition, consistent with the CRD rename across the codebase. TheapiVersionappropriately remainscozystack.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.yamltocozystack.io_applicationdefinitions.yaml. This matches the expected output from controller-gen after renaming the Go types toApplicationDefinition.packages/system/virtual-machine-rd/cozyrds/virtual-machine.yaml (1)
1-2: LGTM!The
kindfield is correctly updated toApplicationDefinition, consistent with the CRD rename across the codebase.packages/system/tenant-rd/cozyrds/tenant.yaml (1)
1-2: LGTM!The
kindfield is correctly updated toApplicationDefinition, consistent with the CRD rename across the codebase.packages/system/tcp-balancer-rd/cozyrds/tcp-balancer.yaml (1)
1-2: LGTM!The
kindfield is correctly updated toApplicationDefinition, consistent with the CRD rename across the codebase.packages/system/foundationdb-rd/cozyrds/foundationdb.yaml (1)
1-2: LGTM!The
kindupdate fromCozystackResourceDefinitiontoApplicationDefinitionis 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
kindupdate toApplicationDefinitionis consistent with the CRD rename across the codebase.internal/lineagecontrollerwebhook/config.go (2)
16-18: LGTM!The type reference update from
CozystackResourceDefinitiontoApplicationDefinitionis correct and aligns with the renamed API types.
20-28: LGTM!The map initialization correctly uses the renamed
ApplicationDefinitiontype, maintaining consistency with the struct field definition.packages/system/postgres-rd/cozyrds/postgres.yaml (1)
1-2: LGTM!The
kindupdate toApplicationDefinitionis consistent with the CRD rename across all system resource definitions.packages/system/rabbitmq-rd/cozyrds/rabbitmq.yaml (1)
1-2: LGTM!The
kindupdate toApplicationDefinitionis 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-crdHelmRelease (with--ignore-not-foundfor idempotency) and stamps the version to 24. This aligns with the CRD rename fromCozystackResourceDefinitiontoApplicationDefinition.packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml (1)
1-4: Kind rename looks correct.The
kindfield has been correctly updated fromCozystackResourceDefinitiontoApplicationDefinitionwhile preserving theapiVersionand all other manifest fields.hack/update-crd.sh (2)
80-87: Skeleton creation updated correctly.The skeleton template now uses
ApplicationDefinitionas 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
buildMultilineStringSchemafunction 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
processSpecPropertiesfunction correctly handles string fields (addingmultilineStringtype when no enum), nested objects, and arrays with object items. The type assertions withokchecks 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 inapi/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
ApplicationDefinitionis properly applied. All accesses tocrd.Spec.Dashboardand the owner reference operations are valid with the new type. The same optional rename consideration (crd→appDef) 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
ApplicationDefinitionis correctly applied. The function's accesses tocrd.Spec.Applicationandcrd.Spec.Dashboardalign with theApplicationDefinitionSpecstructure. 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
ApplicationDefinitionis 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 theApplicationDefinitionSpecstructure.internal/controller/dashboard/factory.go (1)
17-18: Type change correctly applied toensureFactory.The parameter type update to
ApplicationDefinitionis correct. The function properly accessescrd.Spec.Dashboardandcrd.Spec.Applicationwhich are valid fields on the new type.internal/controller/dashboard/customcolumns.go (1)
24-24: LGTM!The function signature update from
*cozyv1alpha1.CozystackResourceDefinitionto*cozyv1alpha1.ApplicationDefinitionis consistent with the broader CRD rename. The internal logic correctly delegates to the updatedpickGVKandpickPluralhelpers, and the owner reference/labeling remains properly integrated.internal/controller/dashboard/helpers.go (1)
26-55: LGTM!The
pickGVKandpickPluralfunction signatures are correctly updated to accept the new*cozyv1alpha1.ApplicationDefinitiontype. The internal logic accessingcrd.Spec.Application.*fields remains unchanged and properly handles GVK extraction and pluralization. Based on learnings, the custom plural handling is important for cases likekuberneteses.apps.cozystack.io.cmd/cozystack-controller/main.go (1)
207-222: LGTM!The controller wiring correctly uses the renamed
ApplicationDefinitionReconcilerandApplicationDefinitionHelmReconcilertypes. 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
applicationdefinitionsresource- Controller watches the correct
ApplicationDefinitiontype- List and map types are properly updated to use
ApplicationDefinitionListand*ApplicationDefinition- Error message reflects the new terminology
internal/lineagecontrollerwebhook/webhook.go (1)
36-48: LGTM!The
getResourceSelectorsfunction signature is correctly updated to use*cozyv1alpha1.ApplicationDefinitionparameter and*cozyv1alpha1.ApplicationDefinitionResourcesreturn type. The internal logic accessingcrd.Spec.Secrets,crd.Spec.Services, andcrd.Spec.Ingressesremains 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*toApplicationDefinition*types are consistent with the API rename. The core matching logic remains unchanged:
matchResourceToSelectorcorrectly accepts*ApplicationDefinitionResourceSelectormatchResourceToSelectorArraycorrectly accepts[]*ApplicationDefinitionResourceSelectormatchResourceToExcludeIncludecorrectly accepts*ApplicationDefinitionResourcesinternal/shared/crdmem/memory.go (1)
12-99: LGTM!The in-memory cache has been correctly updated to store and operate on
ApplicationDefinitiontypes:
- Data map correctly stores
cozyv1alpha1.ApplicationDefinitionvaluesUpsert,Snapshot, andListFromCacheOrAPIsignatures properly updated- Priming logic correctly uses
ApplicationDefinitionListfor listing resourcesDeepCopy()call preserved to ensure safe storage of objectsinternal/controller/dashboard/manager.go (2)
56-70: LGTM!The controller setup correctly watches
ApplicationDefinitionresources and the reconcile loop properly handles the new type. The cache sync and static resource initialization flow is appropriate.
197-228: LGTM!The
CleanupOrphanedResourcesmethod correctly usesApplicationDefinitionListto 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.iokind:ApplicationDefinitionlistKind:ApplicationDefinitionListplural:applicationdefinitionssingular:applicationdefinitionThe 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 inapi/v1alpha1/applicationdefinitions_types.goand regenerated.internal/controller/dashboard/sidebar.go (3)
31-41: LGTM!The
ensureSidebarmethod correctly usesApplicationDefinitionandApplicationDefinitionListtypes for fetching and iterating over all definitions to build the sidebar menu.
264-327: LGTM!The
upsertMultipleSidebarsmethod correctly accepts*ApplicationDefinitionand properly handles owner references and labels for both dynamic and static sidebars.
373-381: LGTM!The
safeCategoryhelper correctly accepts*ApplicationDefinitionand 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
ApplicationDefinitionListproperly embedsTypeMetaandListMeta, and theinit()function correctly registers both types with the SchemeBuilder.
48-63: LGTM! Spec structure is comprehensive.The
ApplicationDefinitionSpeccleanly 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.
ApplicationDefinitionApplicationcaptures API/UI metadata, andApplicationDefinitionReleasecorrectly references Flux'sCrossNamespaceSourceReferencefor chart sourcing.
85-126: LGTM! Resource selector types are well-documented.The
ApplicationDefinitionResourceSelectorhas excellent documentation explaining the Go template variables and usage patterns. TheApplicationDefinitionResourcestype correctly uses pointer slices for the include/exclude selectors, allowing nil checks.
128-177: LGTM! Dashboard types are comprehensive.The
DashboardTabenum has proper kubebuilder validation, andApplicationDefinitionDashboardcovers 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
applicationdefinitionsand update/patch access tohelmreleases.
29-53: LGTM! Reconcile and SetupWithManager methods are clean.The reconciler correctly fetches the
ApplicationDefinition, handles not-found errors gracefully withclient.IgnoreNotFound, and the controller is properly namedapplicationdefinition-helm-reconciler.
55-98: LGTM! HelmRelease update logic is sound.The function correctly builds label selectors using the application kind and group, validates that
applicationKindis non-empty before proceeding, and iterates through matching HelmReleases. Thecontinueon error (line 93-94) is appropriate to ensure one failing update doesn't block others.
100-125: LGTM! Helper functions are well-implemented.
expectedValuesFromprovides a consistent configuration, andvaluesFromEqualperforms a thorough field-by-field comparison ofValuesReferenceslices.
127-189: LGTM! Chart update logic is defensive and complete.The
updateHelmReleaseChartfunction properly validates ChartRef before use, handles the transition fromCharttoChartRef(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
Reconcilemethod 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, watchesApplicationDefinitionresources, and enqueues a fixed request to thecozystack-apiworkload incozy-systemnamespace. The debounce default of 5 seconds is reasonable.
69-95: LGTM! Config hash computation is deterministic.The
appDefHashViewstruct captures only the relevant fields for hashing. Usingslices.SortFuncwithsortAppDefsensures 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.
getWorkloadabstracts over Deployment/DaemonSet based onCozystackAPIKind, initializes annotations if nil, and returns necessary objects for patching. ThesortAppDefscomparator 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 renamedApplicationDefinition*types and the newComponent/ComponentInstalltypes 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>
3a0cd67 to
57c8cc2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 nilcrdto avoid a panic.If
cfg.appCRDMapmisses the key,crdis nil andcrd.Specwill 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
requiredto 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
crdsandcrdstill suggest CRD terminology while now holdingApplicationDefinitiontypes. Consider renaming toappDefs/appDeffor 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
📒 Files selected for processing (57)
api/v1alpha1/applicationdefinitions_types.goapi/v1alpha1/zz_generated.deepcopy.gocmd/cozystack-controller/main.gohack/update-codegen.shhack/update-crd.shinternal/controller/applicationdefinition_controller.gointernal/controller/applicationdefinition_helmreconciler.gointernal/controller/dashboard/breadcrumb.gointernal/controller/dashboard/customcolumns.gointernal/controller/dashboard/customformsoverride.gointernal/controller/dashboard/customformsprefill.gointernal/controller/dashboard/factory.gointernal/controller/dashboard/helpers.gointernal/controller/dashboard/manager.gointernal/controller/dashboard/marketplacepanel.gointernal/controller/dashboard/sidebar.gointernal/controller/dashboard/tableurimapping.gointernal/lineagecontrollerwebhook/config.gointernal/lineagecontrollerwebhook/controller.gointernal/lineagecontrollerwebhook/matcher.gointernal/lineagecontrollerwebhook/webhook.gointernal/shared/crdmem/memory.gopackages/core/platform/images/migrations/migrations/23packages/core/platform/sources/cozystack-engine.yamlpackages/core/platform/values.yamlpackages/system/application-definition-crd/Chart.yamlpackages/system/application-definition-crd/Makefilepackages/system/application-definition-crd/definition/cozystack.io_applicationdefinitions.yamlpackages/system/application-definition-crd/templates/crd.yamlpackages/system/application-definition-crd/values.yamlpackages/system/bootbox-rd/cozyrds/bootbox.yamlpackages/system/bucket-rd/cozyrds/bucket.yamlpackages/system/clickhouse-rd/cozyrds/clickhouse.yamlpackages/system/cozystack-resource-definition-crd/templates/crd.yamlpackages/system/etcd-rd/cozyrds/etcd.yamlpackages/system/ferretdb-rd/cozyrds/ferretdb.yamlpackages/system/foundationdb-rd/cozyrds/foundationdb.yamlpackages/system/http-cache-rd/cozyrds/http-cache.yamlpackages/system/info-rd/cozyrds/info.yamlpackages/system/ingress-rd/cozyrds/ingress.yamlpackages/system/kafka-rd/cozyrds/kafka.yamlpackages/system/kubernetes-rd/cozyrds/kubernetes.yamlpackages/system/monitoring-rd/cozyrds/monitoring.yamlpackages/system/mysql-rd/cozyrds/mysql.yamlpackages/system/nats-rd/cozyrds/nats.yamlpackages/system/postgres-rd/cozyrds/postgres.yamlpackages/system/rabbitmq-rd/cozyrds/rabbitmq.yamlpackages/system/redis-rd/cozyrds/redis.yamlpackages/system/seaweedfs-rd/cozyrds/seaweedfs.yamlpackages/system/tcp-balancer-rd/cozyrds/tcp-balancer.yamlpackages/system/tenant-rd/cozyrds/tenant.yamlpackages/system/virtual-machine-rd/cozyrds/virtual-machine.yamlpackages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yamlpackages/system/vm-disk-rd/cozyrds/vm-disk.yamlpackages/system/vm-instance-rd/cozyrds/vm-instance.yamlpackages/system/vpn-rd/cozyrds/vpn.yamlpkg/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.gointernal/controller/dashboard/customformsprefill.gointernal/controller/dashboard/marketplacepanel.gointernal/controller/dashboard/manager.gointernal/lineagecontrollerwebhook/config.gointernal/controller/dashboard/customcolumns.gointernal/lineagecontrollerwebhook/webhook.gointernal/shared/crdmem/memory.gointernal/controller/dashboard/tableurimapping.gointernal/controller/applicationdefinition_controller.gointernal/controller/dashboard/helpers.gointernal/controller/applicationdefinition_helmreconciler.gointernal/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.gointernal/controller/dashboard/customformsprefill.gointernal/controller/dashboard/marketplacepanel.gointernal/controller/dashboard/manager.gointernal/lineagecontrollerwebhook/config.goapi/v1alpha1/applicationdefinitions_types.gointernal/controller/dashboard/customcolumns.gocmd/cozystack-controller/main.gointernal/lineagecontrollerwebhook/webhook.gointernal/shared/crdmem/memory.gointernal/controller/dashboard/tableurimapping.gointernal/controller/applicationdefinition_controller.goapi/v1alpha1/zz_generated.deepcopy.gointernal/controller/dashboard/helpers.gointernal/controller/applicationdefinition_helmreconciler.gointernal/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.yamlpackages/system/application-definition-crd/Makefilepackages/system/vm-disk-rd/cozyrds/vm-disk.yamlpackages/system/application-definition-crd/templates/crd.yamlpackages/system/tenant-rd/cozyrds/tenant.yamlpackages/system/bucket-rd/cozyrds/bucket.yamlpackages/system/foundationdb-rd/cozyrds/foundationdb.yamlpackages/system/http-cache-rd/cozyrds/http-cache.yamlpackages/system/ferretdb-rd/cozyrds/ferretdb.yamlpackages/system/vpn-rd/cozyrds/vpn.yamlpackages/system/seaweedfs-rd/cozyrds/seaweedfs.yamlpackages/system/application-definition-crd/Chart.yamlpackages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yamlpackages/system/vm-instance-rd/cozyrds/vm-instance.yamlpackages/system/rabbitmq-rd/cozyrds/rabbitmq.yamlpackages/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.yamlpackages/system/vm-disk-rd/cozyrds/vm-disk.yamlpackages/system/application-definition-crd/templates/crd.yamlpackages/system/tenant-rd/cozyrds/tenant.yamlpackages/system/bucket-rd/cozyrds/bucket.yamlpackages/system/foundationdb-rd/cozyrds/foundationdb.yamlpackages/system/http-cache-rd/cozyrds/http-cache.yamlpackages/system/ferretdb-rd/cozyrds/ferretdb.yamlpackages/system/vpn-rd/cozyrds/vpn.yamlpackages/system/seaweedfs-rd/cozyrds/seaweedfs.yamlpackages/system/application-definition-crd/Chart.yamlpackages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yamlpackages/system/vm-instance-rd/cozyrds/vm-instance.yamlpackages/system/rabbitmq-rd/cozyrds/rabbitmq.yamlpackages/system/kubernetes-rd/cozyrds/kubernetes.yamlpackages/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.goapi/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.yamlpackages/system/vm-disk-rd/cozyrds/vm-disk.yamlpackages/system/tenant-rd/cozyrds/tenant.yamlpackages/system/bucket-rd/cozyrds/bucket.yamlpackages/system/foundationdb-rd/cozyrds/foundationdb.yamlapi/v1alpha1/applicationdefinitions_types.gopackages/system/http-cache-rd/cozyrds/http-cache.yamlpackages/system/ferretdb-rd/cozyrds/ferretdb.yamlpackages/system/vpn-rd/cozyrds/vpn.yamlpackages/system/seaweedfs-rd/cozyrds/seaweedfs.yamlpackages/system/application-definition-crd/Chart.yamlpackages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yamlpackages/system/vm-instance-rd/cozyrds/vm-instance.yamlpackages/system/rabbitmq-rd/cozyrds/rabbitmq.yamlpackages/system/kubernetes-rd/cozyrds/kubernetes.yamlpackages/core/platform/sources/cozystack-engine.yamlinternal/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.shinternal/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.yamlpackages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yamlpackages/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-crdis consistent with the CRD rename.Minor consideration: The variable name
COZY_RD_CRDDIRstill uses the "RD" (ResourceDefinition) abbreviation. For full consistency with the rename, consider renaming it to something likeAPP_DEF_CRDDIRorCOZY_APPDEF_CRDDIR. However, this is entirely optional.
69-70: LGTM!The mv command correctly references the renamed CRD file
cozystack.io_applicationdefinitions.yamland moves it to the updated directory path.packages/system/vm-instance-rd/cozyrds/vm-instance.yaml (1)
1-2: LGTM!The
kindfield is correctly updated toApplicationDefinitionwhile maintaining the sameapiVersion: cozystack.io/v1alpha1. This is consistent with the CRD rename across the codebase.packages/system/application-definition-crd/Makefile (1)
1-4: LGTM!The
NAMEexport is correctly updated toapplication-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 includedpackage.mk.packages/system/vm-disk-rd/cozyrds/vm-disk.yaml (1)
1-2: LGTM!The
kindfield is correctly updated toApplicationDefinition, consistent with the broader CRD rename.packages/system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud.yaml (1)
1-2: LGTM!The
kindfield is correctly updated toApplicationDefinition, 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 toApplicationDefinition.
Consistent with the global CRD rename.packages/system/http-cache-rd/cozyrds/http-cache.yaml (1)
2-2: LGTM: kind updated toApplicationDefinition.packages/system/rabbitmq-rd/cozyrds/rabbitmq.yaml (1)
2-2: LGTM: kind updated toApplicationDefinition.packages/system/kubernetes-rd/cozyrds/kubernetes.yaml (1)
2-2: LGTM: kind updated toApplicationDefinition.packages/system/foundationdb-rd/cozyrds/foundationdb.yaml (1)
2-2: LGTM: kind updated toApplicationDefinition.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
pickGVKandpickPluralnow accept*cozyv1alpha1.ApplicationDefinition. The logic correctly accessescrd.Spec.Application.Kindandcrd.Spec.Application.Pluralfields. 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
Memorystruct's data map andNew()constructor are properly updated to useApplicationDefinitiontypes.
33-56: Upsert and Snapshot methods correctly typed.Both methods now operate on
ApplicationDefinitiontypes with properDeepCopy()semantics preserved.
68-98: API list operations updated consistently.
EnsurePrimingWithManagerandListFromCacheOrAPIcorrectly useApplicationDefinitionListfor Kubernetes API interactions.internal/controller/dashboard/manager.go (6)
56-70: Controller setup correctly watches ApplicationDefinition.The
SetupWithManagermethod now watchesApplicationDefinitionresources, aligning with the renamed CRD type.
72-89: Reconcile correctly handles ApplicationDefinition.The reconciler creates and operates on
ApplicationDefinitioninstances and calls the renamedEnsureForAppDefmethod.
91-143: Entry-point method appropriately renamed.
EnsureForAppDefis a reasonable abbreviation that maintains clarity while being more concise thanEnsureForApplicationDefinition. The method signature and all internal calls are correctly updated.
150-172: Label helper correctly typed for ApplicationDefinition.The
addDashboardLabelsmethod accepts*cozyv1alpha1.ApplicationDefinitionand correctly extracts GVK/plural information via the updated helper functions.
197-228: Cleanup logic correctly updated for ApplicationDefinition.
CleanupOrphanedResourcesusesApplicationDefinitionListfor listing and passes items correctly tobuildExpectedResourceSet.
230-325: Expected resource set builder correctly typed.The
buildExpectedResourceSetmethod accepts[]cozyv1alpha1.ApplicationDefinitionand correctly iterates over the slice, accessingSpec.Dashboardfields appropriately.internal/controller/dashboard/sidebar.go (3)
31-40: LGTM!The type substitutions from
CozystackResourceDefinitiontoApplicationDefinitionare 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
ApplicationDefinitiontype, consistent with the broader refactoring.
373-381: LGTM!The helper function is correctly updated to accept the new
ApplicationDefinitiontype.api/v1alpha1/applicationdefinitions_types.go (3)
24-46: LGTM!The
ApplicationDefinitionandApplicationDefinitionListtypes 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
ApplicationDefinitionDashboardtype with its validation enum forDashboardTabis correctly defined. The optional fields are properly marked with+optionalcomments.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 embeddedclient.ClientandScheme.
29-53: LGTM!The
Reconcilemethod correctly uses theappDefvariable naming convention, andSetupWithManagerproperly watchesApplicationDefinitionresources with an appropriate controller name.
55-98: LGTM!The method has been renamed from
updateHelmReleasesForCRDtoupdateHelmReleasesForAppDef, addressing the previous review feedback. The logic correctly derivesapplicationKindfromappDef.Spec.Application.Kindand uses appropriate label selectors.
127-189: LGTM!The
updateHelmReleaseChartmethod correctly usesappDefreferences forChartRef,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 theReconcilemethod appropriately delegates todebouncedRestartwhile noting that HelmRelease reconciliation is handled by the separateApplicationDefinitionHelmReconciler.
45-67: LGTM!The
SetupWithManagercorrectly configures the controller with the nameapplicationdefinition-controllerand watchesApplicationDefinitionresources. The event handling with debounce logic is properly implemented.
69-95: LGTM!The hash view struct and
computeConfigHashmethod have been properly renamed (appDefHashView,sortAppDefs), addressing previous review feedback. The logic for computing config hashes over sortedApplicationDefinitionitems is correct.
97-152: LGTM!The
debouncedRestartmethod 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
getWorkloadhelper correctly handles both Deployment and DaemonSet workload types, and thesortAppDefsfunction 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-genand correctly reflects the renamedApplicationDefinition*types. As per coding guidelines, auto-generated files (zz_generated.*.go) should not be manually edited. The regeneration appears correct following the type renames inapplicationdefinitions_types.go.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
| .apiVersion = (.apiVersion // "cozystack.io/v1alpha1") | | ||
| .kind = (.kind // "CozystackResourceDefinition") | | ||
| .kind = (.kind // "ApplicationDefinition") | | ||
| .metadata.name = strenv(RES_NAME) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| .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.
What this PR does
Renames
CozystackResourceDefinitionCRD toApplicationDefinitionfor better clarity and consistency.Changes include:
cozystack-resource-definition-crdtoapplication-definition-crdkind: ApplicationDefinitioncozystack-resource-definition-crdHelmReleaseRelease note
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.