Skip to content

Commit 3dc7d5e

Browse files
Store the Vector state in /stackable/log/_vector-state
1 parent f7db727 commit 3dc7d5e

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

rust/operator-binary/src/controller/build/product_logging/test-vector.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env sh
22

3+
DATA_DIR=/stackable/log/_vector-state \
34
LOG_DIR=/stackable/log \
45
OPENSEARCH_SERVER_LOG_FILE=opensearch_server.json \
56
NAMESPACE=default \

rust/operator-binary/src/controller/build/product_logging/vector.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
data_dir: /stackable/vector/var
2+
data_dir: ${DATA_DIR}
33

44
log_schema:
55
host_key: pod

rust/operator-binary/src/framework/product_logging/framework.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ const STACKABLE_CONFIG_DIR: &str = "/stackable/config";
3030
// Copy of the private constant `stackable_operator::product_logging::framework::VECTOR_LOG_DIR`
3131
const VECTOR_CONTROL_DIR: &str = "_vector";
3232

33+
// Copy of the private constant `stackable_operator::product_logging::framework::VECTOR_STATE_DIR`
34+
const VECTOR_STATE_DIR: &str = "_vector-state";
35+
3336
// Copy of the private constant `stackable_operator::product_logging::framework::SHUTDOWN_FILE`
3437
const SHUTDOWN_FILE: &str = "shutdown";
3538

@@ -142,7 +145,11 @@ pub fn vector_container(
142145
&EnvVarName::from_str_unsafe("CLUSTER_NAME"),
143146
&resource_names.cluster_name,
144147
)
145-
.with_value(&EnvVarName::from_str_unsafe("LOG_DIR"), "/stackable/log")
148+
.with_value(
149+
&EnvVarName::from_str_unsafe("DATA_DIR"),
150+
format!("{STACKABLE_LOG_DIR}/{VECTOR_STATE_DIR}"),
151+
)
152+
.with_value(&EnvVarName::from_str_unsafe("LOG_DIR"), STACKABLE_LOG_DIR)
146153
.with_field_path(
147154
&EnvVarName::from_str_unsafe("NAMESPACE"),
148155
FieldPathEnvVar::Namespace,
@@ -191,7 +198,8 @@ pub fn vector_container(
191198
"-c".to_string(),
192199
])
193200
.args(vec![format!(
194-
"# Vector will ignore SIGTERM (as PID != 1) and must be shut down by writing a shutdown trigger file\n\
201+
"mkdir --parents {STACKABLE_LOG_DIR}/{VECTOR_STATE_DIR}\n\
202+
# Vector will ignore SIGTERM (as PID != 1) and must be shut down by writing a shutdown trigger file\n\
195203
vector & vector_pid=$!\n\
196204
if [ ! -f \"{vector_control_directory}/{SHUTDOWN_FILE}\" ]; then\n\
197205
mkdir -p {vector_control_directory}\n\

0 commit comments

Comments
 (0)