Skip to content

Commit dd959bd

Browse files
authored
Merge pull request #2 from forkspacer/feature/new-upd
upd to module crds: configmaps and ref releases
2 parents 72ba5f1 + 03b3014 commit dd959bd

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed

src/content/docs/reference/CRDs/module.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ The `source` field specifies where the resource definition should be loaded from
9191
| Field | Type | Description | Required |
9292
|-------|------|-------------|----------|
9393
| `raw` | object | Raw resource definition embedded directly in the Module resource. | No |
94+
| `configMap` | object | Reference to a ConfigMap containing the resource definition. See [ConfigMapSource](#configmapsource). | No |
9495
| `httpURL` | string | HTTP/HTTPS URL pointing to a resource definition YAML file. | No |
96+
| `existingHelmRelease` | object | Reference to an existing Helm release to adopt and track. See [ExistingHelmReleaseSource](#existinghelmreleasesource). | No |
9597

9698
**Resource Definition Types:**
9799

@@ -127,6 +129,68 @@ spec:
127129
version: 15.0.0
128130
```
129131

132+
**Example - ConfigMap Source:**
133+
134+
```yaml
135+
spec:
136+
source:
137+
configMap:
138+
name: redis-module-definition
139+
namespace: default
140+
```
141+
142+
**Example - Existing Helm Release:**
143+
144+
```yaml
145+
spec:
146+
source:
147+
existingHelmRelease:
148+
name: redis
149+
namespace: default
150+
```
151+
152+
#### ConfigMapSource
153+
154+
The `configMap` source type references a Kubernetes ConfigMap that contains the resource definition.
155+
156+
| Field | Type | Description | Required |
157+
|-------|------|-------------|----------|
158+
| `name` | string | Name of the ConfigMap. | Yes |
159+
| `namespace` | string | Namespace of the ConfigMap. | No (defaults to Module's namespace) |
160+
161+
The ConfigMap must contain a key named `module.yaml` with the resource definition as its value:
162+
163+
```yaml
164+
apiVersion: v1
165+
kind: ConfigMap
166+
metadata:
167+
name: redis-module-definition
168+
namespace: default
169+
data:
170+
module.yaml: |
171+
kind: Helm
172+
metadata:
173+
name: redis
174+
version: "1.0.0"
175+
supportedOperatorVersion: ">= 0.0.0, < 1.0.0"
176+
spec:
177+
namespace: default
178+
repo: https://charts.bitnami.com/bitnami
179+
chartName: redis
180+
version: 21.2.9
181+
```
182+
183+
#### ExistingHelmReleaseSource
184+
185+
The `existingHelmRelease` source type allows you to adopt and track existing Helm releases without reinstalling them. This is useful when you have pre-existing Helm releases in your cluster and want to manage them through Forkspacer without disruption.
186+
187+
| Field | Type | Description | Required |
188+
|-------|------|-------------|----------|
189+
| `name` | string | Name of the existing Helm release. | Yes |
190+
| `namespace` | string | Namespace where the Helm release is installed. | No (defaults to `default`) |
191+
192+
**Important:** When a Module with an adopted Helm release is deleted, the underlying Helm release is **not** uninstalled. The Module only detaches from the release, leaving it running in the cluster.
193+
130194
### WorkspaceReference
131195

132196
The `workspace` field references the target workspace where the module will be deployed.
@@ -294,6 +358,65 @@ spec:
294358
hibernated: true
295359
```
296360

361+
### Installing a Module from ConfigMap
362+
363+
```yaml
364+
# First, create the ConfigMap with the module definition
365+
apiVersion: v1
366+
kind: ConfigMap
367+
metadata:
368+
name: postgresql-module
369+
namespace: default
370+
data:
371+
module.yaml: |
372+
kind: Helm
373+
metadata:
374+
name: postgresql
375+
version: "1.0.0"
376+
supportedOperatorVersion: ">= 0.0.0, < 1.0.0"
377+
spec:
378+
namespace: default
379+
repo: https://charts.bitnami.com/bitnami
380+
chartName: postgresql
381+
version: 12.0.0
382+
383+
---
384+
# Then, create the Module referencing the ConfigMap
385+
apiVersion: batch.forkspacer.com/v1
386+
kind: Module
387+
metadata:
388+
name: postgresql
389+
namespace: default
390+
spec:
391+
workspace:
392+
name: dev-environment
393+
source:
394+
configMap:
395+
name: postgresql-module
396+
namespace: default
397+
config:
398+
storageSize: "10Gi"
399+
```
400+
401+
### Adopting an Existing Helm Release
402+
403+
```yaml
404+
apiVersion: batch.forkspacer.com/v1
405+
kind: Module
406+
metadata:
407+
name: existing-redis
408+
namespace: default
409+
spec:
410+
workspace:
411+
name: production-workspace
412+
source:
413+
existingHelmRelease:
414+
name: redis
415+
namespace: default
416+
```
417+
418+
This Module will track the existing `redis` Helm release without reinstalling it. When the Module is deleted, the Helm release will remain running in the cluster.
419+
297420
## Module Lifecycle
298421

299422
1. **Installation**: When a Module is created, the operator fetches the resource definition from the specified source and processes it based on its kind (Helm or Custom).

0 commit comments

Comments
 (0)