You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(external-apps): rewrite guide for ApplicationDefinition API (#488)
## 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 -->
@@ -5,35 +5,201 @@ description: "Learn how to add managed applications from external sources"
5
5
weight: 5
6
6
---
7
7
8
-
Since v0.37.0, Cozystack administrators can add applications from external sources in addition to the standard application catalog.
9
-
These applications will appear in the same application catalog and behave like regular managed applications for platform users.
8
+
Cozystack administrators can add applications from external sources in addition to the standard application catalog.
9
+
These applications appear in the same catalog and behave like regular managed applications for platform users.
10
10
11
-
This guide explains how to define a managed application package and how to add it to Cozystack.
11
+
This guide explains the structure of an external application package and how to add it to a Cozystack cluster.
12
12
13
+
For a complete working example, see [github.com/cozystack/external-apps-example](https://github.com/cozystack/external-apps-example).
13
14
14
-
## 1. Create an Application Package Repository
15
+
Just like standard Cozystack applications, this external application package uses Helm and FluxCD.
16
+
To learn more about developing application packages, read the Cozystack [Developer Guide]({{% ref "/docs/v1.2/development" %}}).
15
17
16
-
Create a repository with the application package sources.
17
-
For a reference, see [github.com/cozystack/external-apps-example](https://github.com/cozystack/external-apps-example).
18
+
## Repository Structure
18
19
19
-
Application repository has the following structure:
20
+
An external application repository has the following layout:
20
21
21
-
-`./packages/core`: Manifests for the platform configuration and to deploy system applications.
22
-
-`./packages/system`: Helm charts for system applications.
23
-
-`./packages/apps`: Helm charts for applications that can be installed from the dashboard.
apps/<app-name>/ # Helm chart for each user-installable application
29
+
```
24
30
25
-
Just like standard Cozystack applications, this external application package is using Helm and FluxCD.
26
-
To learn more about developing application packages, read Cozystack [Developer Guide]({{% ref "/docs/v1.2/development" %}})
31
+
-`packages/core/platform` — a Helm chart deployed by FluxCD. It registers all applications via `ApplicationDefinition` CRDs, creates required namespaces, deploys operators, and defines `HelmChart` resources that point to the app charts in the same Git repository.
32
+
-`packages/apps/<app-name>` — standard Helm charts that template the actual Kubernetes resources (CRDs, ConfigMaps, Secrets, etc.).
27
33
28
-
These FluxCD documents will help you understand the resources used in this guide:
34
+
## Platform Chart
35
+
36
+
The platform chart (`packages/core/platform/`) is the central piece. It contains templates for:
37
+
38
+
### Namespaces
39
+
40
+
Create namespaces for operators and system components:
41
+
42
+
```yaml
43
+
apiVersion: v1
44
+
kind: Namespace
45
+
metadata:
46
+
labels:
47
+
cozystack.io/system: "true"
48
+
name: external-<operator-name>
49
+
```
50
+
51
+
### HelmCharts
52
+
53
+
Define `HelmChart` resources that tell FluxCD where to find each app chart within the Git repository:
54
+
55
+
```yaml
56
+
apiVersion: source.toolkit.fluxcd.io/v1
57
+
kind: HelmChart
58
+
metadata:
59
+
name: external-apps-<app-name>
60
+
namespace: cozy-public
61
+
spec:
62
+
interval: 5m
63
+
chart: ./packages/apps/<app-name>
64
+
sourceRef:
65
+
kind: GitRepository
66
+
name: external-apps
67
+
reconcileStrategy: Revision
68
+
```
69
+
70
+
Use `reconcileStrategy: Revision` so that charts with a static `version: 0.0.0` are re-reconciled whenever the Git content changes.
71
+
72
+
### Operator Deployment
73
+
74
+
If your application requires an operator, deploy it via a `HelmRepository` and `HelmRelease`:
| `openAPISchema` title | always `"Chart Values"` | — |
157
+
158
+
The `openAPISchema` field contains a single-line JSON string with the schema for the application values. It intentionally omits `if`/`then`/`else` conditional rules because Kubernetes `apiextensions/v1` `JSONSchemaProps` does not support these keywords. Use conditional validation only in the Helm chart's `values.schema.json`.
159
+
160
+
## Application Charts
161
+
162
+
Each application chart in `packages/apps/<app-name>/` is a standard Helm chart:
163
+
164
+
```text
165
+
packages/apps/<app-name>/
166
+
Chart.yaml
167
+
Makefile
168
+
values.yaml
169
+
values.schema.json
170
+
templates/
171
+
<resource>.yaml
172
+
```
173
+
174
+
### Chart.yaml
175
+
176
+
```yaml
177
+
apiVersion: v2
178
+
name: <app-name>
179
+
description: <Short description>
180
+
type: application
181
+
version: 0.0.0
182
+
appVersion: "1.0.0"
183
+
```
184
+
185
+
Use `version: 0.0.0` — the actual version is derived from the Git revision by FluxCD.
186
+
187
+
### Makefile
188
+
189
+
```makefile
190
+
export NAME=<app-name>
191
+
export NAMESPACE=external-<operator-name>
192
+
193
+
include ../../../scripts/package.mk
194
+
```
195
+
196
+
### values.schema.json
197
+
198
+
Define the JSON Schema (draft-07) for the application values. This schema is used by Helm for validation at install time and can include conditional rules (`if`/`then`/`else`) that are not supported at the `ApplicationDefinition` level.
199
+
200
+
## Bootstrap Manifest
201
+
202
+
The `init.yaml` file creates two FluxCD resources that bootstrap the entire catalog:
0 commit comments