Skip to content

feat: replace MongoDB example with Minecraft apps from cozylex#2

Merged
lexfrei merged 3 commits intocozystack:mainfrom
lexfrei:fix/update-to-applicationdefinition-api
Apr 14, 2026
Merged

feat: replace MongoDB example with Minecraft apps from cozylex#2
lexfrei merged 3 commits intocozystack:mainfrom
lexfrei:fix/update-to-applicationdefinition-api

Conversation

@lexfrei
Copy link
Copy Markdown
Contributor

@lexfrei lexfrei commented Mar 16, 2026

Summary

Replace the MongoDB operator and application example with managed Minecraft
server and plugin applications, mirroring the lexfrei/cozylex catalog with
CRD fixes for minecraft-operator v2.3.3.

Changes

  • Remove MongoDB operator (packages/system/) and app (packages/apps/mongodb/)
  • Add minecraft-server app wrapping PaperMCServer CRD (RCON secret, backups, resource limits)
  • Add minecraft-plugin app wrapping Plugin CRD
  • Deploy minecraft-operator from oci://ghcr.io/lexfrei/charts via OCI HelmRepository
  • Register both apps as ApplicationDefinition CRDs for the Cozystack dashboard
  • Add usage example with a PaperMC server and BlueMap plugin

CRD update: Plugin portendpoints

The minecraft-operator v2.x replaced the spec.port field in the Plugin CRD with
spec.endpoints — an array of {name, port, protocol} objects supporting multiple
named endpoints with TCP/UDP/HTTP protocols. This PR uses the updated API, diverging
from the current cozylex which still uses the deprecated port field.

Test plan

  • Apply init.yaml to a Cozystack cluster
  • Verify both ApplicationDefinition resources appear in the dashboard
  • Create a MinecraftServer instance and verify StatefulSet is created
  • Create a MinecraftPlugin with endpoints and verify it attaches to the server

Summary by CodeRabbit

  • New Features

    • Added Minecraft Server application for managing PaperMC Minecraft servers with automatic updates and plugin management.
    • Added Minecraft Plugin application for extending Minecraft server functionality with plugin management and updates.
    • Added example manifests demonstrating Minecraft server and plugin deployment configuration.
  • Documentation

    • Updated README with installation instructions, available applications catalog, and end-to-end deployment examples.
  • Removals

    • Removed MongoDB application from the external-apps catalog.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 16, 2026

Warning

Rate limit exceeded

@lexfrei has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 10 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 22 minutes and 10 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4113f1be-c4d0-4920-9311-2fcd126674c6

📥 Commits

Reviewing files that changed from the base of the PR and between ba5c81d and af57171.

📒 Files selected for processing (3)
  • packages/core/platform/templates/cozyrds.yaml
  • packages/core/platform/templates/helmreleases.yaml
  • packages/core/platform/templates/helmrepositories.yaml
📝 Walkthrough

Walkthrough

Replaces MongoDB operator artifacts with new Minecraft operator artifacts: adds Helm charts for minecraft-server and minecraft-plugin, updates ApplicationDefinition CRDs and Flux resources to deploy them, removes MongoDB/operator charts and related templates/scripts, updates packaging CLI calls, and rewrites README and examples for Minecraft.

Changes

Cohort / File(s) Summary
Documentation
README.md
Rewritten to describe external-apps-example catalog, installation (init.yaml), available apps (minecraft-server, minecraft-plugin), example manifests, and repository layout.
Examples
examples/minecraft.yaml
New example manifest creating MinecraftServer (survival) and MinecraftPlugin (bluemap) resources with selectors/endpoints.
Minecraft Server Chart
packages/apps/minecraft-server/Chart.yaml, packages/apps/minecraft-server/Makefile, packages/apps/minecraft-server/values.yaml, packages/apps/minecraft-server/values.schema.json, packages/apps/minecraft-server/templates/papermcserver.yaml
Added complete PaperMC server Helm chart: values/schema, Makefile, templates to render Secret + PaperMCServer CR, resource/backup/update settings, and RCON password handling.
Minecraft Plugin Chart
packages/apps/minecraft-plugin/Chart.yaml, packages/apps/minecraft-plugin/Makefile, packages/apps/minecraft-plugin/values.yaml, packages/apps/minecraft-plugin/values.schema.json, packages/apps/minecraft-plugin/templates/plugin.yaml
Added plugin Helm chart: Hangar/URL source options, update/version controls, instance selector, and endpoints template.
Platform Definitions & Flux
packages/core/platform/templates/cozyrds.yaml, packages/core/platform/templates/helmcharts.yaml, packages/core/platform/templates/helmreleases.yaml, packages/core/platform/templates/namespaces.yaml, packages/core/platform/Chart.yaml
Replaced MongoDB ApplicationDefinition with minecraft-server, added minecraft-plugin ApplicationDefinition and UI keysOrder; added HelmChart entries for both charts; switched HelmRelease to use minecraft-operator OCI repo; namespace changed to external-minecraft-operator; bumped platform chart version.
MongoDB Removal
packages/apps/mongodb/*, packages/system/mongodb-operator/*
Removed MongoDB app/values/templates, community-operator charts, CRDs, RBAC, operator deployment templates, README, Makefiles, and related resources.
Flux / Init / Scripts
init.yaml, hack/update-crd.sh, scripts/package.mk
init.yaml changed GitRepository selection to reconcileStrategy: Revision; deleted hack/update-crd.sh; updated scripts/package.mk targets to call cozyhr instead of cozypkg.

Sequence Diagram(s)

sequenceDiagram
  participant Git as GitRepository
  participant Flux as Flux Controller
  participant HelmChart as HelmChart (cozy-public)
  participant HelmRepo as HelmRepository (OCI)
  participant HelmRel as HelmRelease
  participant K8s as Kubernetes
  Git->>Flux: repository changes (charts & platform templates)
  Flux->>HelmChart: reconcile local chart definitions
  Flux->>HelmRepo: reference OCI repo (minecraft-operator)
  Flux->>HelmRel: create/update HelmRelease (minecraft-operator)
  HelmRel->>K8s: install operator CRDs & Helm chart resources
  K8s->>K8s: register ApplicationDefinitions (MinecraftServer, MinecraftPlugin)
  Git->>K8s: example CRs applied (MinecraftServer, MinecraftPlugin)
  K8s->>K8s: Operator reconciles CRs -> create server & plugin workloads/endpoints
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

"I hopped from docs to YAML with glee,
Swapped data bowls for blocky sea,
Helm charts planted, operators wake,
Plugins dance by sea and lake,
A rabbit cheers — let servers be!" 🐇🎮

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: replacing MongoDB with Minecraft apps, aligning with the actual changeset which removes MongoDB files and adds minecraft-server/plugin packages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

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

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
Copy Markdown

Summary of Changes

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

This pull request updates the example repository to ensure compatibility with the Cozystack v1.1.x API. It modernizes the application definition and Helm chart referencing mechanisms, addressing breaking changes introduced in the new Cozystack version. These changes are crucial for the example repository to function correctly with the updated platform.

Highlights

  • API Update: Replaced the deprecated CozystackResourceDefinition with ApplicationDefinition to align with Cozystack v1.1.x API.
  • Chart Reference Mechanism: Switched from inline spec.release.chart with sourceRef to spec.release.chartRef which references a dedicated FluxCD HelmChart resource.
  • New HelmChart Definition: Introduced a new helmcharts.yaml file to define the HelmChart resource for the MongoDB application.
  • Reconciliation Strategy: Adopted reconcileStrategy: Revision for Git-sourced charts to ensure proper reconciliation, replacing the static version: '*'.

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

Changelog
  • init.yaml
    • Updated the version: '*' field to reconcileStrategy: Revision for the GitRepository source.
  • packages/core/platform/templates/cozyrds.yaml
    • Changed the kind from CozystackResourceDefinition to ApplicationDefinition.
    • Removed the namespace field from the metadata.
    • Replaced the spec.release.chart block with spec.release.chartRef pointing to a HelmChart resource.
  • packages/core/platform/templates/helmcharts.yaml
    • Added a new HelmChart resource definition named external-apps-mongodb in the cozy-public namespace, referencing the MongoDB chart from the external-apps GitRepository with reconcileStrategy: Revision.
  • packages/core/platform/templates/helmreleases.yaml
    • Updated the version: '*' field to reconcileStrategy: Revision for the GitRepository source.
Activity
  • No human activity has been recorded on this pull request yet.
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.

@lexfrei lexfrei marked this pull request as ready for review March 16, 2026 22:52
@lexfrei lexfrei self-assigned this Mar 16, 2026
Copy link
Copy Markdown

@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 updates the Kubernetes resource definitions to be compatible with Cozystack v1.1.x. The changes correctly replace the deprecated CozystackResourceDefinition with ApplicationDefinition, and update chart references to use chartRef with a corresponding HelmChart resource. The switch to reconcileStrategy: Revision is also a correct and necessary change for git-sourced charts. I've found one critical issue in the newly added helmcharts.yaml file where an incorrect API version is used, which would prevent the resources from being applied successfully. My review includes a suggestion to fix this.

@@ -0,0 +1,13 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

The apiVersion for a HelmChart resource is incorrect. For FluxCD, HelmChart resources use the API version source.toolkit.fluxcd.io/v1beta2. The version v1 is typically for GitRepository resources. Using the wrong apiVersion will cause this resource definition to be invalid and rejected by the Kubernetes API server.

apiVersion: source.toolkit.fluxcd.io/v1beta2

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The latest FluxCD releases use source.toolkit.fluxcd.io/v1 for HelmChart resources. The v1 API was promoted and is the current stable version (confirmed from Flux docs). Keeping v1.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (2)
packages/apps/minecraft-server/templates/papermcserver.yaml (1)

55-61: Consider: Resource requests equal limits may over-provision.

Setting requests equal to limits guarantees QoS class "Guaranteed" but may lead to resource over-provisioning. This is a valid deliberate choice for game servers requiring consistent performance, but worth noting if cluster resource efficiency is a concern.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/apps/minecraft-server/templates/papermcserver.yaml` around lines 55
- 61, The template currently sets resource requests equal to limits in the
resources block (memory and cpu), which can over-provision; update the Helm
values and template to allow separate request and limit settings (e.g., add
.Values.memoryRequest and .Values.cpuRequest and use them under
resources.requests while keeping .Values.memoryLimit and .Values.cpuLimit under
resources.limits), and default the request values to sensible lower values in
values.yaml or fallback to the limits only when explicit request values are
absent so operators can choose Guaranteed QoS or more efficient
BestEffort/Burstable behavior for the PapermcServer deployment.
packages/core/platform/templates/cozyrds.yaml (1)

11-11: These inline schema copies are already drifting.

packages/apps/minecraft-server/values.schema.json and the embedded server schema on Line 11 already disagree on the serviceType description, and the plugin definition now introduces a second hand-maintained copy. Consider generating openAPISchema from the chart schema—or storing both in a shared JSON source—so the dashboard and chart cannot silently diverge.

Also applies to: 67-67

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/platform/templates/cozyrds.yaml` at line 11, The openAPISchema
embedded in the template is a hand-maintained copy that has diverged from the
canonical values schema (the values.schema.json) — notably the serviceType
description — which risks silent drift; fix by centralizing the schema source:
extract the authoritative JSON schema into a single shared file and update the
template's openAPISchema value to be generated/copied from that shared schema
during build (or modify the template rendering step to inject the chart/schema
JSON), and update any plugin definitions to reference the same shared schema;
ensure fields like serviceType, updateStrategy, backupSchedule, etc. come from
that single source so both the dashboard and chart remain synchronized.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@examples/minecraft.yaml`:
- Around line 1-12: The manifest's MinecraftServer resource is using the wrong
apiVersion; update the apiVersion field for the MinecraftServer resource to the
Cozystack app API by replacing whatever value is present with
"apps.cozystack.io/v1alpha1" so it matches the registered ApplicationDefinition
for MinecraftServer (ensure the top-level kind remains MinecraftServer and other
spec fields like updateStrategy, storageSize, memoryLimit, cpuLimit, and
serviceType are unchanged).

In `@packages/apps/minecraft-server/templates/papermcserver.yaml`:
- Around line 16-61: The template for the PaperMCServer spec is missing storage
fields so UI values are ignored; update the PaperMCServer spec (inside the
podTemplate/spec area after the service block) to render .Values.storageSize and
.Values.storageClass by adding a conditional storage section that maps
.Values.storageSize to a size field and, if present, .Values.storageClass to
storageClassName (use the CRD's storage field names if they differ), ensuring
you wrap both in Helm quote filters and guard with {{- if .Values.storageSize }}
and {{- if .Values.storageClass }}.

In `@packages/apps/minecraft-server/values.schema.json`:
- Around line 5-15: The JSON Schema makes "version" optional even when
"updateStrategy" is "pin" or "build-pin": add a conditional (if/then) requiring
"version" and enforce minLength: 1 on the "version" property so empty string no
longer validates; update the same conditional rule embedded in the openAPISchema
inside the cozyrds template so both schema layers reject updateStrategy: "pin" /
"build-pin" without a non-empty version. Ensure the "version" property keeps
description and default behavior but gains "minLength": 1 and add an "if": {
"properties": { "updateStrategy": { "enum": ["pin","build-pin"] } } } / "then":
{ "required": ["version"] } conditional in both JSON places.

In `@packages/apps/minecraft-server/values.yaml`:
- Around line 19-20: Update the documentation comment for the cpuLimit parameter
so it matches the actual default value used by the configuration: change the
comment that currently says "cpuLimit=2" to reflect the default "cpuLimit=2000m"
(reference symbol: cpuLimit). Ensure the param docstring and any examples
consistently use "2000m" rather than "2".

In `@packages/core/platform/templates/cozyrds.yaml`:
- Line 67: The openAPISchema currently has no conditional validation for
sourceType and updateStrategy; add JSON Schema conditionals (using if/then or
oneOf) inside the top-level schema in openAPISchema to require non-empty values:
enforce that when property sourceType equals "hangar" then project is required
and has a non-empty string (minLength:1), when sourceType equals "url" then url
is required and minLength:1, and when updateStrategy is "pin" or "build-pin"
then version is required and minLength:1; update the openAPISchema string to
include these if/then blocks referencing the existing properties (sourceType,
project, url, updateStrategy, version) so the dashboard/API rejects invalid
combinations.

---

Nitpick comments:
In `@packages/apps/minecraft-server/templates/papermcserver.yaml`:
- Around line 55-61: The template currently sets resource requests equal to
limits in the resources block (memory and cpu), which can over-provision; update
the Helm values and template to allow separate request and limit settings (e.g.,
add .Values.memoryRequest and .Values.cpuRequest and use them under
resources.requests while keeping .Values.memoryLimit and .Values.cpuLimit under
resources.limits), and default the request values to sensible lower values in
values.yaml or fallback to the limits only when explicit request values are
absent so operators can choose Guaranteed QoS or more efficient
BestEffort/Burstable behavior for the PapermcServer deployment.

In `@packages/core/platform/templates/cozyrds.yaml`:
- Line 11: The openAPISchema embedded in the template is a hand-maintained copy
that has diverged from the canonical values schema (the values.schema.json) —
notably the serviceType description — which risks silent drift; fix by
centralizing the schema source: extract the authoritative JSON schema into a
single shared file and update the template's openAPISchema value to be
generated/copied from that shared schema during build (or modify the template
rendering step to inject the chart/schema JSON), and update any plugin
definitions to reference the same shared schema; ensure fields like serviceType,
updateStrategy, backupSchedule, etc. come from that single source so both the
dashboard and chart remain synchronized.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9fbc93d8-dcd0-49e1-b14b-d03aa6d7e0d6

📥 Commits

Reviewing files that changed from the base of the PR and between 0eb275c and 7f5d2d7.

⛔ Files ignored due to path filters (1)
  • packages/system/mongodb-operator/charts/community-operator/Chart.lock is excluded by !**/*.lock
📒 Files selected for processing (41)
  • README.md
  • examples/minecraft.yaml
  • hack/update-crd.sh
  • init.yaml
  • packages/apps/.gitkeep
  • packages/apps/minecraft-plugin/Chart.yaml
  • packages/apps/minecraft-plugin/Makefile
  • packages/apps/minecraft-plugin/templates/plugin.yaml
  • packages/apps/minecraft-plugin/values.schema.json
  • packages/apps/minecraft-plugin/values.yaml
  • packages/apps/minecraft-server/Chart.yaml
  • packages/apps/minecraft-server/Makefile
  • packages/apps/minecraft-server/templates/papermcserver.yaml
  • packages/apps/minecraft-server/values.schema.json
  • packages/apps/minecraft-server/values.yaml
  • packages/apps/mongodb/.helmignore
  • packages/apps/mongodb/Chart.yaml
  • packages/apps/mongodb/Makefile
  • packages/apps/mongodb/README.md
  • packages/apps/mongodb/templates/monga.yaml
  • packages/apps/mongodb/values.schema.json
  • packages/apps/mongodb/values.yaml
  • packages/core/platform/Chart.yaml
  • packages/core/platform/templates/cozyrds.yaml
  • packages/core/platform/templates/helmcharts.yaml
  • packages/core/platform/templates/helmreleases.yaml
  • packages/core/platform/templates/namespaces.yaml
  • packages/system/mongodb-operator/Chart.yaml
  • packages/system/mongodb-operator/Makefile
  • packages/system/mongodb-operator/charts/community-operator/Chart.yaml
  • packages/system/mongodb-operator/charts/community-operator/README.md
  • packages/system/mongodb-operator/charts/community-operator/charts/community-operator-crds/.helmignore
  • packages/system/mongodb-operator/charts/community-operator/charts/community-operator-crds/Chart.yaml
  • packages/system/mongodb-operator/charts/community-operator/charts/community-operator-crds/templates/mongodbcommunity.mongodb.com_mongodbcommunity.yaml
  • packages/system/mongodb-operator/charts/community-operator/charts/community-operator-crds/values.yaml
  • packages/system/mongodb-operator/charts/community-operator/templates/database_roles.yaml
  • packages/system/mongodb-operator/charts/community-operator/templates/mongodbcommunity_cr_with_tls.yaml
  • packages/system/mongodb-operator/charts/community-operator/templates/operator.yaml
  • packages/system/mongodb-operator/charts/community-operator/templates/operator_roles.yaml
  • packages/system/mongodb-operator/charts/community-operator/values.yaml
  • scripts/package.mk
💤 Files with no reviewable changes (20)
  • packages/apps/mongodb/.helmignore
  • packages/system/mongodb-operator/charts/community-operator/charts/community-operator-crds/.helmignore
  • packages/apps/mongodb/Makefile
  • packages/apps/mongodb/values.yaml
  • packages/system/mongodb-operator/Chart.yaml
  • packages/system/mongodb-operator/charts/community-operator/charts/community-operator-crds/Chart.yaml
  • packages/system/mongodb-operator/charts/community-operator/templates/database_roles.yaml
  • packages/system/mongodb-operator/charts/community-operator/README.md
  • packages/apps/mongodb/templates/monga.yaml
  • packages/system/mongodb-operator/charts/community-operator/values.yaml
  • packages/apps/mongodb/values.schema.json
  • packages/system/mongodb-operator/charts/community-operator/Chart.yaml
  • packages/system/mongodb-operator/charts/community-operator/templates/operator_roles.yaml
  • packages/system/mongodb-operator/Makefile
  • hack/update-crd.sh
  • packages/system/mongodb-operator/charts/community-operator/templates/operator.yaml
  • packages/apps/mongodb/README.md
  • packages/system/mongodb-operator/charts/community-operator/charts/community-operator-crds/templates/mongodbcommunity.mongodb.com_mongodbcommunity.yaml
  • packages/apps/mongodb/Chart.yaml
  • packages/system/mongodb-operator/charts/community-operator/templates/mongodbcommunity_cr_with_tls.yaml

Comment thread examples/minecraft.yaml
Comment thread packages/apps/minecraft-server/templates/papermcserver.yaml
Comment thread packages/apps/minecraft-server/values.schema.json
Comment thread packages/apps/minecraft-server/values.yaml Outdated
Comment thread packages/core/platform/templates/cozyrds.yaml Outdated
@lexfrei lexfrei changed the title fix: update to ApplicationDefinition API with chartRef feat: replace MongoDB example with Minecraft apps from cozylex Apr 8, 2026
@lexfrei
Copy link
Copy Markdown
Contributor Author

lexfrei commented Apr 13, 2026

Nitpicks

Resource requests == limits (Guaranteed QoS) in papermcserver.yaml

Intentional. Minecraft servers are highly latency-sensitive and do not handle CPU throttling gracefully (tick lag, dropped players). Guaranteed QoS is the right default for this workload. Users who need Burstable QoS can fork and adjust. Declining this change.

Schema drift between values.schema.json and embedded openAPISchema

Synchronized the serviceType description in both places. Agree a schema generator would be better long-term (the repo previously had hack/update-crd.sh doing something similar), but that is out of scope for this PR. Filing as a known trade-off for now.

Replace the MongoDB operator and application example with managed Minecraft
server and plugin applications, mirroring the lexfrei/cozylex catalog with
CRD fixes for minecraft-operator v2.3.3 and Cozystack ApplicationDefinition
API updates.

Platform

- Migrate from CozystackResourceDefinition to ApplicationDefinition
  (Cozystack v1.1.x) with chartRef referencing FluxCD HelmChart resources.
- Add HelmCharts for both Minecraft apps sourced from this Git repository.
- Use reconcileStrategy: Revision so git-sourced charts with static
  version 0.0.0 are actually reconciled on content changes.
- Deploy minecraft-operator from oci://ghcr.io/lexfrei/charts via an OCI
  HelmRepository in namespace external-minecraft-operator.

Minecraft server (apps/minecraft-server)

- Wraps the PaperMCServer CRD with RCON secret, backups, resource limits,
  service type, and update schedule.
- Resource requests equal limits by design (Guaranteed QoS) because
  Minecraft is latency-sensitive and does not handle CPU throttling
  gracefully.

Minecraft plugin (apps/minecraft-plugin)

- Wraps the Plugin CRD with source selection (hangar/url), update
  strategy, instance selector, and endpoints.
- Uses spec.endpoints (array of {name, port, protocol}) to match the
  current operator API; the legacy spec.port field was removed in
  minecraft-operator v2.x.

Schema validation

- values.schema.json uses allOf/if/then rules to require non-empty
  project for sourceType=hangar, non-empty url for sourceType=url, and
  non-empty version for updateStrategy=pin/build-pin. Helm validates
  these at install time (JSON Schema draft-07).
- ApplicationDefinition openAPISchema intentionally omits if/then rules
  because Kubernetes apiextensions/v1 JSONSchemaProps has no If/Then/Else
  fields — those keywords are silently dropped during unmarshal. No
  official Cozystack ApplicationDefinition uses conditional validation;
  defaults and enums are applied at the Cozystack API layer.
- sourceType has no default in the chart so that `helm lint` passes
  without overrides (a default of hangar would conflict with the
  non-empty project requirement). The Cozystack dashboard still pre-fills
  sourceType via applyDefaults from the openAPISchema default.
- Storage size and class are not exposed: PaperMCServer CRD has no
  storage field and the operator hardcodes VolumeClaimTemplates to 10Gi
  ReadWriteOnce in buildVolumeClaimTemplates.

Other

- Update scripts/package.mk to use cozyhr.
- Replace README with app catalog documentation.
- Add examples/minecraft.yaml with a PaperMC server and BlueMap plugin.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
@lexfrei lexfrei force-pushed the fix/update-to-applicationdefinition-api branch from 7f5d2d7 to ba5c81d Compare April 13, 2026 11:01
lexfrei added a commit to Begonia-UC3/ieee9-bus that referenced this pull request Apr 14, 2026
Replace standalone OCI-published Helm chart with the Cozystack
external-app packaging pattern from cozystack/external-apps-example#2.

Changes:
- Drop charts/ieee9-grid (no longer OCI-published; Flux pulls from
  this repo's GitRepository).
- packages/apps/ieee9-grid now renders the four Deployments, Services
  and optional Ingress directly, driven by a small user-facing schema
  (imageTag, replicas, ingressEnabled, ingressHost, ingressClassName).
- packages/core/platform registers the Ieee9Grid ApplicationDefinition
  (with openAPISchema + dashboard metadata) and a HelmChart source
  pointing at packages/apps/ieee9-grid in the GitRepository.
- init.yaml provisions the GitRepository + HelmRelease that bootstraps
  the platform chart.
- Chart CI now only lints and templates both charts (and validates
  init.yaml) — chart OCI publishing is retired.
- README documents the 'kubectl apply -f init.yaml' flow and the
  Ieee9Grid CR example.

Signed-off-by: Aleksei Sviridkin <f@lex.la>
lexfrei added a commit to Begonia-UC3/ieee9-bus that referenced this pull request Apr 14, 2026
Replace standalone OCI-published Helm chart with the Cozystack
external-app packaging pattern from cozystack/external-apps-example#2.

Changes:
- Drop charts/ieee9-grid (no longer OCI-published; Flux pulls from
  this repo's GitRepository).
- packages/apps/ieee9-grid now renders the four Deployments, Services
  and optional Ingress directly, driven by a small user-facing schema
  (imageTag, replicas, ingressEnabled, ingressHost, ingressClassName).
- packages/core/platform registers the Ieee9Grid ApplicationDefinition
  (with openAPISchema + dashboard metadata) and a HelmChart source
  pointing at packages/apps/ieee9-grid in the GitRepository.
- init.yaml provisions the GitRepository + HelmRelease that bootstraps
  the platform chart.
- Chart CI now only lints and templates both charts (and validates
  init.yaml) — chart OCI publishing is retired.
- README documents the 'kubectl apply -f init.yaml' flow and the
  Ieee9Grid CR example.

Signed-off-by: Aleksei Sviridkin <f@lex.la>
Copy link
Copy Markdown

@kitsunoff kitsunoff left a comment

Choose a reason for hiding this comment

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

Tested on a Cozystack cluster

Applied a modified init.yaml pointing to the fork branch. Everything deploys and reconciles correctly:

  • GitRepository and HelmRelease for the platform chart — both Ready: True
  • Both ApplicationDefinition resources created (minecraft-server, minecraft-plugin)
  • HelmCharts packaged from GitRepository — Ready: True
  • minecraft-operator installed from OCI registry (v2.3.3), pod running
  • Created a MinecraftServer instance — Helm install succeeded, StatefulSet + PVC + Service + RCON Secret created
  • Created a MinecraftPlugin instance with endpoints — Helm install succeeded, Plugin CR created

Functionally the PR works as expected.


Issues found

1. singular field contains hyphens (convention violation)

The main Cozystack repo consistently strips hyphens from metadata.name when setting singular/plural:

name singular (upstream convention) singular (this PR)
tcp-balancer tcpbalancer
vm-instance vminstance
minecraft-server minecraftserver minecraft-server
minecraft-plugin minecraftplugin minecraft-plugin

Kubernetes actually normalizes this anyway (kubectl api-resources shows minecraftservers), so the declared value doesn't match what the API actually uses. Should be minecraftserver and minecraftplugin.

2. prefix doesn't follow the convention

Upstream convention: prefix = <metadata.name>-

name expected prefix actual prefix
minecraft-server minecraft-server- minecraft-
minecraft-plugin minecraft-plugin- mcplugin-

minecraft- is truncated, mcplugin- is an arbitrary abbreviation. Both should match metadata.name with a trailing hyphen.

3. No icons

All ApplicationDefinitions in the main Cozystack repo provide a dashboard.icon (base64-encoded SVG). Both apps in this PR are missing icons and will appear without them in the dashboard.

4. openAPISchema title

Upstream convention uses "title":"Chart Values" consistently. This PR uses custom titles ("Minecraft Server", "Minecraft Plugin"). Minor, but worth aligning.

5. Minor: HelmRepository in helmreleases.yaml

packages/core/platform/templates/helmreleases.yaml now contains both a HelmRepository (source) and a HelmRelease. The main Cozystack repo doesn't have a direct analogue (it uses ExternalArtifact instead of HelmRepository), but the general pattern there is one resource type per file. Consider splitting into a separate helmrepositories.yaml for clarity — not blocking though.

lexfrei added 2 commits April 14, 2026 17:33
Address review feedback from @kitsunoff on cozyrds.yaml:
- Strip hyphens from singular/plural: minecraftserver/minecraftservers and
  minecraftplugin/minecraftplugins (matches tcp-balancer → tcpbalancer and
  vm-instance → vminstance convention in the main cozystack repo).
- Set prefix to <metadata.name>-: minecraft-server- and minecraft-plugin-
  (was truncated minecraft- and arbitrary mcplugin-).
- Add dashboard icons (base64-encoded SVG) so both apps render with icons
  in the Cozystack dashboard like every other upstream ApplicationDefinition.
- Rename openAPISchema title to 'Chart Values' to match upstream.

Verified against postgres, kafka, mongodb, clickhouse, nats, mariadb,
tcp-balancer, vm-instance, and virtualprivatecloud ApplicationDefinitions
in cozystack/cozystack main.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
Address review feedback from @kitsunoff: one resource kind per template
file, matching the general pattern in cozystack/cozystack main. Move
the minecraft-operator HelmRepository from helmreleases.yaml into a
new helmrepositories.yaml; helmreleases.yaml now contains only the
HelmRelease.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
@lexfrei
Copy link
Copy Markdown
Contributor Author

lexfrei commented Apr 14, 2026

@kitsunoff thanks for the thorough testing on a live cluster and the cross-check against upstream conventions. All five points addressed:

1. singular/plural without hyphens (f4e01b4) — now minecraftserver/minecraftservers and minecraftplugin/minecraftplugins, matching the tcp-balancer → tcpbalancer and vm-instance → vminstance convention in cozystack/cozystack main.

2. prefix matches <metadata.name>- (f4e01b4) — minecraft-server- and minecraft-plugin-. Verified on a test cluster: creating a MinecraftServer named testverify produced a HelmRelease named minecraft-server-testverify.

3. Dashboard icons (f4e01b4) — added base64-encoded SVGs (isometric grass block for the server, puzzle piece for the plugin). Simple originals, not the real Minecraft/Mojang marks, so no trademark concerns.

4. openAPISchema title (f4e01b4) — now "Chart Values" in both definitions.

5. Splitting HelmRepository into its own file (af57171) — moved into a new helmrepositories.yaml; helmreleases.yaml now contains only the HelmRelease. One resource kind per template file.

All changes verified with helm lint, helm template, and server-side dry-run against a Cozystack cluster.

@kitsunoff kitsunoff self-requested a review April 14, 2026 18:24
Copy link
Copy Markdown

@kitsunoff kitsunoff left a comment

Choose a reason for hiding this comment

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

All issues from the previous review have been addressed. LGTM.

@lexfrei lexfrei merged commit 990ec8d into cozystack:main Apr 14, 2026
2 checks passed
kitsunoff added a commit to cozystack/website that referenced this pull request Apr 15, 2026
## Summary

Rewrite the external applications guide to reflect the current API and
conventions:

- Replace outdated `CozystackResourceDefinition` references with
`ApplicationDefinition`
- Document the full platform chart structure (namespaces, HelmCharts,
operator deployment, ApplicationDefinitions)
- Add naming conventions table matching the main Cozystack repository
- Document application chart structure and Makefile conventions
- Update bootstrap manifest to use `reconcileStrategy: Revision`

## Context

The previous guide only covered creating a GitRepository + HelmRelease
and pointed to the example repo for everything else. The rewrite
provides a self-contained reference for building external application
packages, based on conventions from the main Cozystack repository and
the updated
[external-apps-example](cozystack/external-apps-example#2).

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

## Summary by CodeRabbit

* **Documentation**
* Updated external application package repository structure and setup
guidelines.
* Enhanced deployment instructions with improved FluxCD configuration
and reconciliation strategy details.
* Added comprehensive chart authoring instructions and
ApplicationDefinition examples.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants