Skip to main content

Reference

MySQLServerConfig example (YAML)

apiVersion: k8s.otterize.com/v1alpha3
kind: MySQLServerConfig
metadata:
name: mysql-tutorial-db # database instance name - should match the target in ClientIntents
namespace: otterize-tutorial-mysql
spec:
address: <HOST:PORT> # Your MySQL servers address
credentials:
# Username Otterize will connect with & configure permissions as; optional, can be omitted if using a secretRef
username: <USER>
# Password for the above username; optional, can be omitted if using a secretRef
password: <PASSWORD>
# 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: mysql-credentials
# Namespace where the secret is stored; optional, defaults to the namespace of the MySQLServerConfig
namespace: otterize-tutorial-mysql
# 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-mysql
spec:
service:
# Service requiring access to MySQL
name: server
calls:
# This name will need to match the MySQLServerConfig metadata.name field
- name: otterize-tutorial-mysql
type: database
databaseResources:
- databaseName: otterize_tutorial
# Optional table name, if omitted all tables will be granted access
table: example
# Operations being granted, options include SELECT, INSERT, UPDATE, DELETE, ALL
operations:
- SELECT
- INSERT