Skip to content

Module

The Module resource represents an installable component or application that can be deployed into a Workspace. Modules reference resource definitions (Helm charts or custom plugins) and support hibernation to reduce resource consumption.

  • API Group: batch.forkspacer.com
  • API Version: v1
  • Kind: Module
  • Short Name: mo
apiVersion: batch.forkspacer.com/v1
kind: Module
metadata:
name: nginx-helm
namespace: default
spec:
workspace:
name: dev-environment
namespace: default
source:
httpURL: https://example.com/modules/nginx-helm.yaml
config:
replicas: 3
environment: production
hibernated: false
status:
phase: ready
lastActivity: "2025-10-01T10:30:00Z"
conditions:
- type: Available
status: "True"
lastTransitionTime: "2025-10-01T10:30:00Z"
reason: ModuleReady
message: Module is successfully installed and running
apiVersion: batch.forkspacer.com/v1
kind: Module
metadata:
name: custom-app
namespace: default
spec:
workspace:
name: dev-environment
namespace: default
source:
raw:
kind: Custom
metadata:
name: custom-app
version: 1.0.0
supportedOperatorVersion: ">= 0.0.0, < 1.0.0"
spec:
repo:
file: /path/to/plugin.sh
status:
phase: ready

The .spec field defines the desired state of the Module.

FieldTypeDescriptionRequired
sourceobjectSource location of the module manifests. See Source.Yes
workspaceobjectReference to the workspace where this module should be deployed. See WorkspaceReference.Yes
configobjectCustom configuration for the module (arbitrary key-value pairs).No
hibernatedbooleanWhether the module should be in hibernated state.No (default: false)

The source field specifies where the resource definition should be loaded from. Resource definitions describe either Helm charts or custom plugins with their configuration schemas. Only one source type should be specified.

FieldTypeDescriptionRequired
rawobjectRaw resource definition embedded directly in the Module resource.No
configMapobjectReference to a ConfigMap containing the resource definition. See ConfigMapSource.No
httpURLstringHTTP/HTTPS URL pointing to a resource definition YAML file.No
existingHelmReleaseobjectReference to an existing Helm release to adopt and track. See ExistingHelmReleaseSource.No

Resource Definition Types:

The source must point to or contain a resource definition with one of these kinds:

For complete details on resource definition structure and configuration, see the Resources documentation.

Example - HTTP URL Source:

spec:
source:
httpURL: https://example.com/resources/postgresql.yaml

Example - Raw Embedded Resource:

spec:
source:
raw:
kind: Helm
metadata:
name: nginx
version: 1.0.0
supportedOperatorVersion: ">= 0.0.0, < 1.0.0"
spec:
namespace: default
repo: https://charts.bitnami.com/bitnami
chartName: nginx
version: 15.0.0

Example - ConfigMap Source:

spec:
source:
configMap:
name: redis-module-definition
namespace: default

Example - Existing Helm Release:

spec:
source:
existingHelmRelease:
name: redis
namespace: default

The configMap source type references a Kubernetes ConfigMap that contains the resource definition.

FieldTypeDescriptionRequired
namestringName of the ConfigMap.Yes
namespacestringNamespace of the ConfigMap.No (defaults to Module’s namespace)

The ConfigMap must contain a key named module.yaml with the resource definition as its value:

apiVersion: v1
kind: ConfigMap
metadata:
name: redis-module-definition
namespace: default
data:
module.yaml: |
kind: Helm
metadata:
name: redis
version: "1.0.0"
supportedOperatorVersion: ">= 0.0.0, < 1.0.0"
spec:
namespace: default
repo: https://charts.bitnami.com/bitnami
chartName: redis
version: 21.2.9

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.

FieldTypeDescriptionRequired
namestringName of the existing Helm release.Yes
namespacestringNamespace where the Helm release is installed.No (defaults to default)

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.

The workspace field references the target workspace where the module will be deployed.

FieldTypeDescriptionRequired
namestringName of the target workspace.Yes
namespacestringNamespace of the target workspace.No (default: default)

Example:

spec:
workspace:
name: production-workspace
namespace: prod

The config field accepts key-value pairs for module-specific configuration. The available configuration options and their validation rules are defined in the resource definition’s config array.

Configuration values are validated against the resource definition schema and passed to the underlying Helm chart or custom plugin. See the Configuration Schema documentation for details on supported configuration types and validation.

Example:

spec:
config:
replicas: 5
environment: staging
enableMetrics: true

The .status field reflects the observed state of the Module.

FieldTypeDescriptionRequired
phasestringCurrent phase of the module. Values: ready, installing, uninstalling, sleeping, sleeped, resuming, failed.Yes
lastActivitystring (date-time)Timestamp of the last activity for this module.No
messagestringHuman-readable message about the current state.No
conditionsarrayStandard Kubernetes conditions. See Conditions.No

Standard Kubernetes condition types used to represent the module state:

  • Available: The module is fully functional and running.
  • Progressing: The module is being installed, updated, or transitioning between states.
  • Degraded: The module failed to reach or maintain its desired state.

Each condition has the following fields:

FieldTypeDescription
typestringCondition type (e.g., “Available”, “Progressing”, “Degraded”).
statusstringCondition status: True, False, or Unknown.
lastTransitionTimestring (date-time)Last time the condition transitioned.
reasonstringProgrammatic identifier for the condition’s last transition.
messagestringHuman-readable message explaining the condition.
observedGenerationintegerThe .metadata.generation that the condition was set based upon.

The status.phase field can have the following values:

  • ready: Module is successfully installed and operational.
  • installing: Module is being installed into the workspace.
  • uninstalling: Module is being removed from the workspace.
  • sleeping: Module is transitioning to hibernated state.
  • sleeped: Module is hibernated with resources scaled down.
  • resuming: Module is waking up from hibernated state.
  • failed: Module encountered an error during installation or operation.
apiVersion: batch.forkspacer.com/v1
kind: Module
metadata:
name: postgresql
spec:
workspace:
name: dev-environment
source:
httpURL: https://example.com/resources/postgresql-helm.yaml
config:
storageSize: "10Gi"
enableBackups: true

Installing a Custom Module with Configuration

Section titled “Installing a Custom Module with Configuration”
apiVersion: batch.forkspacer.com/v1
kind: Module
metadata:
name: custom-installer
spec:
workspace:
name: production-workspace
namespace: prod
source:
httpURL: https://example.com/resources/installer.yaml
config:
environment: production
debug: false

Installing a Module with Raw Helm Definition

Section titled “Installing a Module with Raw Helm Definition”
apiVersion: batch.forkspacer.com/v1
kind: Module
metadata:
name: redis
spec:
workspace:
name: dev-environment
source:
raw:
kind: Helm
metadata:
name: redis
version: 1.0.0
supportedOperatorVersion: ">= 0.0.0, < 1.0.0"
description: "Redis in-memory database"
config:
- type: string
name: storageClass
alias: storageClass
spec:
required: false
default: "standard"
spec:
namespace: default
repo: https://charts.bitnami.com/bitnami
chartName: redis
version: 18.0.0
values:
- raw:
master:
persistence:
storageClass: "{{ .config.storageClass }}"
config:
storageClass: "fast-ssd"
apiVersion: batch.forkspacer.com/v1
kind: Module
metadata:
name: api-service
spec:
workspace:
name: dev-environment
source:
httpURL: https://example.com/manifests/api.yaml
hibernated: true
# First, create the ConfigMap with the module definition
apiVersion: v1
kind: ConfigMap
metadata:
name: postgresql-module
namespace: default
data:
module.yaml: |
kind: Helm
metadata:
name: postgresql
version: "1.0.0"
supportedOperatorVersion: ">= 0.0.0, < 1.0.0"
spec:
namespace: default
repo: https://charts.bitnami.com/bitnami
chartName: postgresql
version: 12.0.0
---
# Then, create the Module referencing the ConfigMap
apiVersion: batch.forkspacer.com/v1
kind: Module
metadata:
name: postgresql
namespace: default
spec:
workspace:
name: dev-environment
source:
configMap:
name: postgresql-module
namespace: default
config:
storageSize: "10Gi"
apiVersion: batch.forkspacer.com/v1
kind: Module
metadata:
name: existing-redis
namespace: default
spec:
workspace:
name: production-workspace
source:
existingHelmRelease:
name: redis
namespace: default

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.

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

  2. Configuration: The config field can be used to parameterize the module installation. Configuration values are validated against the resource definition’s config schema.

  3. Hibernation: Setting hibernated: true scales down the module’s resources to reduce costs while preserving the configuration.

  4. Updates: Modifying the Module spec triggers an update in the workspace.

  5. Deletion: Deleting a Module resource triggers uninstallation of the module from the workspace.

Modules reference resource definitions that describe how applications should be installed. Resource definitions can be either:

  • Helm Resources: Deploy Helm charts with customizable values
  • Custom Resources: Execute custom plugin scripts for installation

For complete documentation on creating and using resource definitions, see:

  • A Module must reference an existing Workspace via the workspace field.
  • Multiple Modules can be deployed to the same Workspace.
  • When a Workspace is hibernated, all its Modules may be affected.
  • If a Workspace is deleted, the operator’s behavior for associated Modules depends on the finalization logic.