Skip to content

Commit c38e98b

Browse files
authored
Merge pull request #36 from osodevops/fix/issue-35-scram-sasl-mechanism
fix: SCRAM-SHA-512 auth fails due to invalid sasl_mechanism in generated config
2 parents a557730 + d922083 commit c38e98b

8 files changed

Lines changed: 64 additions & 6 deletions

File tree

CHANGELOG.md

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

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

5+
## 0.2.11 - 2026-07-03
6+
7+
### Fixed
8+
9+
- Write `sasl_mechanism: SCRAM-SHA512` (no hyphen before the digits) into generated backup and restore ConfigMaps. The kafka-backup binary's config parser only accepts `SCRAM-SHA512`, so jobs for resources using `authentication.type: scram-sha-512` failed on startup with `unknown variant 'SCRAM-SHA-512'`. Fixes [#35](https://github.com/osodevops/strimzi-backup-operator/issues/35).
10+
511
## 0.2.10 - 2026-06-12
612

713
### Added

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "kafka-backup-operator"
3-
version = "0.2.10"
3+
version = "0.2.11"
44
edition = "2021"
55
rust-version = "1.88"
66
license = "Apache-2.0"

deploy/helm/strimzi-backup-operator/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ apiVersion: v2
22
name: strimzi-backup-operator
33
description: Kubernetes operator for Kafka backup and restore, integrated with Strimzi
44
type: application
5-
version: 0.2.10
6-
appVersion: "0.2.10"
5+
version: 0.2.11
6+
appVersion: "0.2.11"
77
home: https://github.com/osodevops/strimzi-backup-operator
88
sources:
99
- https://github.com/osodevops/strimzi-backup-operator

src/adapters/backup_config.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ fn build_kafka_config(
150150
} => {
151151
security.insert(
152152
Value::String("sasl_mechanism".to_string()),
153-
Value::String("SCRAM-SHA-512".to_string()),
153+
Value::String(super::SASL_MECHANISM_SCRAM_SHA512.to_string()),
154154
);
155155
security.insert(
156156
Value::String("sasl_username".to_string()),
@@ -560,6 +560,25 @@ mod tests {
560560
assert!(yaml.contains("rdkafka: info"));
561561
}
562562

563+
/// Issue #35: the kafka-backup binary's config parser only accepts
564+
/// `SCRAM-SHA512` (no hyphen before the digits); `SCRAM-SHA-512` is
565+
/// rejected with "unknown variant".
566+
#[test]
567+
fn test_scram_auth_emits_binary_compatible_sasl_mechanism() {
568+
let backup = test_backup();
569+
let auth = ResolvedAuth::ScramSha512 {
570+
username: "kafka-backup".to_string(),
571+
secret_name: "kafka-backup".to_string(),
572+
password_key: "password".to_string(),
573+
};
574+
let yaml = build_backup_config_yaml(&backup, &test_cluster(), &None, &auth).unwrap();
575+
let config: Value = serde_yaml::from_str(&yaml).unwrap();
576+
assert_eq!(
577+
config["source"]["security"]["sasl_mechanism"].as_str(),
578+
Some("SCRAM-SHA512")
579+
);
580+
}
581+
563582
#[test]
564583
fn test_default_backup_id_uses_env_var() {
565584
let backup = test_backup();

src/adapters/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@ pub mod logging_config;
33
pub mod restore_config;
44
pub mod secrets;
55
pub mod storage_config;
6+
7+
/// SASL mechanism value for SCRAM-SHA-512 as the kafka-backup binary's config
8+
/// parser expects it: `SCRAM-SHA512`, with no hyphen before the digits. The
9+
/// binary rejects the IANA spelling `SCRAM-SHA-512` with "unknown variant"
10+
/// (issue #35).
11+
pub(crate) const SASL_MECHANISM_SCRAM_SHA512: &str = "SCRAM-SHA512";

src/adapters/restore_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ fn build_kafka_config(
126126
ResolvedAuth::ScramSha512 { username, .. } => {
127127
security.insert(
128128
Value::String("sasl_mechanism".to_string()),
129-
Value::String("SCRAM-SHA-512".to_string()),
129+
Value::String(super::SASL_MECHANISM_SCRAM_SHA512.to_string()),
130130
);
131131
security.insert(
132132
Value::String("sasl_username".to_string()),

tests/integration/restore_test.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,33 @@ fn test_restore_config_topic_selection() {
351351
assert_eq!(topics["exclude"][0].as_str(), Some("*-internal"));
352352
}
353353

354+
/// Issue #35: the kafka-backup binary's config parser only accepts
355+
/// `SCRAM-SHA512` (no hyphen before the digits); `SCRAM-SHA-512` is
356+
/// rejected with "unknown variant".
357+
#[test]
358+
fn test_restore_scram_auth_emits_binary_compatible_sasl_mechanism() {
359+
let restore = sample_restore();
360+
let backup = sample_backup();
361+
let cluster = sample_cluster();
362+
let auth = ResolvedAuth::ScramSha512 {
363+
username: "kafka-backup".to_string(),
364+
secret_name: "kafka-backup".to_string(),
365+
password_key: "password".to_string(),
366+
};
367+
368+
let yaml = build_restore_config_yaml(&restore, &backup, &cluster, &None, &auth).unwrap();
369+
370+
let config: serde_yaml::Value = serde_yaml::from_str(&yaml).unwrap();
371+
assert_eq!(
372+
config["target"]["security"]["sasl_mechanism"].as_str(),
373+
Some("SCRAM-SHA512")
374+
);
375+
assert_eq!(
376+
config["target"]["security"]["security_protocol"].as_str(),
377+
Some("SASL_SSL")
378+
);
379+
}
380+
354381
#[test]
355382
fn test_restore_config_omits_topic_selection_by_default() {
356383
let restore = sample_restore();

0 commit comments

Comments
 (0)