Skip to main content

Application Template YAML Specification

In order to simplify the management and deployment of distributed applications, potctl provides the ApplicationTemplate kind.

Application Templates allow users to specify an Application once and deploy it many times with different variables. Application Templates do this by allowing users to create Template Variables which can be modified every time an Application is deployed.

To deploy Applications from a Template, first an Application Template must be deployed through potctl deploy -f template.yaml. An Application Template YAML spec contains an Application spec with Templated Variables.

apiVersion: datasance.com/v3
kind: ApplicationTemplate
metadata:
name: my-template
spec:
name: my-template
description: My app template
variables:
- key: agent-name # Templated variable pertaining to value in spec.application.microservices[0].agent.name below
description: Name of Agent to deploy Microservices to
defaultValue: zebra-1
application: # Typical Application kind spec (fields omitted for simplicity)
routes:
...
microservices:
- name: heart-rate-viewer
agent:
name: "{{agent-name}}" # Templated Variable (quotation marks are required)
...
...
FieldDescription
nameUser-defined unique identifier of an Application Template. Must start and end with lowercase alphanumeric character. Can include '-' character.
descriptionAdditional detail of the Application Template that user wishes to specify.
variablesList of Template Variables to be expected in spec.application.
variables.defaultValueValue the Templated Variable should take if an Application is deployed without providing a value.
variables.descriptionAdditional detail of the Template Variable that user wishes to specify.

Templated Application YAML Specification

Once an Application Template has been created, the following Application YAML can be used to deploy an Application from the Template with the requisite variables specified:

apiVersion: datasance.com/v3
kind: Application
metadata:
name: my-app
spec:
template:
name: my-template
variables:
- key: agent-name
value: zebra-2
FieldDescription
metadata.nameName of the Application.
spec.nameName of the Application Template used to create the Application.
spec.variablesList of Template Variables to be expected in spec.application.
spec.variables.keyName of the Templated Variable expected in Application spec of the Application Template.
spec.variables.valueValue the Templated Variable should take for this Application deployment.