Template Context Object
All templates have access to the.ryvn context object. The following properties are available:
.ryvn.env — Environment context
| Property | Type | Description |
|---|---|---|
.ryvn.env.name | string | Environment name |
.ryvn.env.orgId | string | Organization ID |
.ryvn.env.defaultNamespace | string | Default Kubernetes namespace |
.ryvn.env.releaseChannel | string | Environment’s release channel |
.ryvn.env.provider.type | string | Cloud provider (aws, gcp, azure, k3s) |
.ryvn.env.provider.aws.accountId | string | AWS account ID (AWS only) |
.ryvn.env.provider.gcp.projectId | string | GCP project ID (GCP only) |
.ryvn.env.config | object | Environment config as key-value map (e.g., .ryvn.env.config.region) |
.ryvn.env.state | object | Provisioned infrastructure state (cluster info, VPC, domains, etc.) |
.ryvn.env.state properties (VPC IDs, subnet CIDRs, cluster endpoints, domain names, etc.), see the Outputs section of the environment reference for your provider: AWS, GCP, Azure.
.ryvn.installation — Installation context
| Property | Type | Description |
|---|---|---|
.ryvn.installation.name | string | Installation name |
.ryvn.installation.outputs | object | Installation outputs |
.ryvn.release — Release context
| Property | Type | Description |
|---|---|---|
.ryvn.release.images.<name>.repo | string | Image repository for a named artifact |
.ryvn.release.images.<name>.tag | string | Image tag for a named artifact |
.ryvn.registrySecrets — Registry credentials
| Property | Type | Description |
|---|---|---|
.ryvn.registrySecrets | map | Map of registry name to Kubernetes secret name for image pull secrets |
Template helper functions
| Function | Description |
|---|---|
serviceInstallation "<name>" | Get another service installation’s .outputs and .outputsSecret |
blueprintInstallation "<name>" | Get a blueprint installation’s .outputs and .outputsSecret |
k8sSecretName "<name>" | Get the Kubernetes secret name for a variable group |
k8sSecretValue "<name>" ["<key>"] | Get a secret value from a variable group (optionally by key) |
String Functions
lower, upper, title, trim
Transform string values.
contains
Check if a string contains a substring. Returns boolean.
substring
Extract a substring from a string.
If start is < 0, extracts from beginning to end position.
If end is < 0 or greater than length, extracts from start to end of string.
default
Provide a default value if the given value is empty or undefined.
Data Formatting Functions
toYaml
Convert data structures to YAML format. Useful for including complex configuration objects.
toJson
Convert data structures to JSON format.
indent, nindent
Add indentation to multi-line strings.
indent adds spaces to each line. nindent adds a newline before indenting.
join
Join array elements with a separator.
Control Flow
Go templates support control flow statements for conditional logic.Conditionals
Useif, else if, else, and end:
Comparison Operators
eq- equal tone- not equal tolt- less thanle- less than or equal togt- greater thange- greater than or equal to
Boolean Logic
Useand, or, and not:
Examples
Provider-Specific Configuration
Configure differently based on cloud provider:Using Installation Outputs
Reference outputs from other installations in the same environment using theinstallation function:
Using Blueprint Outputs
Reference outputs exposed by blueprints installed in the same environment using theblueprint function. Blueprint outputs are declared in the blueprint spec and resolved from underlying installation outputs.