Schedule icon
Request icon
Switch icon
SlackIncomingWebhook icon
If icon
Log icon

Karapace Schema Registry Subject Compatibility & Drift Compliance Gate

Audit Karapace Schema Registry subject compatibility modes, detect breaking schema drift, alert on Slack, and safely enforce backward compatibility.

Categories
Data

Aiven Karapace is the leading 100% open-source, Apache 2.0 licensed drop-in replacement for Kafka Schema Registry and REST Proxy. In enterprise event-driven architectures, schema registries enforce contracts between producers and consumers. A common operational failure occurs when registry compatibility modes are accidentally relaxed to NONE or FORWARD during ad-hoc testing or rogue CI/CD deployments. When compatibility guards are dropped, producers can publish backward-incompatible schemas that cause downstream streaming pipelines (such as Apache Flink, Spark Streaming, and Kafka consumer microservices) to fail on deserialization. This blueprint continuously audits Karapace global and subject compatibility settings, detects policy drift, alerts data governance teams via Slack, and provides guarded automated remediation to re-enforce strict compatibility rules.

How it works

  1. periodic_schema_compliance_audit (io.kestra.plugin.core.trigger.Schedule) initiates scheduled checks every 15 minutes. Shipped disabled so initial manual verification can be performed first.
  2. probe_global_config (io.kestra.plugin.core.http.Request) invokes GET /config on the Karapace REST API to inspect active global compatibility settings.
  3. probe_registered_subjects (io.kestra.plugin.core.http.Request) invokes GET /subjects to retrieve all registered topic schema subjects.
  4. classify_schema_compliance (io.kestra.plugin.core.flow.Switch) analyzes probe outputs:
    • COMPLIANCE_DRIFT_DETECTED: Fires if global compatibility level is set to NONE or FORWARD, dispatching a Slack alert via io.kestra.plugin.slack.notifications.SlackIncomingWebhook. If auto_remediate is enabled and dry_run is false, enforce_compatibility_policy executes PUT /config to restore BACKWARD_TRANSITIVE compliance.
    • NO_SUBJECTS_REGISTERED: Warns the engineering team via Slack if zero subjects are found, highlighting potential storage or connectivity loss.
    • COMPLIANT: Logs healthy schema contract enforcement and total subject counts.
  5. log_audit_summary (io.kestra.plugin.core.log.Log) records an immutable audit trail documenting evaluated subject counts and compliance outcome.
  6. Global errors handler catches connection timeouts or unreachable Karapace endpoints, dispatching an immediate incident notification to Slack.

What you get

  • Automated continuous surveillance of Kafka schema evolution policies across all registered event topics.
  • Early detection of breaking schema drift before incompatible payloads reach production streaming consumers.
  • Guarded automated remediation that safely restores BACKWARD_TRANSITIVE compatibility via the Karapace REST API.
  • Zero unexpected state changes: dry_run defaults to true to ensure full evaluation safety during onboarding.

Who it's for

  • Data Platform Engineers and Event Streaming Architects managing Apache Kafka and Karapace clusters.
  • Data Governance Teams responsible for event contract stability and schema lifecycle management.
  • SREs and Platform Teams maintaining real-time stream processing pipelines and preventing deserialization outages.

Why orchestrate this with Kestra

Karapace provides REST endpoints but lacks automated scheduling, alerting, or drift remediation mechanics. Standalone shell scripts lack secret masking, structured retries, execution timelines, and auditable governance. Kestra delivers a declarative, version-controlled YAML blueprint with native scheduling, secure credential handling, conditional routing, and complete execution observability.

Prerequisites

  • A running Karapace Schema Registry instance (version 3.0+) accessible over HTTP. Karapace publishes an official open-source Docker image (ghcr.io/aiven/karapace:latest) requiring no license or account.
  • An incoming Slack webhook URL for operational notifications.

Secrets

  • SLACK_WEBHOOK_URL: Slack incoming webhook URL for dispatching schema compliance alerts.

Quick start

  1. Start a local Karapace Schema Registry container:
    docker run -d --name karapace-test -p 8081:8081 -e KARAPACE_PORT=8081 ghcr.io/aiven/karapace:latest
    
  2. Configure the SLACK_WEBHOOK_URL secret in your Kestra namespace.
  3. Import this blueprint into Kestra and trigger an execution with default inputs (dry_run: true).
  4. Verify that log_compliant_state logs nominal compatibility.
  5. Test drift detection by temporarily relaxing the compatibility mode:
    curl -X PUT http://localhost:8081/config -H "Content-Type: application/vnd.schemaregistry.v1+json" -d '{"compatibility": "NONE"}'
    
  6. Re-run the flow to observe alert_drift_slack firing.
  7. Enable periodic_schema_compliance_audit to activate recurring 15-minute surveillance.

How to extend

  • Add per-subject compatibility iteration using io.kestra.plugin.core.flow.EachSequential to audit specific tier-1 subjects (orders-value, payments-value).
  • Integrate with PagerDuty via io.kestra.plugin.pagerduty.notifications.PagerDutyAlert for tier-1 streaming pipeline schema drift.
  • Push schema version metrics to Prometheus via io.kestra.plugin.prometheus for tracking schema evolution velocity over time.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.