KafkaSchema
Prerequisites¶
- A Kubernetes cluster with the operator installed using helm, kubectl or kind (for local development).
- A Kubernetes Secret with an Aiven authentication token.
Required permissions¶
To create and manage this resource, you must have the appropriate roles or permissions. See the Aiven documentation for details on managing permissions.
This resource uses the following API operations, and for each operation, any of the listed permissions is sufficient:
| Operation | Permissions |
|---|---|
| ServiceGet | project:services:read |
| ServiceSchemaRegistrySubjectConfigPut | service:data:write |
| ServiceSchemaRegistrySubjectDelete | service:data:write |
| ServiceSchemaRegistrySubjectVersionGet | service:data:write |
| ServiceSchemaRegistrySubjectVersionPost | service:data:write |
| ServiceSchemaRegistrySubjectVersionsGet | service:data:write |
Usage examples¶
Apply the resource with:
Verify the newly created KafkaSchema:
The output is similar to the following:
Name Service Name Project Subject Version
order-event-pinned my-kafka my-aiven-project com.example.OrderEvent <version>
KafkaSchema¶
KafkaSchema is the Schema for the kafkaschemas API.
Self-references (A -> A) are blocked at admission; transitive cycles (A -> B -> A) are not detected at admission time.
Deletion: the operator performs a soft delete followed by a hard delete on the subject. The subject disappears from the registry's listing, re-applying a KafkaSchema with the same subjectName after deletion starts a brand-new subject at version 1.
Required
apiVersion(string). Valueaiven.io/v1alpha1.kind(string). ValueKafkaSchema.metadata(object). Data that identifies the object, including anamestring and optionalnamespace.spec(object). KafkaSchemaSpec defines the desired state of KafkaSchema. See below for nested schema.
spec¶
Appears on KafkaSchema.
KafkaSchemaSpec defines the desired state of KafkaSchema.
Required
project(string, Immutable, Pattern:^[a-zA-Z0-9_-]+$, MaxLength: 63). Identifies the project this resource belongs to.schema(string). Kafka Schema definition. Format depends on schemaType (AVRO/JSON/PROTOBUF).serviceName(string, Immutable, Pattern:^[a-z][-a-z0-9]+$, MaxLength: 63). Specifies the name of the service that this resource belongs to.subjectName(string, Immutable). Kafka Schema Subject name.
Optional
authSecretRef(object). Authentication reference to Aiven token in a secret. See below for nested schema.compatibilityLevel(string, Enum:BACKWARD,BACKWARD_TRANSITIVE,FORWARD,FORWARD_TRANSITIVE,FULL,FULL_TRANSITIVE,NONE). Kafka Schemas compatibility level.references(array of objects, MaxItems: 100). Schema references for Protobuf or JSON schemas that import other schemas. References must form a directed acyclic graph (DAG); cycles are not allowed. See below for nested schema.schemaType(string, Enum:AVRO,JSON,PROTOBUF, Immutable). Schema type.
authSecretRef¶
Appears on spec.
Authentication reference to Aiven token in a secret.
Required
references¶
Appears on spec.
SchemaReference is a reference to another schema in the registry. Exactly one of {subject+version} or kafkaSchemaRef must be set.
Required
name(string, MinLength: 1, MaxLength: 512). Name used to reference the schema (e.g., the import path in Protobuf).
Optional
-
kafkaSchemaRef(object). Reference to another KafkaSchema resource in the same namespace. Mutually exclusive with subject/version.Cleanup order matters: delete the dependent before the referent. See below for nested schema. -
subject(string, MinLength: 1, MaxLength: 512). Subject name of the referenced schema in the registry. Mutually exclusive with kafkaSchemaRef. -version(integer, Minimum: 1). Version of the referenced schema. Mutually exclusive with kafkaSchemaRef.
kafkaSchemaRef¶
Appears on spec.references.
Reference to another KafkaSchema resource in the same namespace. Mutually exclusive with subject/version.
Cleanup order matters: delete the dependent before the referent.
Required
name(string, MinLength: 1, MaxLength: 253). Name of the KafkaSchema resource in the same namespace.