This check will try to connect to a specified Postgresql database, run a query against it and verify the results.
Example
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: postgres-check
spec:
interval: 30
spec:
postgres:
- connection: "postgres://$(username):$(password)@postgres.default.svc:5432/postgres?sslmode=disable"
auth:
username:
valueFrom:
secretKeyRef:
name: postgres-credentials
key: USERNAME
password:
valueFrom:
secretKeyRef:
name: postgres-credentials
key: PASSWORD
query: SELECT current_schemas(true)
display:
template: |
{{- range $r := .results.rows }}
{{- $r.current_schemas}}
{{- end}}
results: 1
Field |
Description |
Scheme |
Required |
auth |
username and password value, configMapKeyRef or SecretKeyRef for Postgres server |
Authentication |
|
connection |
connection string to connect to the server |
string |
Yes |
description |
Description for the check |
string |
|
display |
Template to display query results in text (overrides default bar format for UI) |
Template |
|
icon |
Icon for overwriting default icon on the dashboard |
string |
|
name |
Name of the check |
string |
|
query |
query that needs to be executed on the server |
string |
Yes |
results |
Number rows to check for |
int |
Yes |
test |
Template to test the result against |
Template |
|
Field |
Description |
Scheme |
Required |
password |
Set password for authentication using string, configMapKeyRef, or SecretKeyRef. |
kommons.EnvVar |
Yes |
username |
Set username for authentication using string, configMapKeyRef, or SecretKeyRef. |
kommons.EnvVar |
Yes |
Field |
Description |
Scheme |
Required |
jsonPath |
Specify path to JSON element for use in template |
string |
|
template |
Specify Go template for use |
string |
|
expr |
Specify expression for use in template |
string |
|
javascript |
Specify javascript syntax for template |
string |
|