Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: playbook parameter docs #291

Merged
merged 7 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
name: Vale
on:
push:
pull_request:

jobs:
vale:
name: runner / vale
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: errata-ai/vale-action@reviewdog

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45

- name: List changed fiels
run: |
echo "Files changed:"
echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n'

- name: Run Vale on changed files
uses: errata-ai/vale-action@reviewdog
with:
reporter: github-check
files: ${{ steps.changed-files.outputs.all_changed_files }}
separator: " "
reporter: github-pr-check
fail_on_error: true
60 changes: 5 additions & 55 deletions mission-control/docs/playbooks/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,80 +23,30 @@ Some key benefits include:
* **Cost Efficiency** - Optimize costs with on-demand environments that spin down after a fixed duration.
* **Portability** - A consistent interface for performing operations irrespective of the underlying infrastructure and/or environment


<hr/>


## Use cases


### Provisioning



### Day 2 Operations

Day 2 operations can be added onto existing resources using `configs`, `components` or health `checks` using [resource selectors](/reference/resource-selector).
Day 2 operations can be added onto existing resources (`configs`, `components` or health `checks`) using [resource selectors](/reference/resource-selector).

For example Restarting a Kubernetes Deployment is only applicable to config items of type: `Kubernetes::Deployment`
For example scaling a Kubernetes Deployment is only applicable to config items of type: `Kubernetes::Deployment`

```yaml title="scale-deployment.yaml"
#...
kind: Playbook
spec:
configs:
- types:
- Kubernetes::Deployment
#....
```yaml title='scale-deployment.yaml' file=../../modules/mission-control/fixtures/playbooks/scale-deployment.yaml
```

Before running a playbook, users can provide input using [`parameters`](/reference/playbooks/parameters)
```yaml title="parameters.yaml"
#...
kind: Playbook
spec:
# user input
parameters:
- name: replicas
# ...
Before running a playbook, users can provide input using [`parameters`](/reference/playbooks/parameters).
In the playbook above, the user can decide the new number of replicas before running the playbook.

```

### Just In Time Access

### AIOps



## Parameters

Playbooks have 2 types of parameters:




```yaml title="restrict-to-deployment.yaml"
#...
kind: Playbook
spec:
# components: ...
# checks: ...
//highlight-next-line
configs:
- types:
- Kubernetes::Deployment
```

## Self-Service




## Events

## Webhooks


## Actions

Playbooks execute a sequence of actions (steps), these actions can update git repositories, invoke pipelines or run command line tools like `kubectl` and `aws`.
Expand Down
2 changes: 1 addition & 1 deletion mission-control/docs/playbooks/self-service.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Self Service
sidebar_position: 4
---

import Parameters from '../reference/playbooks/parameters.md'
import Parameters from '../reference/playbooks/parameters.mdx'

Playbooks can be manually triggered on a component, config item or check.

Expand Down
95 changes: 0 additions & 95 deletions mission-control/docs/reference/playbooks/parameters.md

This file was deleted.

137 changes: 137 additions & 0 deletions mission-control/docs/reference/playbooks/parameters.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
---
title: Parameters
---

```yaml title="scale-deployment.yaml" file=../../../modules/mission-control/fixtures/playbooks/scale-deployment.yaml

```

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

<Fields withTemplates rows={[
{
field: "name",
description: "Name of parameter.",
scheme: "string",
required: true
},
{
field: "default",
description: "Default value of the parameter.",
scheme: "gotemplate",
templateEnv: [
{"name": "Context", "url": "/reference/playbooks/context"},
]
},
{
field: "label",
description: "Label of the parameter.",
scheme: "string",
},
{
field: "required",
description: "Specify if the parameter is required.",
scheme: "bool",
},
{
field: "icon",
description: "Icon for the playbook.",
scheme: "Icon",
},
{
field: "description",
description: "A short sentence to describe the parameter. This shows up in the input form when running the playbook.",
scheme: "string",
},
{
field: "type",
description: "Type of parameter. (Defaults to \"text\")",
scheme: "[`Type`](#types)",
},
{
field: "properties",
description: "Properties of parameter. _Varies based on the type_",
scheme: "`map[string]string`",
}
]} />

## Defaulting

Parameter values can be defaulted from the selected resource

```yaml title="default parameters.yaml"
#...
kind: Playbook
spec:
parameters:
// Use the config items type and name in the parameter
// highlight-next-line
- default: 'chore: update $(.config.type)/$(.config.name)'
```

When running the playbook on a `Deployment` named `mysql` the following is pre-populated:

<img src="/img/parameter-defaulting.png" width="700px" className="border-1 border-solid border-gray-200"/>

## Types

| name | Description | UI Component | Schema | Properties |
| ------------ | ---------------------------------- | ------------ | --------- | ------------------------- |
| `check` | Limits the value to a check. | Dropdown | `string` | [`Check`](#checks) |
| `checkbox` | Boolean value toggle | Checkbox | `boolean` | - |
| `code` | Text area | Code Editor | `string` | [`Code`](#code) |
| `component` | Limits the value to a component. | Dropdown | `string` | [`Component`](#component) |
| `config` | Limits the value to a config item. | Dropdown | `string` | [`Config`](#config) |
| `list` | Specify a custom list of values | Dropdown | `string` | [`List`](#list) |
| `people` | Limits the value to people. | Dropdown | `string` | [`People`](#people) |
| `team` | Limits the value to teams. | Dropdown | `string` | - |
| `text` | Text input | Text Input | `string` | [`Text`](#text) |
| `millicores` | CPU resource | Number | `string` | - |
| `bytes` | Memory resource | Number | `string` | - |

```yaml title='params-sink.yaml' file=../../../modules/mission-control/fixtures/playbooks/params.yaml {20,24,27,32,39,46,51,56,61,72} showLineNumbers

```

### component

| Field | Description | Schema |
| ---------- | -------------------------------------- | -------------------------------------------------- |
| `filter[]` | Limit the components to these resources | [`ResourceSelector`](/reference/resource-selector) |

### config

| Field | Description | Schema |
| ------------- | ---------------------------------------- | -------------------------------------------------- |
| `filter[]` | Limit the config items to these resources | [`ResourceSelector`](/reference/resource-selector) |

### checks

| Field | Description | Schema |
| ------------- | ---------------------------------- | -------------------------------------------------- |
| `filter[]` | Limit the checks to these resources | [`ResourceSelector`](/reference/resource-selector) |

### 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` |
2 changes: 1 addition & 1 deletion modules/canary-checker
Submodule canary-checker updated 91 files
+1 −1 .gitignore
+1 −1 README.md
+2 −0 api/v1/component_types.go
+1 −1 build/full/Dockerfile
+1 −1 build/minimal/Dockerfile
+5 −1 checks/http.go
+1 −2 cmd/push.go
+57 −0 config/deploy/crd.yaml
+57 −0 config/deploy/manifests.yaml
+6 −0 config/schemas/canary.schema.json
+15 −0 config/schemas/component.schema.json
+3 −0 config/schemas/health_catalog.schema.json
+3 −0 config/schemas/health_databasebackupcheck.schema.json
+3 −0 config/schemas/health_exec.schema.json
+3 −0 config/schemas/health_folder.schema.json
+15 −0 config/schemas/topology.schema.json
+2 −2 fixtures/aws/aws_config_pass.yaml
+1 −1 fixtures/aws/aws_config_rule_pass.yaml
+1 −1 fixtures/aws/cloudwatch_pass.yaml
+1 −1 fixtures/aws/minimal/aws_exec_pass.yaml
+1 −1 fixtures/aws/s3-protocol.yaml
+1 −1 fixtures/aws/s3_bucket_pass.yaml
+1 −1 fixtures/azure/devops.yaml
+1 −1 fixtures/datasources/GCP/database_backup.yaml
+1 −1 fixtures/datasources/GCP/folder_pass.yaml
+2 −2 fixtures/datasources/SFTP/sftp_fail_connection.yaml
+1 −1 fixtures/datasources/SFTP/sftp_pass.yaml
+1 −1 fixtures/datasources/alertmanager_mix.yaml
+1 −1 fixtures/datasources/folder_fail.yaml
+2 −2 fixtures/datasources/folder_pass.yaml
+1 −1 fixtures/datasources/mongo_fail.yaml
+1 −1 fixtures/datasources/mongo_pass.yaml
+1 −1 fixtures/datasources/mssql_fail.yaml
+1 −1 fixtures/datasources/mssql_pass.yaml
+1 −1 fixtures/datasources/mysql_fail.yaml
+1 −1 fixtures/datasources/mysql_pass.yaml
+1 −1 fixtures/datasources/posgres_stateful_pass.yaml
+1 −1 fixtures/datasources/postgres_fail.yaml
+1 −1 fixtures/datasources/postgres_pass.yaml
+1 −1 fixtures/datasources/prometheus.yaml
+1 −1 fixtures/datasources/redis_fail.yaml
+1 −1 fixtures/datasources/redis_pass.yaml
+1 −1 fixtures/datasources/s3_bucket_fail.yaml
+1 −1 fixtures/datasources/s3_bucket_pass.yaml
+1 −1 fixtures/elasticsearch/elasticsearch_fail.yaml
+1 −1 fixtures/elasticsearch/elasticsearch_pass.yaml
+1 −1 fixtures/git/exec_checkout_pass.yaml
+1 −1 fixtures/git/git_check_pass.yaml
+1 −1 fixtures/git/git_pull_push_pass.yaml
+1 −1 fixtures/git/git_test_expression_pass.yaml
+1 −1 fixtures/k8s/kubernetes-minimal_pass.yaml
+1 −1 fixtures/k8s/kubernetes_bundle.yaml
+1 −1 fixtures/k8s/kubernetes_pass.yaml
+1 −1 fixtures/k8s/pod_fail.yaml
+1 −1 fixtures/k8s/pod_pass.yaml
+19 −0 fixtures/k8s/secret_sanitize_fail.yaml
+1 −1 fixtures/k8s/slow/namespace_pass.yaml
+1 −1 fixtures/ldap/ldap_pass.yaml
+1 −1 fixtures/minimal/cel.yaml
+1 −1 fixtures/minimal/dns_fail.yaml
+1 −1 fixtures/minimal/exec_artifact.yaml
+1 −1 fixtures/minimal/exec_connection_aws_fail.yaml
+1 −1 fixtures/minimal/exec_env_pass.yaml
+1 −1 fixtures/minimal/exec_fail.yaml
+1 −1 fixtures/minimal/exec_pass.yaml
+1 −1 fixtures/minimal/http-check-labels.yaml
+1 −2 fixtures/minimal/http-templateBody.yaml
+25 −0 fixtures/minimal/http_auth_url_pass.yaml
+1 −1 fixtures/minimal/http_fail.yaml
+1 −1 fixtures/minimal/http_fail_connection.yaml
+1 −1 fixtures/minimal/http_pass_results_mode_pass.yaml
+1 −1 fixtures/minimal/http_pass_single.yaml
+1 −1 fixtures/minimal/http_template.yaml
+1 −1 fixtures/minimal/http_timeout_fail.yaml
+1 −1 fixtures/minimal/icmp_fail.yaml
+1 −1 fixtures/minimal/metrics.yaml
+1 −1 fixtures/minimal/namespaced_check_pass.yaml
+1 −1 fixtures/prometheus/jobs-fail-only.yaml
+1 −1 fixtures/prometheus/jobs.yaml
+1 −1 fixtures/quarantine/icmp_pass.yaml
+1 −1 fixtures/quarantine/s3_fail.yaml
+1 −1 fixtures/quarantine/smb_pass.yaml
+1 −1 fixtures/restic/restic_with_integrity_pass.yaml
+1 −1 fixtures/restic/restic_without_integrity_pass.yaml
+13 −4 go.mod
+25 −6 go.sum
+26 −17 pkg/api.go
+1 −1 pkg/cache/postgres.go
+3 −0 pkg/jobs/canary/sync.go
+3 −0 pkg/system_api.go
+17 −0 pkg/topology/component_relationship.go
2 changes: 1 addition & 1 deletion modules/mission-control
Submodule mission-control updated 53 files
+1 −0 .gitignore
+1 −1 Dockerfile
+2 −2 api/v1/playbook_types.go
+4 −6 cmd/playbook.go
+9 −0 cmd/server.go
+2 −2 db/playbooks.go
+0 −50 echo/properties.go
+1 −1 echo/serve.go
+18 −0 fixtures/playbooks/delayed-option.yaml
+72 −0 fixtures/playbooks/params.yaml
+2 −2 go.mod
+4 −4 go.sum
+29 −0 jobs/catalog.go
+8 −0 jobs/jobs.go
+1 −0 jobs/upstream.go
+17 −40 notification/cel.go
+1 −0 notification/context.go
+23 −19 notification/events.go
+58 −4 notification/notification_test.go
+19 −16 notification/send.go
+23 −9 notification/shoutrrr.go
+22 −0 notification/shoutrrr_test.go
+1 −1 notification/suite_test.go
+1 −1 notification/template.go
+4 −2 playbook/actions/actions.go
+31 −2 playbook/actions/gitops.go
+1 −1 playbook/actions/http.go
+31 −31 playbook/approval.go
+12 −6 playbook/controllers.go
+1 −0 playbook/events.go
+30 −11 playbook/playbook.go
+239 −127 playbook/playbook_test.go
+3 −1 playbook/run_consumer.go
+2 −2 playbook/runner/agent.go
+1 −1 playbook/runner/exec.go
+1 −1 playbook/runner/longpoll.go
+58 −30 playbook/runner/runner.go
+2 −2 playbook/runner/template.go
+2 −0 playbook/test.properties
+13 −5 playbook/testdata/agent-runner.yaml
+5 −0 push/push_test.go
+5 −4 push/topology.go
+29 −0 rbac/abac.go
+0 −59 rbac/adapter.go
+59 −0 rbac/adapter/permission.go
+8 −1 rbac/init.go
+19 −0 rbac/middleware.go
+2 −2 rbac/model.ini
+165 −163 rbac/objects.go
+2 −2 rbac/policy.go
+97 −0 rbac/rbac_test.go
+2 −2 upstream/upstream_test.go
+0 −86 utils/expression/expression.go
Loading
Loading