Skip to main content

Parameters

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

Playbook parameter defines a parameter that a playbook needs to run.

FieldDescriptionSchemeRequiredTemplatable
nameName of parameter.stringtrue
defaultDefault value of the parameter.stringtrue
labelLabel of the parameter.stringtrue
requiredSpecify if the parameter is requiredbool
iconIcon
descriptionDescription of the parameter.string
typeType of parameter. (Defaults to "text")string
propertiesProperties of parameter. Varies based on the typemap[string]string

Defaulting

Parameter values can be defaulted from the selected resource

default parameters.yaml
#...
kind: Playbook
spec:
parameters:
// Use the config items type and name in the parameter
- default: 'chore: update $(.config.type)/$(.config.name)'

When running the playbook on a Deployment named mysql the following will be prepopulated:

Types

nameDescriptionUI ComponentSchemaProperties
checkLimits the value to a check.DropdownstringCheck
checkboxBoolean value toggleCheckboxboolean-
codeText areaCode EditorstringCode
componentLimits the value to a component.DropdownstringComponent
configLimits the value to a config item.DropdownstringConfig
listSpecify a custom list of valuesDropdownstringList
peopleLimits the value to people.DropdownstringPeople
teamLimits the value to teams.Dropdownstring-
textText inputText InputstringText

component

FieldDescriptionSchema
filter.typeLimit the components to the given typestring

config

FieldDescriptionSchema
filter.typeLimit the components to the given typestring

checks

FieldDescriptionSchema
filter.typeLimit the components to the given typestring

code

FieldDescriptionSchema
languagee.g. yaml, json, toml, etc.string

people

FieldDescriptionSchema
roleLimit the people to the given role`string

text

FieldDescriptionSchema
multilineRender a multiline textareaboolean

list

FieldDescriptionSchema
options[].labelSpecify label of the list optionstring
options[].valueSpecify value of the list optionstring