Search
⌃K

Templates

Add Velocity templates to your Helm values, K8s, or Kustomize overlay files
Velocity Templates are placeholders that you add anywhere in your K8s entity definitions, which will be interpreted dynamically by Velocity during provisioning. Templates are used to set dynamic values in environment variables or define unique identifiers to cloud resources and more.
  • Velocity Templates are located anywhere along your K8s resource definitions. It is recommended to keep them in a dedicated Helm values file for Velocity or in a Kustomize overlay,
  • Velocity Templates use the following syntax: {velocity.v1.<Property>}for global templates or {velocity.v1:<Velocity Service>.<Property>} for service-level templates.
Examples in GitHub: Helm on AWS, Helm on GCP

Global Properties

{velocity.v1.envName}
The name of the current environment. Example use case: Creating a unique database with the name of the environment.
Example value: crazy-imperial-guard (env specific)
{velocity.v1.domainName}
The domain that is configured for the account. Example use case: Building a hostname in your ingress definitions to control environment access
Example Value: viron.dev(account specific)
{velocity.v1.domainSuffix}
Sugar syntax for concatenating <envName>.<domainName>
Example use case: Building a hostname in your ingress definitions to control environment access. i.e. backend-{velocity.v1.domainSuffix}
Example value: crazy-imperial-guard.viron.dev (env + account specific)
{velocity.v1.tlsSecretName}
The Secret name in the K8s cluster that contains the certificate detail for SSL (HTTPS).
Main use case: setting up HTTPS access to your Velocity environments.
Note that: Domains are signed with the following:*.<domainName>This way, every subdomain can be secured with TLS.
Example value: wildcard-cert(currently constant across all accounts)
{velocity.v1.snapshot}
The full path of an object in the relevant storage bucket. Main use case: Seeding your environment with data that was uploaded to a storage bucket.
Example value: gs://velocity-velo6abw-data-seeding/default-seeding1

GCP Specific

{velocity.v1.gcp.projectName}
GCP project name that is configured for the account (The project name of the GKE cluster).
Example: viron
{velocity.v1.gcp.zone}
The GCP zone configured for the account. It can be used when defining cloud resources.
Note: It is the same zone where the GKE cluster is hosted at.
Example value: europe-west2-b

AWS Specific

{velocity.v1.aws.accountID}
AWS project id that is configured for the account. (The project id of the AWS cluster).
Example value: 123456789000
{velocity.v1.aws.region}
AWS region that is configured for the account.
Note: It is the same region where the EKS cluster is hosted at.
Example value: eu-central-1

Functions

Complex functions that are resolved during provisioning and allow you to generate random strings.
Note: You can wrap parameter values with backticks - `<complexValue>`
{velocity.v1.generate:random}
Generate a hash of 8 random alphanumeric characters.
Note: The seed is a combination of the environment name and environment creation date; therefore, the hash will only change between environments. Example use cases: Generating a unique ID when creating cloud resources or unique user names and passwords per environment.
Example value: ans2Zd4p
{velocity.v1.generate:random(seed=<seed>, pattern=<pattern>)}
Same explanation and use case as: {velocity.v1.generate:random}with the option to provide a seed and a regex pattern for the resulting string.
The option of providing a seed helps differentiate between randoms. This seed, together with the environment name and creation date, will be used to create a hash; therefore, different seeds will create different hashes.
Use the seed option to denote the random value relation (see example) Note: both parameters are optional. In case a seed won't be given, the random generator will create the same random value for every random call instance in the same environment.
Example values: {velocity.v1.generate:random(seed=`bucket1`, pattern=`[a-z]{1,5}`)} will generate f5v28. Another call with the same seed {velocity.v1.generate:random(seed=`bucket1`, pattern=`[a-z]{1,5}`)} will generate the same valuef5v28 A call with a different seed will result in a different value: {velocity.v1.generate:random(seed=`bucket2`, pattern=`[a-z]{1,5}`)} will result in g32vk
{velocity.v1.generate:cloudResourcePrefix}
Generate the resource prefix required by velocity when creating cloud resources. The prefix is a combination of a static value, the velocity account ID, and a hash value composed of the environment name and the environment creation date, making it unique for every environment. Note: In this form, the prefix will be the same for every appearance in the same environment. In order to make the hash unique, provide a unique seed as explained below.
Example value: velocity-accountid-sd3t3f
{velocity.v1.generate:cloudResourcePrefix(seed=<seed>)}
Same explanation and use cases as {velocity.v1.generate:cloudResourcePrefix} Optionally provide a seed (an identifier) that will be chained into the hash seed. This way, for a seed 'x', the hash value will be different than for a seed 'y' or no seed. Examples: bucket1={velocity.v1.generate:cloudResourcePrefix(seed=`bucket1`)} bucket2={velocity.v1.generate:cloudResourcePrefix(seed=`bucket2`)} Example values:bucket1=velocity-accountid-jk36fr, bucket2=velocity-accountid-ar239f

Environment Parameters

Dynamically set custom parameters specified at environment creation.
{velocity.v1.param: <param_name>}
Allow users to enter custom params when creating a new environment using:
veloctl env create --param '<param_name>=<param_value>' The value of the parameter will be injected to your blueprint during provisioning. Example use cases: Change an environment variable dynamically to control the application's functionality.
Example use: veloctl env create --param 'Domain=5'

Service Properties

Dynamically extract parameters from a Velocity Service to enable the following use cases and more:
  • Connectivity: Building connection strings dynamically.
  • Parameter encapsulation so that multiple services will point to a single value.
port_id: Some templates include a reference to a port_id. This identifier is created automatically from the K8s Service associated with the relevant K8s workload that defines the Velocity Service.
To find the generated port_id, run env create with the --dry-run flag.
NOTE: port=<port>: Exposures Templates may reference a service port. This value is drawn from the port value of the K8s service associated with the Velocity Service.
For example:
spec:
ports:
- port: 6379
targetPort: 6379
name: redis
Example value: 6379
{velocity.v1:<velocity_service>.exposures(port=<port>).user}
References the username defined by the velocity.tech.v1/exposures-<port_id>-userannotation.
Example value: username
{velocity.v1:<velocity_service>.exposures(port=<port>).password}
References the password defined by the velocity.tech.v1/exposures-<port_id>-passwordannotation.
Example value: password
{velocity.v1:<velocity_service>.exposures(port=<port>).host}
References the host defined by k8s Service name. Inferred by k8s service name that is related to the deployment
Example value: svcName
{velocity.v1:<velocity_service>.exposures(port=<port>).port}
References the port of k8s Service.
Inferred by k8s service port that is related to the deployment
Example value: 8000
{velocity.v1:<velocity_service>.exposures(port=<port_id>).scheme}
References the scheme defined by the velocity.tech.v1/exposures-<port_id>-schemeannotation.
Example value: mongodb
{velocity.v1:<velocity_service>.exposures(port=<port_id>).uri}
References the URI generated for the Velocity Service. Shorthand for concatenating the URI.
Example value: mongodb://username:[email protected]:8000
{velocity.v1:<velocity_service>.exposures(port=<port_id>).host}
References the hostname defined on the related ingress.
Example value: backend.crazy-imperial-guard.viron.dev
{velocity.v1:<velocity_service>.exports.<variable>}
Allows exporting constant value / specific path in the manifest to other services.
Example use case: Database service exporting the name of a generated table.
Example value: test123
Last modified 3mo ago