Skip to content

KafkaSchema

Usage example

Example
apiVersion: aiven.io/v1alpha1
kind: KafkaSchema
metadata:
  name: my-schema
spec:
  authSecretRef:
    name: aiven-token
    key: token

  project: my-aiven-project
  serviceName: my-kafka
  subjectName: mny-subject
  compatibilityLevel: BACKWARD
  schema: |
    {
        "doc": "example_doc",
        "fields": [{
            "default": 5,
            "doc": "field_doc",
            "name": "field_name",
            "namespace": "field_namespace",
            "type": "int"
        }],
        "name": "example_name",
        "namespace": "example_namespace",
        "type": "record"
    }

Info

To create this resource, a Secret containing Aiven token must be created first.

Apply the resource with:

kubectl apply -f example.yaml

Verify the newly created KafkaSchema:

kubectl get kafkaschemas my-schema

The output is similar to the following:

Name         Service Name    Project             Subject        Compatibility Level    Version      
my-schema    my-kafka        my-aiven-project    mny-subject    BACKWARD               <version>    

KafkaSchema

KafkaSchema is the Schema for the kafkaschemas API.

Required

  • apiVersion (string). Value aiven.io/v1alpha1.
  • kind (string). Value KafkaSchema.
  • metadata (object). Data that identifies the object, including a name string and optional namespace.
  • 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 configuration should be a valid Avro Schema JSON format.
  • serviceName (string, Immutable, Pattern: ^[a-z][-a-z0-9]+$, MaxLength: 63). Specifies the name of the service that this resource belongs to.
  • subjectName (string, MaxLength: 63). 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.
  • schemaType (string, Enum: AVRO, JSON, PROTOBUF). Schema type.

authSecretRef

Appears on spec.

Authentication reference to Aiven token in a secret.

Required

  • key (string, MinLength: 1).
  • name (string, MinLength: 1).