Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ All notable changes to this project will be documented in this file.
- The `runAsUser` and `runAsGroup` fields will not be set anymore by the operator
- The defaults from the docker images itself will now apply, which will be different from 1000/0 going forward
- This is marked as breaking because tools and policies might exist, which require these fields to be set
- BREAKING: Replace JMX Exporter with built in Prometheus support. Hence, the metrics provided by the `/metrics` endpoint are named
differently now ([#955]).

### Fixed

Expand All @@ -45,6 +47,7 @@ All notable changes to this project will be documented in this file.
[#942]: https://github.com/stackabletech/zookeeper-operator/pull/942
[#946]: https://github.com/stackabletech/zookeeper-operator/pull/946
[#950]: https://github.com/stackabletech/zookeeper-operator/pull/950
[#955]: https://github.com/stackabletech/zookeeper-operator/pull/955

## [25.3.0] - 2025-03-21

Expand Down
7 changes: 1 addition & 6 deletions rust/operator-binary/src/config/jvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use stackable_operator::{

use crate::crd::{
JVM_SECURITY_PROPERTIES_FILE, LOG4J_CONFIG_FILE, LOGBACK_CONFIG_FILE, LoggingFramework,
METRICS_PORT, STACKABLE_CONFIG_DIR, STACKABLE_LOG_CONFIG_DIR,
STACKABLE_CONFIG_DIR, STACKABLE_LOG_CONFIG_DIR,
v1alpha1::{ZookeeperCluster, ZookeeperConfig, ZookeeperConfigFragment},
};

Expand Down Expand Up @@ -36,9 +36,6 @@ fn construct_jvm_args(

let jvm_args = vec![
format!("-Djava.security.properties={STACKABLE_CONFIG_DIR}/{JVM_SECURITY_PROPERTIES_FILE}"),
format!(
"-javaagent:/stackable/jmx/jmx_prometheus_javaagent.jar={METRICS_PORT}:/stackable/jmx/server.yaml"
),
match logging_framework {
LoggingFramework::LOG4J => {
format!("-Dlog4j.configuration=file:{STACKABLE_LOG_CONFIG_DIR}/{LOG4J_CONFIG_FILE}")
Expand Down Expand Up @@ -123,7 +120,6 @@ mod tests {
assert_eq!(
non_heap_jvm_args,
"-Djava.security.properties=/stackable/config/security.properties \
-javaagent:/stackable/jmx/jmx_prometheus_javaagent.jar=9505:/stackable/jmx/server.yaml \
-Dlogback.configurationFile=/stackable/log_config/logback.xml"
);
assert_eq!(zk_server_heap_env, "409");
Expand Down Expand Up @@ -168,7 +164,6 @@ mod tests {
assert_eq!(
non_heap_jvm_args,
"-Djava.security.properties=/stackable/config/security.properties \
-javaagent:/stackable/jmx/jmx_prometheus_javaagent.jar=9505:/stackable/jmx/server.yaml \
-Dlogback.configurationFile=/stackable/log_config/logback.xml \
-Dhttps.proxyHost=proxy.my.corp \
-Djava.net.preferIPv4Stack=true \
Expand Down
14 changes: 13 additions & 1 deletion rust/operator-binary/src/crd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ pub const OPERATOR_NAME: &str = "zookeeper.stackable.tech";
pub const ZOOKEEPER_PROPERTIES_FILE: &str = "zoo.cfg";
pub const JVM_SECURITY_PROPERTIES_FILE: &str = "security.properties";

pub const METRICS_PORT: u16 = 9505;
pub const METRICS_PROVIDER_CLASS_NAME: &str =
"org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider";
pub const METRICS_PROVIDER_HTTP_PORT: u16 = 9505;

pub const STACKABLE_DATA_DIR: &str = "/stackable/data";
pub const STACKABLE_CONFIG_DIR: &str = "/stackable/config";
Expand Down Expand Up @@ -371,6 +373,8 @@ impl v1alpha1::ZookeeperConfig {
pub const DATA_DIR: &'static str = "dataDir";
const DEFAULT_SECRET_LIFETIME: Duration = Duration::from_days_unchecked(1);
pub const INIT_LIMIT: &'static str = "initLimit";
const METRICS_PROVIDER_CLASS_NAME: &'static str = "metricsProvider.className";
const METRICS_PROVIDER_HTTP_PORT: &'static str = "metricsProvider.httpPort";
pub const MYID_OFFSET: &'static str = "MYID_OFFSET";
pub const SYNC_LIMIT: &'static str = "syncLimit";
pub const TICK_TIME: &'static str = "tickTime";
Expand Down Expand Up @@ -468,6 +472,14 @@ impl Configuration for v1alpha1::ZookeeperConfigFragment {
v1alpha1::ZookeeperConfig::DATA_DIR.to_string(),
Some(STACKABLE_DATA_DIR.to_string()),
);
result.insert(
v1alpha1::ZookeeperConfig::METRICS_PROVIDER_CLASS_NAME.to_string(),
Some(METRICS_PROVIDER_CLASS_NAME.to_string()),
);
result.insert(
v1alpha1::ZookeeperConfig::METRICS_PROVIDER_HTTP_PORT.to_string(),
Some(METRICS_PROVIDER_HTTP_PORT.to_string()),
);
}

Ok(result)
Expand Down
46 changes: 36 additions & 10 deletions tests/templates/kuttl/smoke/test_zookeeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import requests
import time
import sys

sys.tracebacklimit = 0


Expand Down Expand Up @@ -37,18 +38,29 @@ def check_ruok(hosts):
url = host + ":8080/commands/" + cmd_ruok
response = try_get(url).json()

if "command" in response and response["command"] == cmd_ruok \
and "error" in response and response["error"] is None:
if (
"command" in response
and response["command"] == cmd_ruok
and "error" in response
and response["error"] is None
):
continue
else:
print("Error[" + cmd_ruok + "] for [" + url + "]: received " + str(
response) + " - expected {'command': 'ruok', 'error': None} ")
print(
"Error["
+ cmd_ruok
+ "] for ["
+ url
+ "]: received "
+ str(response)
+ " - expected {'command': 'ruok', 'error': None} "
)
exit(-1)


def check_monitoring(hosts):
for host in hosts:
url = host + ":9505"
url = host + ":9505/metrics"
response = try_get(url)

if response.ok:
Expand All @@ -58,15 +70,29 @@ def check_monitoring(hosts):
exit(-1)


if __name__ == '__main__':
if __name__ == "__main__":
all_args = argparse.ArgumentParser(description="Test ZooKeeper.")
all_args.add_argument("-n", "--namespace", help="The namespace to run in", required=True)
all_args.add_argument(
"-n", "--namespace", help="The namespace to run in", required=True
)
args = vars(all_args.parse_args())
namespace = args["namespace"]

host_primary_0 = "http://test-zk-server-primary-0.test-zk-server-primary." + namespace + ".svc.cluster.local"
host_primary_1 = "http://test-zk-server-primary-1.test-zk-server-primary." + namespace + ".svc.cluster.local"
host_secondary = "http://test-zk-server-secondary-0.test-zk-server-secondary." + namespace + ".svc.cluster.local"
host_primary_0 = (
"http://test-zk-server-primary-0.test-zk-server-primary."
+ namespace
+ ".svc.cluster.local"
)
host_primary_1 = (
"http://test-zk-server-primary-1.test-zk-server-primary."
+ namespace
+ ".svc.cluster.local"
)
host_secondary = (
"http://test-zk-server-secondary-0.test-zk-server-secondary."
+ namespace
+ ".svc.cluster.local"
)

hosts = [host_primary_0, host_primary_1, host_secondary]

Expand Down