Skip to content

Commit ebbb07a

Browse files
feat: Handle S3 region (#528)
* chore: Bump stackable-operator * feat: Handle s3 region * chore: Bump stackable-operator to 0.87.2 * chore: Update changelog --------- Co-authored-by: Techassi <[email protected]>
1 parent b28d8a4 commit ebbb07a

File tree

9 files changed

+98
-74
lines changed

9 files changed

+98
-74
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
1111
- Run a `containerdebug` process in the background of each Spark container to collect debugging information ([#508]).
1212
- Aggregate emitted Kubernetes events on the CustomResources ([#515]).
1313
- Support configuring JVM arguments ([#532]).
14+
- Support for S3 region ([#528]).
1415

1516
### Changed
1617

@@ -20,6 +21,7 @@ All notable changes to this project will be documented in this file.
2021
[#508]: https://github.com/stackabletech/spark-k8s-operator/pull/508
2122
[#514]: https://github.com/stackabletech/spark-k8s-operator/pull/514
2223
[#515]: https://github.com/stackabletech/spark-k8s-operator/pull/515
24+
[#528]: https://github.com/stackabletech/spark-k8s-operator/pull/528
2325
[#532]: https://github.com/stackabletech/spark-k8s-operator/pull/532
2426

2527
## [24.11.1] - 2025-01-10

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.nix

Lines changed: 24 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repository = "https://github.com/stackabletech/spark-k8s-operator"
1111

1212
[workspace.dependencies]
1313
stackable-versioned = { git = "https://github.com/stackabletech/operator-rs.git", features = ["k8s"], tag = "stackable-versioned-0.5.0" }
14-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.85.0" }
14+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.87.2" }
1515
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" }
1616

1717
anyhow = "1.0"
@@ -25,7 +25,7 @@ serde = { version = "1.0", features = ["derive"] }
2525
serde_json = "1.0"
2626
serde_yaml = "0.9"
2727
snafu = "0.8"
28-
strum = { version = "0.26", features = ["derive"] }
28+
strum = { version = "0.27", features = ["derive"] }
2929
tokio = { version = "1.39", features = ["full"] }
3030
tracing = "0.1"
3131
tracing-futures = { version = "0.2", features = ["futures-03"] }

crate-hashes.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/helm/spark-k8s-operator/crds/crds.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,20 @@ spec:
794794
minimum: 0.0
795795
nullable: true
796796
type: integer
797+
region:
798+
default:
799+
name: us-east-1
800+
description: |-
801+
Bucket region used for signing headers (sigv4).
802+
803+
This defaults to `us-east-1` which is compatible with other implementations such as Minio.
804+
805+
WARNING: Some products use the Hadoop S3 implementation which falls back to us-east-2.
806+
properties:
807+
name:
808+
default: us-east-1
809+
type: string
810+
type: object
797811
tls:
798812
description: Use a TLS connection. If not specified no TLS will be used.
799813
nullable: true
@@ -930,6 +944,20 @@ spec:
930944
minimum: 0.0
931945
nullable: true
932946
type: integer
947+
region:
948+
default:
949+
name: us-east-1
950+
description: |-
951+
Bucket region used for signing headers (sigv4).
952+
953+
This defaults to `us-east-1` which is compatible with other implementations such as Minio.
954+
955+
WARNING: Some products use the Hadoop S3 implementation which falls back to us-east-2.
956+
properties:
957+
name:
958+
default: us-east-1
959+
type: string
960+
type: object
933961
tls:
934962
description: Use a TLS connection. If not specified no TLS will be used.
935963
nullable: true
@@ -1249,6 +1277,20 @@ spec:
12491277
minimum: 0.0
12501278
nullable: true
12511279
type: integer
1280+
region:
1281+
default:
1282+
name: us-east-1
1283+
description: |-
1284+
Bucket region used for signing headers (sigv4).
1285+
1286+
This defaults to `us-east-1` which is compatible with other implementations such as Minio.
1287+
1288+
WARNING: Some products use the Hadoop S3 implementation which falls back to us-east-2.
1289+
properties:
1290+
name:
1291+
default: us-east-1
1292+
type: string
1293+
type: object
12521294
tls:
12531295
description: Use a TLS connection. If not specified no TLS will be used.
12541296
nullable: true

rust/operator-binary/src/crd/history.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ mod test {
484484
access_style: Default::default(),
485485
credentials: None,
486486
tls: TlsClientDetails { tls: None },
487+
region: Default::default(),
487488
},
488489
},
489490
prefix: "prefix".to_string(),

rust/operator-binary/src/crd/logdir.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl S3LogDir {
182182
pub fn history_server_spark_config(&self) -> Result<BTreeMap<String, String>, Error> {
183183
let connection = &self.bucket.connection;
184184

185-
Ok(BTreeMap::from([
185+
let config = BTreeMap::from([
186186
("spark.history.fs.logDirectory".to_string(), self.url()),
187187
(
188188
"spark.hadoop.fs.s3a.endpoint".to_string(),
@@ -192,7 +192,13 @@ impl S3LogDir {
192192
"spark.hadoop.fs.s3a.path.style.access".to_string(),
193193
(connection.access_style == S3AccessStyle::Path).to_string(),
194194
),
195-
]))
195+
(
196+
"spark.hadoop.fs.s3a.endpoint.region".to_string(),
197+
connection.region.name.clone(),
198+
),
199+
]);
200+
201+
Ok(config)
196202
}
197203

198204
pub fn application_spark_config(&self) -> Result<BTreeMap<String, String>, Error> {
@@ -211,6 +217,10 @@ impl S3LogDir {
211217
format!("spark.hadoop.fs.s3a.bucket.{bucket_name}.path.style.access"),
212218
(connection.access_style == S3AccessStyle::Path).to_string(),
213219
);
220+
result.insert(
221+
format!("spark.hadoop.fs.s3a.bucket.{bucket_name}.region"),
222+
connection.region.name.clone(),
223+
);
214224
if let Some(secret_dir) = self.credentials_mount_path() {
215225
// We don't use the credentials at all here but assume they are available
216226
result.insert(

rust/operator-binary/src/crd/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,10 @@ impl v1alpha1::SparkApplication {
572572
"--conf spark.hadoop.fs.s3a.path.style.access={}",
573573
s3conn.access_style == S3AccessStyle::Path
574574
));
575+
submit_cmd.push(format!(
576+
"--conf spark.hadoop.fs.s3a.endpoint.region=\"{region_name}\"",
577+
region_name = s3conn.region.name
578+
));
575579
if let Some(credentials) = &s3conn.credentials {
576580
let secret_class_name = credentials.secret_class.clone();
577581
let secret_dir = format!("{S3_SECRET_DIR_NAME}/{secret_class_name}");

0 commit comments

Comments
 (0)