Runbook Yaml
1
apiVersion: platform.plural.sh/v1alpha1
2
kind: Runbook
3
metadata:
4
name: scaling-manual
5
labels:
6
platform.plural.sh/pinned: 'true'
7
{{ include "ghost.labels" . | indent 4 }}
8
spec:
9
name: Ghost Scaling
10
description: overview of how to accurately scale ghost deployment
11
display: |-
12
{{ .Files.Get "runbooks/scaling.xml" | indent 4 }}
13
datasources:
14
- name: cpu
15
type: prometheus
16
prometheus:
17
format: cpu
18
legend: $pod
19
query: sum(rate(container_cpu_usage_seconds_total{namespace="{{ .Release.Namespace }}",pod=~"ghost-[0-9]+"}[5m])) by (pod)
20
- name: memory
21
type: prometheus
22
prometheus:
23
format: memory
24
legend: $pod
25
query: sum(container_memory_working_set_bytes{namespace="{{ .Release.Namespace }}",pod=~"ghost-[0-9]+"}) by (pod)
26
- name: statefulset
27
type: kubernetes
28
kubernetes:
29
resource: statefulset
30
name: ghost
31
- name: nodes
32
type: nodes
33
actions:
34
- name: scale
35
action: config
36
redirectTo: '/'
37
configuration:
38
updates:
39
- path:
40
- ghost
41
- resources
42
- requests
43
- cpu
44
valueFrom: cpu
45
- path:
46
- ghost
47
- resources
48
- requests
49
- memory
50
valueFrom: memory
Copied!
Each datasource has a type. At the moment, the only types Plural supports are prometheus, kubernetes, and nodes. Each type has a spec that's specific to the type.
  • prometheus
    spec:
    • format
    • legend
    • query
  • kubernetes
    spec:
    • resource
    • name -- the namespace of the kubernetes resource
  • nodes
    This just fetches all the nodes in the Kubernetes cluster
Additionally, in runbooks.yaml, you can define a specific action that the runbook can take based off of context from what the user input has given it.
For example, in the file above, we've defined an action that allows the runbook to update the home values file for that installation. It's done by yaml path, which means it will recursively update ghost.resources.request.cpu.
This will update the yaml file, save it back, issue a commit, and create a build in the console to actually apply the change.
Copy link
Edit on GitHub