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.

FieldDescriptionSchemeTemplate Env
name*

Name of parameter.

string

default

Default value of the parameter.

Go Template

Context

description

A short sentence to describe the parameter. This shows up in the input form when running the playbook.

string

icon

Icon for the playbook.

Icon

label

Label of the parameter.

string

properties

Properties of parameter. Varies based on the type

required

Specify if the parameter is required.

boolean

type

Type of parameter. (Defaults to "text")

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 is pre-populated:

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
millicoresCPU resourceNumberstring-
bytesMemory resourceNumberstring-
params-sink.yaml
apiVersion: mission-control.flanksource.com/v1
kind: Playbook
metadata:
name: params-sink
namespace: mission-control
spec:
title: Params Kitchen Sink
actions:
- name: echo
exec:
script: echo {{. | toJSON | shellQuote}} | jq
configs:
- types:
- Kubernetes::Namespace
description: Test playbook
category: Kitchen Sink
parameters:
- label: Text Input (Default)
name: text-input
type: text
default: "hello world"
- label: Checkbox
name: checkbox
type: checkbox
- label: Teams Selector
name: teams
type: team
- label: People Selector
name: people
properties:
role: admin
type: people
- label: Component Selector
name: component
properties:
filter:
- types:
- KubernetesPod
type: component
- label: Configs Selector
name: configs
properties:
filter:
- types:
- Kubernetes::Pod
type: config
- label: Code Editor (YAML)
name: code-editor-yaml
properties:
language: yaml
type: code
- label: Code Editor (JSON)
name: code-editor-json
properties:
language: json
type: code
- label: Textarea
name: textarea
properties:
multiline: "true"
type: text
- label: List
name: list
properties:
options:
- label: Option 1
value: option-1
- label: Option 2
value: option-2
- label: Option 3
value: option-3
type: list

component

FieldDescriptionSchema
filter[]Limit the components to these resourcesResourceSelector

config

FieldDescriptionSchema
filter[]Limit the config items to these resourcesResourceSelector

checks

FieldDescriptionSchema
filter[]Limit the checks to these resourcesResourceSelector

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