Skip to main content

Reference

PostgreSQLServerConfig example (YAML)

apiVersion: k8s.otterize.com/v1alpha3
kind: PostgreSQLServerConfig
metadata:
name: postgres-tutorial-db # database instance name - should match the target in ClientIntents
namespace: otterize-tutorial-postgres
spec:
address: <PGHOST:PGPORT> # Your Postgres address
credentials:
# Username Otterize will connect with & configure permissions as; optional, can be omitted if using a secretRef
username: <PGUSER>
# Password for the above username; optional, can be omitted if using a secretRef
password: <PGPASSWORD>
# Secret containing the database credentials; optional, can be omitted if using the above username & password fields
secretRef:
# Name of the secret containing the database credentials; required
name: postgres-credentials
# Namespace where the secret is stored; optional, defaults to the namespace of the PostgreSQLServerConfig
namespace: otterize-tutorial-postgres
# Key in the secret containing the username; optional, defaults to 'username'
usernameKey: username
# Key in the secret containing the password; optional, defaults to 'password'
passwordKey: password

ClientIntents example (YAML)

apiVersion: k8s.otterize.com/v1alpha3
kind: ClientIntents
metadata:
name: client-intents-for-server
namespace: otterize-tutorial-postgres
spec:
service:
# Service requiring access to PostgreSQL
name: server
calls:
# This name will need to match the PostgreSQLServerConfig metadata.name field
- name: postgres-tutorial-db
type: database
databaseResources:
- databaseName: otterize-tutorial
# Optional table name, if omitted all tables will be granted access
table: public.example
# Operations being granted, options include SELECT, INSERT, UPDATE, DELETE, ALL
operations:
- SELECT
- INSERT