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.
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)Complex functions that are resolved during provisioning and allow you to generate random strings.
Note: You can wrap parameter values with backticks -
`<complexValue>`
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
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 g32vkGenerate 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
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
Dynamically set custom parameters specified at environment creation.
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'
- 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.
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
References the URI generated for the Velocity Service. Shorthand for concatenating the URI.
Example value:
mongodb://username:[email protected]:8000
Last modified 3mo ago