Exposures
Exposures is an entity that Velocity creates for every Velocity service.
It is generated automatically from your Kubernetes Service Port definition (referencing the defied port number and the port name) and can be extended with application properties such as username, password, and scheme to construct generic URI templates used to connect your Velocity Services.
For example, if your configuration includes an environment variable that points to a static address, it will not be suitable for creating ephemeral environments. Therefore, Velocity allows you to replace it with a generic Velocity Template that will be resolved automatically upon environment provisioning:
'{velocity.v1:mysql.exposures(port=mysqlport).uri}'.
The template contains a Port Identifier that tells Velocity which service and port definitions should be used when constructing the URI.
Velocity automatically generates unique referencable Service Port Identifiers (exposure) for each defined service port. The identifiers are presented when running
env create
with the --dry-run
flag and they are based on your Kubernetes port definitions. <port_name>
- is used as an identifier if defined in your manifest.<port_number>
- is used as an identifier.
In some scenarios when there are name conflicts or port number conflicts, Velocity generates a hash that helps to reference a specific port definition. In these cases, the port identifier will be
<port_name>-<hash>
or <port_number>-<hash>

To enable Velocity to generate URIs in the form of
schema://user:[email protected]
you need to explicitly define the application parameters when exposing a port. This can be done by adding the following Velocity Annotations to your Velocity Service definition:
- 1.Constant values
velocity.tech.v1/exposures-<port_id>-user: const="username"
velocity.tech.v1/exposures-<port_id>-password: const="password"
velocity.tech.v1/exposures-<port_id>-scheme: const="https"
You can also use a shorthand:
velocity.tech.v1/exposures-<port_id>-user: "username"
velocity.tech.v1/exposures-<port_id>-password: "password"
velocity.tech.v1/exposures-<port_id>-scheme: "https"
2. Values specified using a Kubernetes resource path
velocity.tech.v1/exposures-<port_id>-user: path="<path in k8s resource>"
velocity.tech.v1/exposures-<port_id>-password: path="<path in k8s resource>"
velocity.tech.v1/exposures-<port_id>-scheme: path="<path in k8s resource>"
Last modified 3mo ago