Skip to content

Commit b21b9b0

Browse files
Use "log directory" instead of "S3 log directory" when the resolved log directory structure is used
1 parent a5a1915 commit b21b9b0

File tree

8 files changed

+27
-31
lines changed

8 files changed

+27
-31
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
77
### Added
88

99
- Make spark-env.sh configurable via `configOverrides` ([#473]).
10+
- Allow specifying a custom log directory ([#479]).
1011

1112
### Changed
1213

@@ -33,6 +34,7 @@ All notable changes to this project will be documented in this file.
3334
[#460]: https://github.com/stackabletech/spark-k8s-operator/pull/460
3435
[#472]: https://github.com/stackabletech/spark-k8s-operator/pull/472
3536
[#473]: https://github.com/stackabletech/spark-k8s-operator/pull/473
37+
[#479]: https://github.com/stackabletech/spark-k8s-operator/pull/479
3638

3739
## [24.7.0] - 2024-07-24
3840

rust/crd/src/history.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::s3logdir::ResolvedLogDir;
1+
use crate::logdir::ResolvedLogDir;
22
use crate::{affinity::history_affinity, constants::*};
33

44
use product_config::{types::PropertyNameKind, ProductConfigManager};
@@ -77,7 +77,6 @@ pub struct SparkHistoryServerSpec {
7777
pub vector_aggregator_config_map_name: Option<String>,
7878

7979
/// The log file directory definition used by the Spark history server.
80-
/// Currently only S3 buckets are supported.
8180
pub log_file_directory: LogFileDirectorySpec,
8281

8382
/// A map of key/value strings that will be passed directly to Spark when deploying the history server.
@@ -456,7 +455,7 @@ impl Configuration for HistoryConfigFragment {
456455

457456
#[cfg(test)]
458457
mod test {
459-
use crate::s3logdir::S3LogDir;
458+
use crate::logdir::S3LogDir;
460459

461460
use super::*;
462461
use indoc::indoc;

rust/crd/src/lib.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
pub mod affinity;
44
pub mod constants;
55
pub mod history;
6+
pub mod logdir;
67
pub mod roles;
7-
pub mod s3logdir;
88
pub mod tlscerts;
99

1010
pub use crate::roles::*;
1111
use constants::*;
1212
use history::LogFileDirectorySpec;
13+
use logdir::ResolvedLogDir;
1314
use product_config::{types::PropertyNameKind, ProductConfigManager};
14-
use s3logdir::ResolvedLogDir;
1515
use serde::{Deserialize, Serialize};
1616
use snafu::{OptionExt, ResultExt, Snafu};
1717
use stackable_operator::{
@@ -101,8 +101,8 @@ pub enum Error {
101101
#[snafu(display("failed to configure S3 connection/bucket"))]
102102
ConfigureS3 { source: S3Error },
103103

104-
#[snafu(display("failed to configure S3 log directory"))]
105-
ConfigureS3LogDir { source: s3logdir::Error },
104+
#[snafu(display("failed to configure log directory"))]
105+
ConfigureLogDir { source: logdir::Error },
106106
}
107107

108108
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize, JsonSchema)]
@@ -313,10 +313,7 @@ impl SparkApplication {
313313
}
314314

315315
if let Some(log_dir) = logdir.as_ref() {
316-
if let Some(volume) = log_dir
317-
.credentials_volume()
318-
.context(ConfigureS3LogDirSnafu)?
319-
{
316+
if let Some(volume) = log_dir.credentials_volume().context(ConfigureLogDirSnafu)? {
320317
result.push(volume);
321318
}
322319
}
@@ -648,7 +645,7 @@ impl SparkApplication {
648645
submit_conf.extend(
649646
log_dir
650647
.application_spark_config()
651-
.context(ConfigureS3LogDirSnafu)?,
648+
.context(ConfigureLogDirSnafu)?,
652649
);
653650
}
654651

File renamed without changes.

rust/crd/src/tlscerts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::{
88
STACKABLE_MOUNT_PATH_TLS, STACKABLE_TLS_STORE_PASSWORD, STACKABLE_TRUST_STORE,
99
SYSTEM_TRUST_STORE, SYSTEM_TRUST_STORE_PASSWORD,
1010
},
11-
s3logdir::ResolvedLogDir,
11+
logdir::ResolvedLogDir,
1212
};
1313

1414
pub fn tls_secret_name(s3conn: &ResolvedS3Connection) -> Option<&str> {

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use stackable_operator::{
3737
time::Duration,
3838
};
3939
use stackable_spark_k8s_crd::constants::{METRICS_PORT, SPARK_ENV_SH_FILE_NAME};
40-
use stackable_spark_k8s_crd::s3logdir::ResolvedLogDir;
40+
use stackable_spark_k8s_crd::logdir::ResolvedLogDir;
4141
use stackable_spark_k8s_crd::{
4242
constants::{
4343
ACCESS_KEY_ID, APP_NAME, HISTORY_CONTROLLER_NAME, HISTORY_ROLE_NAME,
@@ -124,9 +124,9 @@ pub enum Error {
124124
#[snafu(display("number of cleaner replicas exceeds 1"))]
125125
TooManyCleanerReplicas,
126126

127-
#[snafu(display("failed to resolve the s3 log dir configuration"))]
128-
S3LogDir {
129-
source: stackable_spark_k8s_crd::s3logdir::Error,
127+
#[snafu(display("failed to resolve the log dir configuration"))]
128+
LogDir {
129+
source: stackable_spark_k8s_crd::logdir::Error,
130130
},
131131

132132
#[snafu(display("failed to create cluster resources"))]
@@ -184,9 +184,9 @@ pub enum Error {
184184
stackable_operator::kvp::KeyValuePairError<stackable_operator::kvp::LabelValueError>,
185185
},
186186

187-
#[snafu(display("failed to get create the S3 log dir"))]
188-
CreateS3LogDirVolumes {
189-
source: stackable_spark_k8s_crd::s3logdir::Error,
187+
#[snafu(display("failed to create the log dir volumes specification"))]
188+
CreateLogDirVolumesSpec {
189+
source: stackable_spark_k8s_crd::logdir::Error,
190190
},
191191

192192
#[snafu(display("failed to add needed volume"))]
@@ -230,7 +230,7 @@ pub async fn reconcile(shs: Arc<SparkHistoryServer>, ctx: Arc<Ctx>) -> Result<Ac
230230
client,
231231
)
232232
.await
233-
.context(S3LogDirSnafu)?;
233+
.context(LogDirSnafu)?;
234234

235235
let vector_aggregator_address = resolve_vector_aggregator_address(
236236
client,
@@ -475,7 +475,7 @@ fn build_stateful_set(
475475
.build(),
476476
)
477477
.context(AddVolumeSnafu)?
478-
.add_volumes(log_dir.volumes().context(CreateS3LogDirVolumesSnafu)?)
478+
.add_volumes(log_dir.volumes().context(CreateLogDirVolumesSpecSnafu)?)
479479
.context(AddVolumeSnafu)?
480480
.security_context(PodSecurityContext {
481481
run_as_user: Some(SPARK_UID),
@@ -684,9 +684,7 @@ fn spark_defaults(
684684
log_dir: &ResolvedLogDir,
685685
rolegroupref: &RoleGroupRef<SparkHistoryServer>,
686686
) -> Result<String, Error> {
687-
let mut log_dir_settings = log_dir
688-
.history_server_spark_config()
689-
.context(S3LogDirSnafu)?;
687+
let mut log_dir_settings = log_dir.history_server_spark_config().context(LogDirSnafu)?;
690688

691689
// add cleaner spark settings if requested
692690
log_dir_settings.extend(cleaner_config(shs, rolegroupref)?);

rust/operator-binary/src/spark_k8s_controller.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use stackable_operator::{
1717
time::Duration,
1818
};
1919
use stackable_spark_k8s_crd::{
20-
constants::*, s3logdir::ResolvedLogDir, tlscerts, to_spark_env_sh_string, RoleConfig,
20+
constants::*, logdir::ResolvedLogDir, tlscerts, to_spark_env_sh_string, RoleConfig,
2121
SparkApplication, SparkApplicationRole, SparkApplicationStatus, SparkContainer, SubmitConfig,
2222
};
2323

@@ -122,9 +122,9 @@ pub enum Error {
122122
source: stackable_operator::builder::pod::container::Error,
123123
},
124124

125-
#[snafu(display("failed to resolve the s3 log dir configuration"))]
126-
S3LogDir {
127-
source: stackable_spark_k8s_crd::s3logdir::Error,
125+
#[snafu(display("failed to resolve the log dir configuration"))]
126+
LogDir {
127+
source: stackable_spark_k8s_crd::logdir::Error,
128128
},
129129

130130
#[snafu(display("failed to resolve the Vector aggregator address"))]
@@ -253,7 +253,7 @@ pub async fn reconcile(spark_application: Arc<SparkApplication>, ctx: Arc<Ctx>)
253253
client,
254254
)
255255
.await
256-
.context(S3LogDirSnafu)?,
256+
.context(LogDirSnafu)?,
257257
)
258258
} else {
259259
None

tests/templates/kuttl/custom-log-directory/10-deploy-history-server.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spec:
1616
vectorAggregatorConfigMapName: vector-aggregator-discovery
1717
{% endif %}
1818
logFileDirectory:
19-
customLogDirectory: hdfs:///
19+
customLogDirectory: hdfs:////
2020
nodes:
2121
config:
2222
logging:

0 commit comments

Comments
 (0)