LynqHub API Reference
LynqHub CRD API reference — spec.source MySQL connection, syncInterval, valueMappings, status fields, and multi-template support.
Kind: LynqHub
API Version: operator.lynq.sh/v1
Group: operator.lynq.sh
LynqHub connects to a database, queries active rows on a configurable interval, and creates/deletes LynqNode CRs to match the active set. One hub can be referenced by multiple LynqForms.
→ Datasource configuration guide · API index
Spec
apiVersion: operator.lynq.sh/v1
kind: LynqHub
metadata:
name: my-hub
namespace: lynq-system
spec:
source:
type: mysql # mysql (postgresql planned for v1.2)
mysql:
host: string # MySQL hostname or IP (required)
port: 3306 # MySQL port (default: 3306)
username: string # Database username (required)
passwordRef:
name: string # Kubernetes Secret name (optional; omit for passwordless)
key: string # Secret key containing password
database: string # Database name (required)
table: string # Table or view name (required)
syncInterval: "1m" # Poll frequency, e.g. 30s, 1m, 5m (required)
valueMappings:
uid: string # Column mapping for unique node ID (required)
activate: string # Column mapping for activation flag (required)
# hostOrUrl: string # DEPRECATED since v1.1.11, removed in v1.3.0
extraValueMappings: # Optional additional column → variable mappings
planId: subscription_plan # Available as {{ .planId }} in templates
region: deployment_region # Available as {{ .region }} in templatesspec.source.mysql fields
| Field | Type | Required | Description |
|---|---|---|---|
host | string | ✓ | MySQL hostname or IP address |
port | integer | MySQL port (default: 3306) | |
username | string | ✓ | Database username |
passwordRef.name | string | Kubernetes Secret name (omit for passwordless connections) | |
passwordRef.key | string | Key within the Secret | |
database | string | ✓ | Database name |
table | string | ✓ | Table or view to query |
spec.source.syncInterval
Duration string format: <number><unit> where unit is s, m, or h. Defaults to 30s when omitted.
| Value | Meaning |
|---|---|
30s | Every 30 seconds (default) |
1m | Every minute (recommended for production) |
5m | Every 5 minutes (for large deployments) |
spec.valueMappings
Maps database column names to the two required template variables.
| Key | Required | Purpose |
|---|---|---|
uid | ✓ | Maps a column to .uid — unique node identifier, used in resource naming |
activate | ✓ | Maps a column to .activate — truthy/falsy activation flag |
hostOrUrl | Deprecated | Removed in v1.3.0. Use extraValueMappings + toHost() instead |
Accepted truthy values for activate: 1, true, TRUE, True, yes, YES, Yes. All other values (including NULL) are treated as inactive.
spec.extraValueMappings
Optional map of templateVariable: databaseColumn. Each entry makes a new variable available in all templates for this hub's LynqNodes.
extraValueMappings:
planId: subscription_plan # → {{ .planId }}
region: aws_region # → {{ .region }}
nodeUrl: node_url # → {{ .nodeUrl | toHost }} for hostname extractionStatus
status:
observedGeneration: int64
referencingTemplates: int32 # Number of LynqForms referencing this hub
desired: int32 # referencingTemplates × activeRows
ready: int32 # LynqNodes with Ready=True
failed: int32 # LynqNodes with reconciliation failures
conditions:
- type: Ready
status: "True" | "False" | "Unknown"
reason: string
message: string
lastTransitionTime: timestampstatus.desired calculation
desired = referencingTemplates × activeRowsA hub with 3 active rows and 2 referencing LynqForms has desired: 6.
Ready condition reasons
| Reason | Status | Meaning |
|---|---|---|
SyncSucceeded | True | Last sync completed successfully |
DatabaseConnectionFailed | False | Cannot reach the database |
QueryFailed | False | Connection succeeded but query failed |
SyncInProgress | Unknown | Sync is running |
Validation
The admission webhook enforces:
spec.valueMappingsmust includeuidandactivatespec.source.syncIntervalmust match^\d+(s|m|h)$spec.source.mysql.hostis required whentype: mysql
Example
apiVersion: operator.lynq.sh/v1
kind: LynqHub
metadata:
name: production-nodes
namespace: lynq-system
spec:
source:
type: mysql
mysql:
host: mysql.default.svc.cluster.local
port: 3306
username: node_reader
passwordRef:
name: mysql-credentials
key: password
database: saas_db
table: node_configs
syncInterval: 1m
valueMappings:
uid: node_id
activate: is_active
extraValueMappings:
planId: subscription_plan
region: deployment_regionAll Fields
Every field the CRD accepts, read from the installed schema. The sections above explain the ones that need it.
Spec
| Field | Type | Description |
|---|---|---|
spec. | map[string]string | ExtraValueMappings defines additional custom column to variable mappings Keys become template variables, values are column names |
spec.required | object | Source defines the external data source configuration |
spec. | object | MySQL contains MySQL-specific configuration |
spec.required | string | Database is the MySQL database name |
spec.required | string | Host is the MySQL server hostname or IP |
spec. | object | PasswordRef references a Secret containing the MySQL password |
spec.required | string | Key is the key within the Secret |
spec.required | string | Name is the name of the Secret |
spec.required | integer (int32) | Port is the MySQL server port Default 3306. |
spec.required | string | Table is the MySQL table name containing node data |
spec.required | string | Username is the MySQL username |
spec.required | string | SyncInterval is how often to sync from the data source Default "30s". |
spec.required | string | Type is the type of data source One of mysql. |
spec.required | object | ValueMappings defines required column to variable mappings |
spec.required | string | Activate is the column name for the activation status |
spec. | string | HostOrURL is the column name for the node host or URL Deprecated: Use extraValueMappings with the toHost() function instead This field will be removed in v1.3.0 |
spec.required | string | UID is the column name for the node unique identifier |
Generated from config/crd/bases/operator.lynq.sh_lynqhubs.yaml
Status
| Field | Type | Description |
|---|---|---|
status. | object[] | Conditions represent the latest available observations of the hub's state |
status.required | string (date-time) | lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. |
status.required | string | message is a human readable message indicating details about the transition. This may be an empty string. |
status. | integer (int64) | observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. |
status.required | string | reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty. |
status.required | string | status of the condition, one of True, False, Unknown. One of True, False, Unknown. |
status.required | string | type of condition in CamelCase or in foo.example.com/CamelCase. |
status. | integer (int32) | Desired is the total number of LynqNode CRs that should exist Calculated as: ReferencingTemplates * ActiveRows |
status. | integer (int32) | Failed is the number of failed LynqNode resources |
status. | integer (int64) | ObservedGeneration is the generation observed by the controller |
status. | integer (int32) | Ready is the number of ready LynqNode resources |
status. | integer (int32) | ReferencingTemplates is the number of LynqForms referencing this hub |
Generated from config/crd/bases/operator.lynq.sh_lynqhubs.yaml
See Also
- Datasource — connection setup, column mappings, VIEW patterns
- LynqForm API — resource blueprint
- LynqNode API — instance status
- API index — common types and kubectl reference
API Reference
Lynq Kubernetes CRD reference index — LynqHub, LynqForm, LynqNode overview, common types, shared labels/annotations, and kubectl commands.
LynqForm API Reference
LynqForm CRD API reference — hubId, resource arrays, TResource spec fields, dependency ordering, creationPolicy, and deletionPolicy.