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
| `namespace` | string | Target Kubernetes namespace for the Helm release. Supports templating. | Yes |
260
+
| `releaseName` | string | Custom Helm release name (DNS-1035 compliant). Auto-generated if not specified. **Immutable after creation.** See [Release Names](#release-names). | No |
260
261
| `existingRelease` | object | Reference to an existing Helm release to adopt. See [ExistingRelease](#existingrelease). | No |
261
262
| `values` | array | Array of value sources (raw, file, configMap). | No |
262
263
| `outputs` | array | Output values to expose after installation. | No |
@@ -345,6 +346,44 @@ spec:
345
346
| `namespace` | string | Namespace of the ConfigMap | No (default: `default`) |
346
347
| `key` | string | Key containing the chart archive (`.tgz` file) | No (default: `chart.tgz`) |
347
348
349
+
### Release Names
350
+
351
+
The `releaseName` field allows you to specify a custom name for the Helm release. If not specified, Forkspacer automatically generates a unique release name.
352
+
353
+
**Auto-generated Release Names:**
354
+
355
+
When `releaseName` is not provided, the operator automatically generates a unique release name using the format:
356
+
357
+
```
358
+
<namespace>-<11-character-uuid>
359
+
```
360
+
361
+
For example: `default-a1b2c3d4e5f`
362
+
363
+
**Custom Release Names:**
364
+
365
+
You can specify a custom release name that must comply with DNS-1035 label standards:
366
+
- Start with a lowercase letter
367
+
- Contain only lowercase letters, numbers, and hyphens
368
+
- End with a lowercase letter or number
369
+
- Be 63 characters or less
370
+
371
+
```yaml
372
+
spec:
373
+
helm:
374
+
releaseName: my-custom-release
375
+
chart:
376
+
repo:
377
+
url: https://charts.bitnami.com/bitnami
378
+
chart: redis
379
+
namespace: default
380
+
```
381
+
382
+
**Important Notes:**
383
+
- The `releaseName` field is **immutable** after the Module is created
384
+
- Once set (either automatically or manually), it cannot be changed
385
+
- When adopting an existing release with `existingRelease`, the release name comes from `existingRelease.name` instead
386
+
348
387
### ExistingRelease
349
388
350
389
The `existingRelease` field allows you to adopt and track existing Helm releases without reinstalling them.
@@ -590,6 +629,37 @@ spec:
590
629
name: dev-environment
591
630
```
592
631
632
+
### Helm Module with Custom Release Name
633
+
634
+
```yaml
635
+
apiVersion: batch.forkspacer.com/v1
636
+
kind: Module
637
+
metadata:
638
+
name: my-redis
639
+
namespace: default
640
+
641
+
spec:
642
+
helm:
643
+
releaseName: prod-redis-primary # Custom release name
644
+
645
+
chart:
646
+
repo:
647
+
url: https://charts.bitnami.com/bitnami
648
+
chart: redis
649
+
version: "21.2.9"
650
+
651
+
namespace: default
652
+
653
+
values:
654
+
- raw:
655
+
fullnameOverride: "{{.releaseName}}" # Uses the custom name
656
+
657
+
workspace:
658
+
name: production-workspace
659
+
```
660
+
661
+
This Module uses a custom release name instead of the auto-generated one. The `releaseName` is immutable after creation.
662
+
593
663
### Adopting an Existing Helm Release
594
664
595
665
```yaml
@@ -617,7 +687,7 @@ spec:
617
687
name: production-workspace
618
688
```
619
689
620
-
This Module will track the existing `redis` Helm release without reinstalling it.
690
+
This Module will track the existing `redis` Helm release without reinstalling it. When `existingRelease` is set, the release name comes from `existingRelease.name`.
621
691
622
692
### Custom Module
623
693
@@ -698,7 +768,7 @@ The Module CRD supports powerful Go template rendering for both Helm and Custom
698
768
When a Module is processed, the operator:
699
769
700
770
1. **Validates Configuration**: Validates user-provided `spec.config` values against the `config` schema
701
-
2. **Generates Release Name** (Helm only): Creates or retrieves a unique Helm release name (format: `<namespace>-<module-name>`)
771
+
2. **Determines Release Name** (Helm only): Uses the configured `releaseName` if provided, or the auto-generated unique name (format: `<namespace>-<11-char-uuid>`). For adopted releases, uses `existingRelease.name`.
702
772
3. **Renders Namespace** (Helm only): Renders the namespace field first with available context
703
773
4. **Renders Spec**: Recursively processes the entire spec, replacing template expressions with actual values
704
774
5. **Type Preservation**: Automatically converts numeric and boolean strings to their proper types
@@ -710,7 +780,7 @@ When a Module is processed, the operator:
- **`.releaseName`**: Generated Helm release name (e.g., `default-redis`)
783
+
- **`.releaseName`**: The Helm release name - either custom-specified via `releaseName` field, auto-generated (e.g., `default-a1b2c3d4e5f`), or from `existingRelease.name` for adopted releases
714
784
- **`.namespace`**: Rendered namespace value (available in all fields except namespace itself)
In addition to Go's standard template functions (like `default`, `eq`, `gt`, `mul`, etc.), Forkspacer provides custom functions for common use cases.
824
+
825
+
#### randBase62
826
+
827
+
Generates a random string using base62 characters (0-9, A-Z, a-z). Useful for creating unique identifiers, passwords, or tokens.
828
+
829
+
**Syntax:**
830
+
```yaml
831
+
{{ randBase62 <length> }}
832
+
```
833
+
834
+
**Parameters:**
835
+
- `length` (integer): The number of characters to generate
836
+
837
+
**Example:**
838
+
```yaml
839
+
spec:
840
+
helm:
841
+
values:
842
+
- raw:
843
+
# Generate a 16-character random API key
844
+
apiKey: "{{ randBase62 16 }}"
845
+
846
+
# Generate a 32-character random token
847
+
token: "{{ randBase62 32 }}"
848
+
849
+
# Generate a short random suffix
850
+
instanceId: "app-{{ randBase62 8 }}"
851
+
```
852
+
853
+
**Output examples:**
854
+
```yaml
855
+
apiKey: "aB3dE5fG7hJ9kL2m"
856
+
token: "xY1zA2bC3dE4fG5hI6jK7lM8nO9pQ0rS"
857
+
instanceId: "app-xY7zA2bC"
858
+
```
859
+
860
+
**Note:** Each time the template is rendered, a new random value is generated. If you need consistent values across updates, use configuration values instead of `randBase62`.
861
+
751
862
### Type Preservation
752
863
753
864
The rendering engine automatically preserves types:
@@ -855,11 +966,11 @@ helm:
855
966
readReplicas: 2 # Type preserved as integer
856
967
persistence:
857
968
size: "50Gi"
858
-
fullnameOverride: "default-postgresql-db"
969
+
fullnameOverride: "default-a1b2c3d4e5f-db" # Using auto-generated releaseName
value: "default-a1b2c3d4e5f-postgresql.production-database.svc.cluster.local" # Using auto-generated releaseName
863
974
```
864
975
865
976
#### Custom Module with Templating
@@ -927,7 +1038,11 @@ spec:
927
1038
host: "app.{{.namespace}}.example.com"
928
1039
```
929
1040
930
-
### GetNamespace() Method
1041
+
### Effective Namespace and Release Name
1042
+
1043
+
When working with Helm modules, especially with adopted releases, Forkspacer uses helper methods to determine the effective namespace and release name.
1044
+
1045
+
#### GetNamespace() Method
931
1046
932
1047
When `existingRelease` is specified, the effective namespace is determined by `GetNamespace()`:
933
1048
@@ -936,6 +1051,15 @@ When `existingRelease` is specified, the effective namespace is determined by `G
936
1051
937
1052
This ensures proper namespace handling for adopted Helm releases.
938
1053
1054
+
#### GetReleaseName() Method
1055
+
1056
+
The effective release name is determined by `GetReleaseName()`:
1057
+
1058
+
- If `existingRelease` is set: returns `existingRelease.name` (for adopted releases)
1059
+
- Otherwise: returns `helm.releaseName` (either custom or auto-generated)
1060
+
1061
+
This ensures that templates always have access to the correct release name through `.releaseName`, regardless of whether the release is newly created or adopted.
1062
+
939
1063
### Best Practices for Templating
940
1064
941
1065
1. **Always quote template expressions**: Use `"{{.config.value}}"` to ensure valid YAML
0 commit comments