Random Values in Blueprints
A common use case for using random strings is generating passwords, or secured tokens when provisioning new infrastructure resources.
Velocity allows you to use the
{velocity.v1.generate:random}
Velocity Template which will be resolved into a string upon provisioning. The syntax supports two options: - 1.A simple random string that translates into an 8 character string:
{velocity.v1.generate:random}
- 2.A custom regular expression:
{velocity.v1.generate:random([a-zA-Z0-9]{8})}
The random generator uses a combination of environment name, environment creation date, resource identifier, and path in the manifest as a seed of the random generator
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql
annotations:
velocity.tech.v1/id: mysql
spec:
containers:
- name: mysql
env:
- name: DATABASE_NAME
value: 'orders'
- name: DATABASE_PASSWORD
value: '{velocity.v1.generate:random}'
Last modified 2mo ago