Skip to content

Commit 11d6276

Browse files
committed
Revert "remove jmx agent and metrics ports"
This reverts commit 3f0d9a3.
1 parent 759f887 commit 11d6276

File tree

5 files changed

+53
-22
lines changed

5 files changed

+53
-22
lines changed

CHANGELOG.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ All notable changes to this project will be documented in this file.
2121
by `FILE_LOG_DIRECTORY` (or via `--file-log-directory <DIRECTORY>`).
2222
- Replace stackable-operator `print_startup_string` with `tracing::info!` with fields.
2323
- BREAKING: Inject the vector aggregator address into the vector config using the env var `VECTOR_AGGREGATOR_ADDRESS` instead
24-
of having the operator write it to the vector config ([#671]).
24+
of having the operator write it to the vector config ([#671]).
2525
- test: Bump to Vector `0.46.1` ([#677]).
2626
- BREAKING: Previously this operator would hardcode the UID and GID of the Pods being created to 1000/0, this has changed now ([#683])
2727
- The `runAsUser` and `runAsGroup` fields will not be set anymore by the operator
2828
- The defaults from the docker images itself will now apply, which will be different from 1000/0 going forward
2929
- This is marked as breaking because tools and policies might exist, which require these fields to be set
3030
- Use versioned common structs ([#684]).
31-
- BREAKING: the JMX exporter has been an replaced with the built-in Prometheus servlet ([#694]).
3231

3332
### Fixed
3433

@@ -49,7 +48,6 @@ All notable changes to this project will be documented in this file.
4948
[#683]: https://github.com/stackabletech/hdfs-operator/pull/683
5049
[#684]: https://github.com/stackabletech/hdfs-operator/pull/684
5150
[#693]: https://github.com/stackabletech/hdfs-operator/pull/693
52-
[#694]: https://github.com/stackabletech/hdfs-operator/pull/694
5351

5452
## [25.3.0] - 2025-03-21
5553

rust/operator-binary/src/config/jvm.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ pub fn construct_role_specific_jvm_args(
5656
kerberos_enabled: bool,
5757
resources: Option<&ResourceRequirements>,
5858
config_dir: &str,
59+
metrics_port: u16,
5960
) -> Result<String, Error> {
6061
let mut jvm_args = Vec::new();
6162

@@ -76,9 +77,10 @@ pub fn construct_role_specific_jvm_args(
7677
jvm_args.push(format!("-Xmx{heap}"));
7778
}
7879

79-
jvm_args.extend([format!(
80-
"-Djava.security.properties={config_dir}/{JVM_SECURITY_PROPERTIES_FILE}"
81-
)]);
80+
jvm_args.extend([
81+
format!("-Djava.security.properties={config_dir}/{JVM_SECURITY_PROPERTIES_FILE}"),
82+
format!("-javaagent:/stackable/jmx/jmx_prometheus_javaagent.jar={metrics_port}:/stackable/jmx/{hdfs_role}.yaml")
83+
]);
8284
if kerberos_enabled {
8385
jvm_args.push(format!(
8486
"-Djava.security.krb5.conf={KERBEROS_CONTAINER_PATH}/krb5.conf"
@@ -99,7 +101,7 @@ pub fn construct_role_specific_jvm_args(
99101
mod tests {
100102

101103
use super::*;
102-
use crate::container::ContainerConfig;
104+
use crate::{container::ContainerConfig, crd::constants::DEFAULT_NAME_NODE_METRICS_PORT};
103105

104106
#[test]
105107
fn test_global_jvm_args() {
@@ -133,7 +135,8 @@ mod tests {
133135
jvm_config,
134136
"-Xms819m \
135137
-Xmx819m \
136-
-Djava.security.properties=/stackable/config/security.properties"
138+
-Djava.security.properties=/stackable/config/security.properties \
139+
-javaagent:/stackable/jmx/jmx_prometheus_javaagent.jar=8183:/stackable/jmx/namenode.yaml"
137140
);
138141
}
139142

@@ -178,6 +181,7 @@ mod tests {
178181
format!(
179182
"-Xms34406m \
180183
-Djava.security.properties=/stackable/config/security.properties \
184+
-javaagent:/stackable/jmx/jmx_prometheus_javaagent.jar=8183:/stackable/jmx/namenode.yaml \
181185
-Djava.security.krb5.conf={KERBEROS_CONTAINER_PATH}/krb5.conf \
182186
-Dhttps.proxyHost=proxy.my.corp \
183187
-Djava.net.preferIPv4Stack=true \
@@ -203,6 +207,7 @@ mod tests {
203207
kerberos_enabled,
204208
resources.as_ref(),
205209
"/stackable/config",
210+
DEFAULT_NAME_NODE_METRICS_PORT,
206211
)
207212
.unwrap()
208213
}

rust/operator-binary/src/container.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,14 @@ use crate::{
6161
AnyNodeConfig, DataNodeContainer, HdfsNodeRole, HdfsPodRef, NameNodeContainer,
6262
UpgradeState,
6363
constants::{
64-
DATANODE_ROOT_DATA_DIR_PREFIX, LISTENER_VOLUME_DIR, LISTENER_VOLUME_NAME,
65-
LIVENESS_PROBE_FAILURE_THRESHOLD, LIVENESS_PROBE_INITIAL_DELAY_SECONDS,
66-
LIVENESS_PROBE_PERIOD_SECONDS, LOG4J_PROPERTIES, NAMENODE_ROOT_DATA_DIR,
67-
READINESS_PROBE_FAILURE_THRESHOLD, READINESS_PROBE_INITIAL_DELAY_SECONDS,
68-
READINESS_PROBE_PERIOD_SECONDS, SERVICE_PORT_NAME_HTTP, SERVICE_PORT_NAME_HTTPS,
69-
SERVICE_PORT_NAME_IPC, SERVICE_PORT_NAME_RPC, STACKABLE_ROOT_DATA_DIR,
64+
DATANODE_ROOT_DATA_DIR_PREFIX, DEFAULT_DATA_NODE_METRICS_PORT,
65+
DEFAULT_JOURNAL_NODE_METRICS_PORT, DEFAULT_NAME_NODE_METRICS_PORT, LISTENER_VOLUME_DIR,
66+
LISTENER_VOLUME_NAME, LIVENESS_PROBE_FAILURE_THRESHOLD,
67+
LIVENESS_PROBE_INITIAL_DELAY_SECONDS, LIVENESS_PROBE_PERIOD_SECONDS, LOG4J_PROPERTIES,
68+
NAMENODE_ROOT_DATA_DIR, READINESS_PROBE_FAILURE_THRESHOLD,
69+
READINESS_PROBE_INITIAL_DELAY_SECONDS, READINESS_PROBE_PERIOD_SECONDS,
70+
SERVICE_PORT_NAME_HTTP, SERVICE_PORT_NAME_HTTPS, SERVICE_PORT_NAME_IPC,
71+
SERVICE_PORT_NAME_RPC, STACKABLE_ROOT_DATA_DIR,
7072
},
7173
storage::DataNodeStorageConfig,
7274
v1alpha1,
@@ -162,6 +164,8 @@ pub enum ContainerConfig {
162164
web_ui_http_port_name: &'static str,
163165
/// Port name of the web UI HTTPS port, used for the liveness probe.
164166
web_ui_https_port_name: &'static str,
167+
/// The JMX Exporter metrics port.
168+
metrics_port: u16,
165169
},
166170
Zkfc {
167171
/// The provided custom container name.
@@ -1222,7 +1226,9 @@ wait_for_termination $!
12221226
resources: Option<&ResourceRequirements>,
12231227
) -> Result<String, Error> {
12241228
match self {
1225-
ContainerConfig::Hdfs { role, .. } => {
1229+
ContainerConfig::Hdfs {
1230+
role, metrics_port, ..
1231+
} => {
12261232
let cvd = ContainerVolumeDirs::from(role);
12271233
let config_dir = cvd.final_config();
12281234
construct_role_specific_jvm_args(
@@ -1232,6 +1238,7 @@ wait_for_termination $!
12321238
hdfs.has_kerberos_enabled(),
12331239
resources,
12341240
config_dir,
1241+
*metrics_port,
12351242
)
12361243
.with_context(|_| ConstructJvmArgumentsSnafu {
12371244
role: role.to_string(),
@@ -1372,6 +1379,7 @@ impl From<HdfsNodeRole> for ContainerConfig {
13721379
ipc_port_name: SERVICE_PORT_NAME_RPC,
13731380
web_ui_http_port_name: SERVICE_PORT_NAME_HTTP,
13741381
web_ui_https_port_name: SERVICE_PORT_NAME_HTTPS,
1382+
metrics_port: DEFAULT_NAME_NODE_METRICS_PORT,
13751383
},
13761384
HdfsNodeRole::Data => Self::Hdfs {
13771385
role,
@@ -1380,6 +1388,7 @@ impl From<HdfsNodeRole> for ContainerConfig {
13801388
ipc_port_name: SERVICE_PORT_NAME_IPC,
13811389
web_ui_http_port_name: SERVICE_PORT_NAME_HTTP,
13821390
web_ui_https_port_name: SERVICE_PORT_NAME_HTTPS,
1391+
metrics_port: DEFAULT_DATA_NODE_METRICS_PORT,
13831392
},
13841393
HdfsNodeRole::Journal => Self::Hdfs {
13851394
role,
@@ -1388,6 +1397,7 @@ impl From<HdfsNodeRole> for ContainerConfig {
13881397
ipc_port_name: SERVICE_PORT_NAME_RPC,
13891398
web_ui_http_port_name: SERVICE_PORT_NAME_HTTP,
13901399
web_ui_https_port_name: SERVICE_PORT_NAME_HTTPS,
1400+
metrics_port: DEFAULT_JOURNAL_NODE_METRICS_PORT,
13911401
},
13921402
}
13931403
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,22 @@ pub const SERVICE_PORT_NAME_IPC: &str = "ipc";
1919
pub const SERVICE_PORT_NAME_HTTP: &str = "http";
2020
pub const SERVICE_PORT_NAME_HTTPS: &str = "https";
2121
pub const SERVICE_PORT_NAME_DATA: &str = "data";
22+
pub const SERVICE_PORT_NAME_METRICS: &str = "metrics";
2223

2324
pub const DEFAULT_LISTENER_CLASS: &str = "cluster-internal";
2425

26+
pub const DEFAULT_NAME_NODE_METRICS_PORT: u16 = 8183;
2527
pub const DEFAULT_NAME_NODE_HTTP_PORT: u16 = 9870;
2628
pub const DEFAULT_NAME_NODE_HTTPS_PORT: u16 = 9871;
2729
pub const DEFAULT_NAME_NODE_RPC_PORT: u16 = 8020;
2830

31+
pub const DEFAULT_DATA_NODE_METRICS_PORT: u16 = 8082;
2932
pub const DEFAULT_DATA_NODE_HTTP_PORT: u16 = 9864;
3033
pub const DEFAULT_DATA_NODE_HTTPS_PORT: u16 = 9865;
3134
pub const DEFAULT_DATA_NODE_DATA_PORT: u16 = 9866;
3235
pub const DEFAULT_DATA_NODE_IPC_PORT: u16 = 9867;
3336

37+
pub const DEFAULT_JOURNAL_NODE_METRICS_PORT: u16 = 8081;
3438
pub const DEFAULT_JOURNAL_NODE_HTTP_PORT: u16 = 8480;
3539
pub const DEFAULT_JOURNAL_NODE_HTTPS_PORT: u16 = 8481;
3640
pub const DEFAULT_JOURNAL_NODE_RPC_PORT: u16 = 8485;

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

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,16 @@ use crate::crd::{
5353
constants::{
5454
APP_NAME, CORE_SITE_XML, DEFAULT_DATA_NODE_DATA_PORT,
5555
DEFAULT_DATA_NODE_GRACEFUL_SHUTDOWN_TIMEOUT, DEFAULT_DATA_NODE_HTTP_PORT,
56-
DEFAULT_DATA_NODE_HTTPS_PORT, DEFAULT_DATA_NODE_IPC_PORT, DEFAULT_DFS_REPLICATION_FACTOR,
57-
DEFAULT_JOURNAL_NODE_GRACEFUL_SHUTDOWN_TIMEOUT, DEFAULT_JOURNAL_NODE_HTTP_PORT,
58-
DEFAULT_JOURNAL_NODE_HTTPS_PORT, DEFAULT_JOURNAL_NODE_RPC_PORT, DEFAULT_LISTENER_CLASS,
56+
DEFAULT_DATA_NODE_HTTPS_PORT, DEFAULT_DATA_NODE_IPC_PORT, DEFAULT_DATA_NODE_METRICS_PORT,
57+
DEFAULT_DFS_REPLICATION_FACTOR, DEFAULT_JOURNAL_NODE_GRACEFUL_SHUTDOWN_TIMEOUT,
58+
DEFAULT_JOURNAL_NODE_HTTP_PORT, DEFAULT_JOURNAL_NODE_HTTPS_PORT,
59+
DEFAULT_JOURNAL_NODE_METRICS_PORT, DEFAULT_JOURNAL_NODE_RPC_PORT, DEFAULT_LISTENER_CLASS,
5960
DEFAULT_NAME_NODE_GRACEFUL_SHUTDOWN_TIMEOUT, DEFAULT_NAME_NODE_HTTP_PORT,
60-
DEFAULT_NAME_NODE_HTTPS_PORT, DEFAULT_NAME_NODE_RPC_PORT, DFS_REPLICATION,
61-
HADOOP_POLICY_XML, HDFS_SITE_XML, JVM_SECURITY_PROPERTIES_FILE, LISTENER_VOLUME_NAME,
62-
SERVICE_PORT_NAME_DATA, SERVICE_PORT_NAME_HTTP, SERVICE_PORT_NAME_HTTPS,
63-
SERVICE_PORT_NAME_IPC, SERVICE_PORT_NAME_RPC, SSL_CLIENT_XML, SSL_SERVER_XML,
61+
DEFAULT_NAME_NODE_HTTPS_PORT, DEFAULT_NAME_NODE_METRICS_PORT, DEFAULT_NAME_NODE_RPC_PORT,
62+
DFS_REPLICATION, HADOOP_POLICY_XML, HDFS_SITE_XML, JVM_SECURITY_PROPERTIES_FILE,
63+
LISTENER_VOLUME_NAME, SERVICE_PORT_NAME_DATA, SERVICE_PORT_NAME_HTTP,
64+
SERVICE_PORT_NAME_HTTPS, SERVICE_PORT_NAME_IPC, SERVICE_PORT_NAME_METRICS,
65+
SERVICE_PORT_NAME_RPC, SSL_CLIENT_XML, SSL_SERVER_XML,
6466
},
6567
security::{AuthenticationConfig, KerberosConfig},
6668
storage::{
@@ -665,6 +667,10 @@ impl v1alpha1::HdfsCluster {
665667
pub fn ports(&self, role: &HdfsNodeRole) -> Vec<(String, u16)> {
666668
match role {
667669
HdfsNodeRole::Name => vec![
670+
(
671+
String::from(SERVICE_PORT_NAME_METRICS),
672+
DEFAULT_NAME_NODE_METRICS_PORT,
673+
),
668674
(
669675
String::from(SERVICE_PORT_NAME_RPC),
670676
DEFAULT_NAME_NODE_RPC_PORT,
@@ -682,6 +688,10 @@ impl v1alpha1::HdfsCluster {
682688
},
683689
],
684690
HdfsNodeRole::Data => vec![
691+
(
692+
String::from(SERVICE_PORT_NAME_METRICS),
693+
DEFAULT_DATA_NODE_METRICS_PORT,
694+
),
685695
(
686696
String::from(SERVICE_PORT_NAME_DATA),
687697
DEFAULT_DATA_NODE_DATA_PORT,
@@ -703,6 +713,10 @@ impl v1alpha1::HdfsCluster {
703713
},
704714
],
705715
HdfsNodeRole::Journal => vec![
716+
(
717+
String::from(SERVICE_PORT_NAME_METRICS),
718+
DEFAULT_JOURNAL_NODE_METRICS_PORT,
719+
),
706720
(
707721
String::from(SERVICE_PORT_NAME_RPC),
708722
DEFAULT_JOURNAL_NODE_RPC_PORT,

0 commit comments

Comments
 (0)