SchemaRegistryBackup
A SchemaRegistryBackup is used for backing up schemas from a SchemaRegistry, and offloading them to a Storage. It is configured by creating a SchemaRegistryBackup resource in Kubernetes.
The Kannika Armory Operator creates a Pod that runs the backup process, based on the configuration in the SchemaRegistryBackup resource.
SchemaRegistryBackups can be managed using the kubectl command line tool,
and are available by the name schemaregistrybackup or schemaregistrybackups.
$ kubectl get schemaregistrybackupsNAME STATUSconfluent-registry-backup RunningBackup Status
Section titled “Backup Status”A SchemaRegistryBackup can have the following statuses:
- Paused The Backup is configured but it has not been started yet or it has been paused;
- Initializing The Backup process is being created;
- Running The Backup is running and backing up data to the storage;
- Error The Backup has failed, and no data is being backed up.
Additionally,
a SchemaRegistryBackup resource exposes a DeploymentReady Condition to report on the state of the underlying Deployment.
This condition’s status can either be ‘True’ or ‘False’,
indicating whether this Backup’s deployment is healthy.
The condition’s reason gives additional context and may be one of the following:
- DeploymentReady the deployment is healthy;
- DeploymentError the deployment encountered an error: check the status of this deployment to find out what happened;
- DeploymentDeleted somebody or something deleted the deployment and this should be a transient state;
- DeploymentStateUnknown the deployment state is unknown, perhaps due to an error talking with the kubernetes API.
Configuring a SchemaRegistryBackup
Section titled “Configuring a SchemaRegistryBackup”The following is an example of a SchemaRegistryBackup.
apiVersion: kannika.io/v1alphakind: SchemaRegistryBackupmetadata: name: confluent-registry-backupspec: enabled: true registry: confluent-registry registryCredentialsFrom: credentialsRef: name: confluent-registry-creds storage: s3-storage storageCredentialsFrom: credentialsRef: name: s3-storage-creds # An optional explicit interval between backups in seconds backupIntervalSecs: 15 extraEnvVars: - name: RUST_LOG value: debugFull example with SchemaRegistry, Credentials, and Storage
# Secret - holds the registry's HTTP Basic credentialsapiVersion: v1kind: Secrettype: Opaquemetadata: name: confluent-registry-secretdata: username: bXktdXNlcm5hbWU= # base64 encoded password: bXktcGFzc3dvcmQ= # base64 encoded---# Credentials - defines authentication to the schema registryapiVersion: kannika.io/v1alphakind: Credentialsmetadata: name: confluent-registry-credsspec: httpBasic: usernameFrom: secretKeyRef: name: confluent-registry-secret key: username passwordFrom: secretKeyRef: name: confluent-registry-secret key: password---# SchemaRegistry - defines the connection to the schema registryapiVersion: kannika.io/v1alphakind: SchemaRegistrymetadata: name: confluent-registryspec: confluent: url: https://registry.example.com---# Secret - holds the S3 access keysapiVersion: v1kind: Secrettype: Opaquemetadata: name: aws-credsdata: accessKeyId: bXktYWNjZXNzLWtleQ== # base64 encoded secretAccessKey: bXktc2VjcmV0LWtleQ== # base64 encoded---# Credentials - defines authentication to the S3 bucketapiVersion: kannika.io/v1alphakind: Credentialsmetadata: name: s3-storage-credsspec: aws: accessKeyIdFrom: secretKeyRef: name: aws-creds key: accessKeyId secretAccessKeyFrom: secretKeyRef: name: aws-creds key: secretAccessKey---# Storage - defines where the schemas are storedapiVersion: kannika.io/v1alphakind: Storagemetadata: name: s3-storagespec: s3: bucket: my-schemas-bucket region: eu-west-1---# SchemaRegistryBackup - backs up schemas from the registry to the StorageapiVersion: kannika.io/v1alphakind: SchemaRegistryBackupmetadata: name: confluent-registry-backupspec: enabled: true registry: confluent-registry registryCredentialsFrom: credentialsRef: name: confluent-registry-creds storage: s3-storage storageCredentialsFrom: credentialsRef: name: s3-storage-credsIn this example:
-
A SchemaRegistryBackup named
confluent-registry-backupis created, as indicated by the.metadata.namefield. This name will inherited by the Pod running the backup process. -
The backup is enabled by setting the
spec.enabledtotrue. Unless this flag is set, the backup container will not be started. -
The SchemaRegistryBackup will connect to the
confluent-registrySchemaRegistry to fetch schemas, as indicated by the.spec.registryfield, and use the Credentials referenced byconfluent-registry-credsfor authentication. -
The SchemaRegistryBackup will write data to the
s3-storageStorage defined in thespec.storagefield, and use the Credentials referenced bys3-storage-credsto authenticate to it. -
The interval between API fetches and synchronization with the remote storage is set to 15 seconds by the
spec.backupIntervalSecsfield. If not specified, backups will occur every 3600 seconds. -
The
spec.extraEnvfield is used to pass additional environment variables to the backup container. In this case, theRUST_LOGvariable is set todebugto enable debug logging from the backup process.
What is backed up
Section titled “What is backed up”A SchemaRegistryBackup backs up all subjects and all their schema versions. No additional configuration is required.
Subjects are backed up from all schema contexts of the schema registry.
Subjects in a named context are backed up under their fully qualified name,
for example :.production:orders-value.
Subjects in the default context keep their plain name.
Schema registries without context support are not affected.
Soft-deleted subjects and soft-deleted schema versions are included in the backup. Permanently deleted subjects cannot be recovered from the registry and are not included.
See Schema Registry Backups for the layout of the backed-up schemas in the storage.

