Plural Custom Resources

dashboards.yaml

Dashboards are the source of truth for the Dashboards section in plural. They're very similar in structure to grafana dashboards, and you can actually scaffold them from existing grafana dashboards using the plural from-grafana command.
1
apiVersion: platform.plural.sh/v1alpha1
2
kind: Dashboard
3
metadata:
4
name: dashboard-name
5
spec:
6
name: postgres # name of the dashboard in the console UI
7
description: Monitoring for hasura's postgres db # short description
8
timeslices: [30m, 1h, 2h, 1d] # durations options to allow display for
9
defaultTime: 30m
10
labels: # global values to slice the dashboard further
11
- name: instance
12
query:
13
query: pg_stat_database_tup_fetched{namespace="{{ .Release.Namespace }}"}
14
label: instance
15
graphs:
16
- queries: # list of grouped prometheus queries per graph
17
- query: SUM(pg_stat_database_tup_fetched{instance=~"$instance"})
18
legend: tuples fetched
19
- query: SUM(pg_stat_database_tup_inserted{instance=~"$instance"})
20
legend: tuples inserted
21
- query: SUM(pg_stat_database_tup_updated{instance=~"$instance"})
22
legend: tuples updated
23
name: Storage Performance
24
- queries:
25
- query: pg_settings_max_connections{instance="$instance"}
26
legend: connections
27
name: Max Connections
28
- queries:
29
- query: avg(rate(process_cpu_seconds_total{instance="$instance"}[5m]) * 1000)
30
legend: seconds
31
name: CPU time
32
- queries:
33
- query: avg(rate(process_resident_memory_bytes{instance="$instance"}[5m]))
34
legend: resident mem
35
- query: avg(rate(process_virtual_memory_bytes{instance="$instance"}[5m]))
36
legend: process mem
37
format: bytes
38
name: Memory utilization
39
- queries:
40
- query: process_open_fds{instance="$instance"}
41
legend: fds
42
name: Open file descriptors
43
- queries:
44
- query: pg_settings_max_wal_size_bytes{instance="$instance"}
45
legend: WAL size
46
name: Max WAL size
47
- queries:
48
- query: irate(pg_stat_database_xact_commit{instance="$instance"}[5m])
49
legend: commits
50
- query: irate(pg_stat_database_xact_rollback{instance="$instance"}[5m])
51
legend: rollbacks
52
name: Transactions
53
- queries:
54
- query: pg_stat_database_blks_hit{instance="$instance"} / (pg_stat_database_blks_read{instance="$instance"} + pg_stat_database_blks_hit{instance="$instance"})
55
legend: hit rate
56
name: Cache hit rate
Copied!

runbook.yaml

Runbooks are dynamically generated web interfaces to provide guided experiences for operational interactions within Plural. A common one that's needed is managing the database for an application, shown here, but they're meant to be adaptable to a wide array of operational use-cases. The api is also naturally extensible if other datasources are needed.
1
apiVersion: platform.plural.sh/v1alpha1
2
kind: Runbook
3
metadata:
4
name: db-scaling
5
labels:
6
platform.plural.sh/pinned: 'true' # whether this runbook should be on the homepage
7
spec:
8
name: Postgres Scaling
9
description: overview of how to accurately scale hasura's postgres instance
10
alerts: # Alertmanager alerts to bind to this runbook
11
- name: HasuraPostgresCPU
12
- name: HasuraPostgresMEM
13
display: |- # xml template for the layout of the runbook
14
{{ .Files.Get "runbooks/db-scaling.xml" | indent 4 }}
15
datasources: # list of datasources to hydrate the runbook
16
- name: cpu
17
type: prometheus # prometheus query datasource
18
prometheus:
19
format: cpu
20
legend: $pod
21
query: sum(rate(container_cpu_usage_seconds_total{namespace="{{ .Release.Namespace }}",pod=~"plural-hasura-[0-9]+"}[5m])) by (pod)
22
- name: memory
23
type: prometheus
24
prometheus:
25
format: memory
26
legend: $pod
27
query: sum(container_memory_working_set_bytes{namespace="{{ .Release.Namespace }}",pod=~"plural-hasura-[0-9]+"}) by (pod)
28
- name: statefulset
29
type: kubernetes # kubernetes api call
30
kubernetes:
31
resource: statefulset
32
name: plural-hasura
33
- name: volume
34
type: prometheus
35
prometheus:
36
format: none
37
legend: $persistentvolumeclaim
38
query: (kubelet_volume_stats_capacity_bytes{namespace="{{ .Release.Namespace }}", persistentvolumeclaim=~"pgdata-plural-hasura-.*"} - kubelet_volume_stats_available_bytes{namespace="{{ .Release.Namespace }}", persistentvolumeclaim=~"pgdata-plural-hasura-.*"}) / kubelet_volume_stats_capacity_bytes{namespace="{{ .Release.Namespace }}", persistentvolumeclaim=~"pgdata-plural-hasura-.*"}
39
- name: nodes
40
type: nodes # nodes api call
41
actions: # actions to perform on form submits
42
- name: scale
43
action: config
44
redirectTo: '/'
45
configuration:
46
updates: # path update into helm values
47
- path:
48
- hasura
49
- postgres
50
- resources
51
- requests
52
- cpu
53
valueFrom: cpu
54
- path:
55
- hasura
56
- postgres
57
- resources
58
- requests
59
- memory
60
valueFrom: memory
61
- path:
62
- hasura
63
- postgres
64
- replicas
65
valueFrom: replicas
66
- path:
67
- hasura
68
- postgres
69
- storage
70
- size
71
valueFrom: volume
Copied!

proxies.yaml

These drive the plural proxy connect command, and can be used to establish local connections to databases or private web interfaces running in your cluster.
1
apiVersion: platform.plural.sh/v1alpha1
2
kind: Proxy
3
metadata:
4
name: db
5
spec:
6
type: db # establishes a db shell
7
target: service/hasura-master
8
credentials:
9
secret: hasura.plural-hasura.credentials.postgresql.acid.zalan.do
10
key: password
11
user: hasura
12
dbConfig:
13
name: hasura
14
engine: postgres
15
port: 5432
Copied!

configurationOverlay.yaml

These drive form fields which can customize applications in the console's Configuration section. At the moment they resolve to a helm values update according to a yaml path.
1
{{- define "nocodb.config-overlay" -}}
2
apiVersion: platform.plural.sh/v1alpha1
3
kind: ConfigurationOverlay
4
metadata:
5
name: my-overlay
6
spec:
7
name: Airflow Registry
8
documentation: docker repository to use for airflow (default is dkr.plural.sh/airflow/apache/airflow)
9
updates: # a helm path update fo
10
- path: ['airflow', 'airflow', 'airflow', 'image', 'repository']
Copied!