Skip to content

Commit d40a4d0

Browse files
committed
fix: support backup logging configuration
1 parent 3238dfb commit d40a4d0

24 files changed

Lines changed: 590 additions & 35 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Thumbs.db
1616
# Environment
1717
.env
1818
.env.local
19+
AGENTS.md
1920

2021
# Build artifacts
2122
*.o

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## Unreleased
6+
7+
### Added
8+
9+
- Add first-class `spec.logging` and `spec.env` support for `KafkaBackup` and `KafkaRestore` job pods. Fixes [#18](https://github.com/osodevops/strimzi-backup-operator/issues/18).
10+
11+
### Changed
12+
13+
- Update the default `kafka-backup` job image to `osodevops/kafka-backup:v0.15.5`.
14+
515
## 0.2.2 - 2026-04-28
616

717
### Fixed

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,15 @@ spec:
117117
backup:
118118
compression: zstd
119119
parallelism: 4
120+
logging:
121+
level: warn
122+
format: json
123+
modules:
124+
kafka_backup: warn
125+
rdkafka: info
126+
env:
127+
- name: RUST_LOG
128+
value: "kafka_backup=warn,rdkafka=info"
120129
schedule:
121130
cron: "0 2 * * *" # Daily at 2 AM
122131
timezone: "Europe/London"
@@ -141,6 +150,9 @@ spec:
141150
name: my-cluster-backup
142151
pointInTime:
143152
timestamp: "2026-02-12T14:30:00.000Z"
153+
logging:
154+
level: info
155+
format: json
144156
topicMapping:
145157
- sourceTopic: orders
146158
targetTopic: orders-restored
@@ -282,6 +294,53 @@ spec:
282294
| `resources.limits.cpu` | CPU limit | `500m` |
283295
| `resources.limits.memory` | Memory limit | `512Mi` |
284296

297+
## Logging
298+
299+
The operator deployment and the backup/restore job pods are configured separately.
300+
301+
Configure the operator deployment log level with Helm:
302+
303+
```yaml
304+
logging:
305+
level: "info,kafka_backup_operator=debug"
306+
format: json
307+
```
308+
309+
Configure `kafka-backup` job logging on each `KafkaBackup` or `KafkaRestore`:
310+
311+
```yaml
312+
apiVersion: kafkabackup.com/v1alpha1
313+
kind: KafkaBackup
314+
metadata:
315+
name: debug-backup
316+
namespace: kafka
317+
spec:
318+
strimziClusterRef:
319+
name: my-kafka-cluster
320+
storage:
321+
type: s3
322+
s3:
323+
bucket: my-kafka-backups
324+
region: eu-west-1
325+
logging:
326+
level: warn
327+
format: json
328+
output: stderr
329+
modules:
330+
kafka_backup: warn
331+
rdkafka: info
332+
```
333+
334+
For environment-based logging, use top-level `spec.env`; these entries are added
335+
to backup and restore job containers:
336+
337+
```yaml
338+
spec:
339+
env:
340+
- name: RUST_LOG
341+
value: "kafka_backup=warn,rdkafka=info"
342+
```
343+
285344
## Monitoring
286345

287346
The operator exposes Prometheus metrics on port `9090` at `/metrics`:

config/examples/kafka-backup-s3.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ spec:
4141
parallelism: 4
4242
stopAtCurrentOffsets: true
4343

44+
logging:
45+
level: warn
46+
format: json
47+
modules:
48+
kafka_backup: warn
49+
rdkafka: info
50+
51+
env:
52+
- name: RUST_LOG
53+
value: "kafka_backup=warn,rdkafka=info"
54+
4455
schedule:
4556
cron: "0 2 * * *"
4657
timezone: "UTC"

config/examples/kafka-restore-pitr.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ spec:
2121
pointInTime:
2222
timestamp: "2026-02-13T01:30:00.000Z"
2323

24+
logging:
25+
level: info
26+
format: json
27+
28+
env:
29+
- name: RUST_LOG
30+
value: "kafka_backup=info,rdkafka=warn"
31+
2432
topicMapping:
2533
- sourceTopic: "orders"
2634
targetTopic: "orders-restored"

deploy/crds/kafkabackups.yaml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,55 @@ spec:
246246
type: string
247247
type: array
248248
type: object
249+
env:
250+
description: Additional environment variables for backup job pods
251+
items:
252+
type: object
253+
x-kubernetes-preserve-unknown-fields: true
254+
type: array
249255
image:
250-
description: 'Container image for the backup job (default: osodevops/kafka-backup:v0.15.3)'
256+
description: 'Container image for the backup job (default: osodevops/kafka-backup:v0.15.5)'
251257
nullable: true
252258
type: string
259+
logging:
260+
description: Logging configuration for backup job pods
261+
nullable: true
262+
properties:
263+
format:
264+
description: 'Log format: text or json'
265+
nullable: true
266+
type: string
267+
level:
268+
description: 'Default log level: error, warn, info, debug, or trace'
269+
nullable: true
270+
type: string
271+
modules:
272+
additionalProperties:
273+
type: string
274+
description: Module-specific log levels
275+
type: object
276+
output:
277+
description: 'Log output: stderr, stdout, or a file path supported by kafka-backup'
278+
nullable: true
279+
type: string
280+
rotation:
281+
description: File log rotation settings
282+
nullable: true
283+
properties:
284+
maxFiles:
285+
description: Maximum number of rotated log files to keep
286+
format: uint32
287+
minimum: 0.0
288+
nullable: true
289+
type: integer
290+
maxSizeMb:
291+
description: Maximum size of a log file before rotation, in MiB
292+
format: uint64
293+
minimum: 0.0
294+
nullable: true
295+
type: integer
296+
type: object
297+
type: object
253298
metrics:
254299
description: Metrics configuration for backup job pods
255300
nullable: true

deploy/crds/kafkarestores.yaml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,55 @@ spec:
179179
nullable: true
180180
type: string
181181
type: object
182+
env:
183+
description: Additional environment variables for restore job pods
184+
items:
185+
type: object
186+
x-kubernetes-preserve-unknown-fields: true
187+
type: array
182188
image:
183-
description: 'Container image for the restore job (default: osodevops/kafka-backup:v0.15.3)'
189+
description: 'Container image for the restore job (default: osodevops/kafka-backup:v0.15.5)'
184190
nullable: true
185191
type: string
192+
logging:
193+
description: Logging configuration for restore job pods
194+
nullable: true
195+
properties:
196+
format:
197+
description: 'Log format: text or json'
198+
nullable: true
199+
type: string
200+
level:
201+
description: 'Default log level: error, warn, info, debug, or trace'
202+
nullable: true
203+
type: string
204+
modules:
205+
additionalProperties:
206+
type: string
207+
description: Module-specific log levels
208+
type: object
209+
output:
210+
description: 'Log output: stderr, stdout, or a file path supported by kafka-backup'
211+
nullable: true
212+
type: string
213+
rotation:
214+
description: File log rotation settings
215+
nullable: true
216+
properties:
217+
maxFiles:
218+
description: Maximum number of rotated log files to keep
219+
format: uint32
220+
minimum: 0.0
221+
nullable: true
222+
type: integer
223+
maxSizeMb:
224+
description: Maximum size of a log file before rotation, in MiB
225+
format: uint64
226+
minimum: 0.0
227+
nullable: true
228+
type: integer
229+
type: object
230+
type: object
186231
metrics:
187232
description: Metrics configuration for restore job pods
188233
nullable: true

deploy/helm/strimzi-backup-operator/crds/kafkabackups.yaml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,55 @@ spec:
246246
type: string
247247
type: array
248248
type: object
249+
env:
250+
description: Additional environment variables for backup job pods
251+
items:
252+
type: object
253+
x-kubernetes-preserve-unknown-fields: true
254+
type: array
249255
image:
250-
description: 'Container image for the backup job (default: osodevops/kafka-backup:v0.15.3)'
256+
description: 'Container image for the backup job (default: osodevops/kafka-backup:v0.15.5)'
251257
nullable: true
252258
type: string
259+
logging:
260+
description: Logging configuration for backup job pods
261+
nullable: true
262+
properties:
263+
format:
264+
description: 'Log format: text or json'
265+
nullable: true
266+
type: string
267+
level:
268+
description: 'Default log level: error, warn, info, debug, or trace'
269+
nullable: true
270+
type: string
271+
modules:
272+
additionalProperties:
273+
type: string
274+
description: Module-specific log levels
275+
type: object
276+
output:
277+
description: 'Log output: stderr, stdout, or a file path supported by kafka-backup'
278+
nullable: true
279+
type: string
280+
rotation:
281+
description: File log rotation settings
282+
nullable: true
283+
properties:
284+
maxFiles:
285+
description: Maximum number of rotated log files to keep
286+
format: uint32
287+
minimum: 0.0
288+
nullable: true
289+
type: integer
290+
maxSizeMb:
291+
description: Maximum size of a log file before rotation, in MiB
292+
format: uint64
293+
minimum: 0.0
294+
nullable: true
295+
type: integer
296+
type: object
297+
type: object
253298
metrics:
254299
description: Metrics configuration for backup job pods
255300
nullable: true

deploy/helm/strimzi-backup-operator/crds/kafkarestores.yaml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,55 @@ spec:
179179
nullable: true
180180
type: string
181181
type: object
182+
env:
183+
description: Additional environment variables for restore job pods
184+
items:
185+
type: object
186+
x-kubernetes-preserve-unknown-fields: true
187+
type: array
182188
image:
183-
description: 'Container image for the restore job (default: osodevops/kafka-backup:v0.15.3)'
189+
description: 'Container image for the restore job (default: osodevops/kafka-backup:v0.15.5)'
184190
nullable: true
185191
type: string
192+
logging:
193+
description: Logging configuration for restore job pods
194+
nullable: true
195+
properties:
196+
format:
197+
description: 'Log format: text or json'
198+
nullable: true
199+
type: string
200+
level:
201+
description: 'Default log level: error, warn, info, debug, or trace'
202+
nullable: true
203+
type: string
204+
modules:
205+
additionalProperties:
206+
type: string
207+
description: Module-specific log levels
208+
type: object
209+
output:
210+
description: 'Log output: stderr, stdout, or a file path supported by kafka-backup'
211+
nullable: true
212+
type: string
213+
rotation:
214+
description: File log rotation settings
215+
nullable: true
216+
properties:
217+
maxFiles:
218+
description: Maximum number of rotated log files to keep
219+
format: uint32
220+
minimum: 0.0
221+
nullable: true
222+
type: integer
223+
maxSizeMb:
224+
description: Maximum size of a log file before rotation, in MiB
225+
format: uint64
226+
minimum: 0.0
227+
nullable: true
228+
type: integer
229+
type: object
230+
type: object
186231
metrics:
187232
description: Metrics configuration for restore job pods
188233
nullable: true

0 commit comments

Comments
 (0)