KafkaOffsetRollback CRD
The KafkaOffsetRollback custom resource rolls consumer group offsets back to a saved snapshot.
Full Specification
apiVersion: kafka.oso.sh/v1alpha1
kind: KafkaOffsetRollback
metadata:
name: offset-rollback
namespace: kafka-backup
spec:
snapshotRef:
name: pre-restore-snapshot
pvcName: restore-workspace
path: snapshots/pre-restore-snapshot.json
restoreRef: production-restore
offsetResetRef: reset-from-restore
kafkaCluster:
bootstrapServers:
- kafka-0.kafka.svc:9092
- kafka-1.kafka.svc:9092
securityProtocol: SASL_SSL
caSecret: # optional: separate CA secret (e.g. Strimzi)
name: cluster-ca-cert
caKey: ca.crt
tlsSecret:
name: kafka-tls
saslSecret:
name: kafka-credentials
mechanism: SCRAM-SHA-512
connection:
connectionsPerBroker: 4
consumerGroups:
- order-processor
- payment-handler
dryRun: false
verifyAfterRollback: true
Spec Fields
snapshotRef
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Snapshot name or ID |
pvcName | string | No | PVC containing the snapshot |
path | string | No | Path to the snapshot file within the PVC |
restoreRef | string | No | KafkaRestore that created the snapshot |
offsetResetRef | string | No | KafkaOffsetReset that created the snapshot |
kafkaCluster
| Field | Type | Required | Description |
|---|---|---|---|
bootstrapServers | []string | Yes | Kafka broker addresses |
securityProtocol | string | No | PLAINTEXT, SSL, SASL_PLAINTEXT, or SASL_SSL |
tlsSecret | object | No | TLS certificate secret reference |
caSecret | object | No | Separate CA certificate secret (e.g. Strimzi cluster CA). Overrides caKey in tlsSecret when both are set |
saslSecret | object | No | SASL credentials secret reference |
connection | object | No | Kafka TCP connection tuning, including connectionsPerBroker |
Options
| Field | Type | Default | Description |
|---|---|---|---|
consumerGroups | []string | [] | Groups to roll back; empty uses all groups in the snapshot |
dryRun | bool | false | Validate without committing offsets |
verifyAfterRollback | bool | true | Verify offsets after rollback |
Example
apiVersion: kafka.oso.sh/v1alpha1
kind: KafkaOffsetRollback
metadata:
name: rollback-restore
spec:
snapshotRef:
name: pre-restore-snapshot
restoreRef: production-restore
kafkaCluster:
bootstrapServers:
- kafka:9092
consumerGroups:
- order-processor
verifyAfterRollback: true
Status
status:
phase: Completed
groupsRolledBack: 2
groupsFailed: 0
verification:
allMatched: true
totalGroups: 2
matchedGroups: 2