Skip to main content

Templating

Templating is:

Simply a way to represent data in different forms.

Templating allows your playbook actions to work in context of a config, health check or a component.

Example:

scale-deployment.yaml
apiVersion: mission-control.flanksource.com/v1
kind: Playbook
metadata:
name: scale-deployment
spec:
description: Scale deployment
configs:
- type: Kubernetes::Deployment
tags:
environment: staging
parameters:
- name: replicas
label: The new desired number of replicas.
actions:
- name: 'scale deployment'
exec:
script: kubectl scale --replicas={{.params.replicas}} --namespace={{.config.tags.namespace}} deployment {{.config.name}}

Context

Templates receive a context variable that contain details about the config or component it is running for. In addition, it also contains the optional params variable which contains the parameters passed to the playbook.

FieldDescriptionSchema
configConfig passed to the playbookConfigItem
componentComponent passed to the playbookComponent
checkCanary Check passed to the playbookCheck
paramsUser provided parameters to the playbookmap[string]string