-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathconstants.rs
More file actions
143 lines (111 loc) · 6.54 KB
/
Copy pathconstants.rs
File metadata and controls
143 lines (111 loc) · 6.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
use std::{collections::BTreeMap, str::FromStr};
use const_format::concatcp;
use stackable_operator::{
memory::{BinaryMultiple, MemoryQuantity},
v2::types::{common::Port, kubernetes::VolumeName},
};
pub const APP_NAME: &str = "spark-k8s";
stackable_operator::constant!(pub VOLUME_MOUNT_NAME_IVY2: VolumeName = "ivy2");
pub const VOLUME_MOUNT_PATH_IVY2: &str = "/ivy2";
stackable_operator::constant!(pub VOLUME_MOUNT_NAME_DRIVER_POD_TEMPLATES: VolumeName = "driver-pod-template");
pub const VOLUME_MOUNT_PATH_DRIVER_POD_TEMPLATES: &str = "/stackable/spark/driver-pod-templates";
stackable_operator::constant!(pub VOLUME_MOUNT_NAME_EXECUTOR_POD_TEMPLATES: VolumeName = "executor-pod-template");
pub const VOLUME_MOUNT_PATH_EXECUTOR_POD_TEMPLATES: &str =
"/stackable/spark/executor-pod-templates";
pub const POD_TEMPLATE_FILE: &str = "template.yaml";
stackable_operator::constant!(pub VOLUME_MOUNT_NAME_CONFIG: VolumeName = "config");
pub const VOLUME_MOUNT_PATH_CONFIG: &str = "/stackable/spark/conf";
stackable_operator::constant!(pub VOLUME_MOUNT_NAME_JOB: VolumeName = "job-files");
pub const VOLUME_MOUNT_PATH_JOB: &str = "/stackable/spark/jobs";
stackable_operator::constant!(pub VOLUME_MOUNT_NAME_REQ: VolumeName = "req-files");
pub const VOLUME_MOUNT_PATH_REQ: &str = "/stackable/spark/requirements";
stackable_operator::constant!(pub VOLUME_MOUNT_NAME_LOG_CONFIG: VolumeName = "log-config");
pub const VOLUME_MOUNT_PATH_LOG_CONFIG: &str = "/stackable/log_config";
stackable_operator::constant!(pub VOLUME_MOUNT_NAME_LOG: VolumeName = "log");
pub const VOLUME_MOUNT_PATH_LOG: &str = "/stackable/log";
pub const LOG4J2_CONFIG_FILE: &str = "log4j2.properties";
pub const JVM_SECURITY_PROPERTIES_FILE: &str = "security.properties";
pub const JVM_SECURITY_PROPERTY_DNS_CACHE_TTL: &str = "networkaddress.cache.ttl";
pub const JVM_SECURITY_PROPERTY_DNS_CACHE_NEGATIVE_TTL: &str = "networkaddress.cache.negative.ttl";
pub const DEFAULT_JVM_SECURITY_DNS_CACHE_TTL: &str = "30";
pub const DEFAULT_JVM_SECURITY_DNS_CACHE_NEGATIVE_TTL: &str = "0";
pub const METRICS_PROPERTIES_FILE: &str = "metrics.properties";
pub const ACCESS_KEY_ID: &str = "accessKey";
pub const SECRET_ACCESS_KEY: &str = "secretKey";
pub const S3_SECRET_DIR_NAME: &str = "/stackable/secrets";
pub const STACKABLE_TRUST_STORE: &str = "/stackable/truststore";
pub const STACKABLE_TRUST_STORE_NAME: &str = "stackable-truststore";
pub const STACKABLE_TLS_STORE_PASSWORD: &str = "changeit";
pub const STACKABLE_MOUNT_PATH_TLS: &str = "/stackable/mount_server_tls";
pub const MIN_MEMORY_OVERHEAD: u32 = 384;
pub const JVM_OVERHEAD_FACTOR: f32 = 0.1;
pub const NON_JVM_OVERHEAD_FACTOR: f32 = 0.4;
pub const MAX_SPARK_LOG_FILES_SIZE: MemoryQuantity = MemoryQuantity {
value: 10.0,
unit: BinaryMultiple::Mebi,
};
// Spark applications can have up to three init containers.
// * `job` - copies user's application jar file from a volume to the expected location.
// * `requirements` - install Python packages.
// * `tls` - Generates a java trust store.
// All of these containers have their output captured by Vector via `capture_shell_output`
// and therefore also need space on the logging volume.
pub const MAX_INIT_LOG_FILES_SIZE: MemoryQuantity = MemoryQuantity {
value: 3.0, // 1Mib for each possible container.
unit: BinaryMultiple::Mebi,
};
pub const OPERATOR_NAME: &str = "spark.stackable.tech";
pub const FIELD_MANAGER: &str = "spark-operator";
pub const SPARK_CONTROLLER_NAME: &str = "sparkapplication";
pub const SPARK_FULL_CONTROLLER_NAME: &str = concatcp!(SPARK_CONTROLLER_NAME, '.', OPERATOR_NAME);
pub const POD_DRIVER_CONTROLLER_NAME: &str = "pod-driver";
pub const POD_DRIVER_FULL_CONTROLLER_NAME: &str =
concatcp!(POD_DRIVER_CONTROLLER_NAME, '.', OPERATOR_NAME);
pub const HISTORY_CONTROLLER_NAME: &str = "history";
pub const HISTORY_FULL_CONTROLLER_NAME: &str =
concatcp!(HISTORY_CONTROLLER_NAME, '.', OPERATOR_NAME);
pub const HISTORY_APP_NAME: &str = "spark-history";
pub const HISTORY_ROLE_NAME: &str = "node";
pub const CONTAINER_IMAGE_BASE_NAME: &str = "spark-k8s";
pub const SPARK_DEFAULTS_FILE_NAME: &str = "spark-defaults.conf";
pub const SPARK_ENV_SH_FILE_NAME: &str = "spark-env.sh";
pub const SPARK_CLUSTER_ROLE: &str = "spark-k8s-clusterrole";
pub const METRICS_PORT: Port = Port(18081);
pub const HISTORY_UI_PORT: Port = Port(18080);
stackable_operator::constant!(pub LISTENER_VOLUME_NAME: VolumeName = "listener");
pub const LISTENER_VOLUME_DIR: &str = "/stackable/listener";
pub const DEFAULT_LISTENER_CLASS: &str = "cluster-internal";
pub const DEFAULT_SUBMIT_JOB_RETRY_ON_FAILURE_COUNT: u16 = 0;
// --- OpenLineage (see the OpenLineage usage guide) ---
/// The OpenLineage Spark listener, appended to `spark.extraListeners` when OpenLineage is enabled.
pub const OPENLINEAGE_LISTENER_CLASS: &str = "io.openlineage.spark.agent.OpenLineageSparkListener";
/// `local://` URI of the OpenLineage jar baked into the Spark image, referenced via `spark.jars` so
/// it shares the (child) classloader with `--packages` connectors. Delivering it this way — rather
/// than on `extraClassPath` (system classloader) — is what lets OpenLineage's connector probes
/// succeed; see the classpath discussion in the OpenLineage usage guide.
///
/// IMPORTANT: the version MUST stay in sync with the `openlineage-spark-version` build-argument in
/// `docker-images/spark-k8s/boil-config.toml` (the image is what places the jar at this path).
pub const OPENLINEAGE_JAR_LOCAL_URI: &str =
"local:///stackable/spark/openlineage/openlineage-spark_2.13-1.51.0.jar";
/// The key the OpenLineage discovery ConfigMap must hold, carrying the backend base URL. Mirrors the
/// `ADDRESS` contract of the existing `vectorAggregatorConfigMapName` discovery ConfigMap.
pub const OPENLINEAGE_CONFIG_MAP_ADDRESS_KEY: &str = "ADDRESS";
/// Java module-system flag OpenLineage requires on Spark 4.x: without it the driver throws a
/// non-fatal `InaccessibleObjectException` and silently degrades extension-interface lineage.
/// Appended to both driver and executor `extraJavaOptions`.
pub const OPENLINEAGE_ADD_OPENS: &str = "--add-opens java.base/java.security=ALL-UNNAMED";
/// The JVM `security.properties` entries the operator sets by default (DNS cache TTLs).
pub fn default_jvm_security_properties() -> BTreeMap<String, String> {
[
(
JVM_SECURITY_PROPERTY_DNS_CACHE_TTL.to_string(),
DEFAULT_JVM_SECURITY_DNS_CACHE_TTL.to_string(),
),
(
JVM_SECURITY_PROPERTY_DNS_CACHE_NEGATIVE_TTL.to_string(),
DEFAULT_JVM_SECURITY_DNS_CACHE_NEGATIVE_TTL.to_string(),
),
]
.into()
}