Parameters
scale-deployment.yamlapiVersion: 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.
Field | Description | Scheme | Template Env |
---|---|---|---|
name* | Name of parameter. |
| |
default | Default value of the parameter. | ||
description | A short sentence to describe the parameter. This shows up in the input form when running the playbook. |
| |
icon | Icon for the playbook. | ||
label | Label of the parameter. |
| |
properties | Properties of parameter. Varies based on the type | ||
required | Specify if the parameter is required. |
| |
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
name | Description | UI Component | Schema | Properties |
---|---|---|---|---|
check | Limits the value to a check. | Dropdown | string | Check |
checkbox | Boolean value toggle | Checkbox | boolean | - |
code | Text area | Code Editor | string | Code |
component | Limits the value to a component. | Dropdown | string | Component |
config | Limits the value to a config item. | Dropdown | string | Config |
list | Specify a custom list of values | Dropdown | string | List |
people | Limits the value to people. | Dropdown | string | People |
team | Limits the value to teams. | Dropdown | string | - |
text | Text input | Text Input | string | Text |
millicores | CPU resource | Number | string | - |
bytes | Memory resource | Number | string | - |
params-sink.yamlapiVersion: 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
Field | Description | Schema |
---|---|---|
filter[] | Limit the components to these resources | ResourceSelector |
config
Field | Description | Schema |
---|---|---|
filter[] | Limit the config items to these resources | ResourceSelector |
checks
Field | Description | Schema |
---|---|---|
filter[] | Limit the checks to these resources | ResourceSelector |
code
Field | Description | Schema |
---|---|---|
language | e.g. yaml , json , toml , etc. | string |
people
Field | Description | Schema |
---|---|---|
role | Limit the people to the given role | `string |
text
Field | Description | Schema |
---|---|---|
multiline | Render a multiline textarea | boolean |
list
Field | Description | Schema |
---|---|---|
options[].label | Specify label of the list option | string |
options[].value | Specify value of the list option | string |