diff --git a/CHANGELOG.md b/CHANGELOG.md index 903cbb21..67f3834f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,26 +6,30 @@ All notable changes to this project will be documented in this file. ### Added +- Adds new telemetry CLI arguments and environment variables ([#715]). + - Use `--file-log-max-files` (or `FILE_LOG_MAX_FILES`) to limit the number of log files kept. + - Use `--file-log-rotation-period` (or `FILE_LOG_ROTATION_PERIOD`) to configure the frequency of rotation. + - Use `--console-log-format` (or `CONSOLE_LOG_FORMAT`) to set the format to `plain` (default) or `json`. - Log the startup event for bundle-builder and user-info-fetcher ([#703]). ### Changed -- BREAKING: Replace stackable-operator `initialize_logging` with stackable-telemetry `Tracing` ([#703], [#710]). +- BREAKING: Replace stackable-operator `initialize_logging` with stackable-telemetry `Tracing` ([#703], [#710], [#715]). - operator-binary: - - The console log level was set by `OPA_OPERATOR_LOG`, and is now set by `CONSOLE_LOG`. - - The file log level was set by `OPA_OPERATOR_LOG`, and is now set by `FILE_LOG`. + - The console log level was set by `OPA_OPERATOR_LOG`, and is now set by `CONSOLE_LOG_LEVEL`. + - The file log level was set by `OPA_OPERATOR_LOG`, and is now set by `FILE_LOG_LEVEL`. - The file log directory was set by `OPA_OPERATOR_LOG_DIRECTORY`, and is now set - by `ROLLING_LOGS_DIR` (or via `--rolling-logs `). + by `FILE_LOG_DIRECTORY` (or via `--file-log-directory `). - bundle-builder: - - The console log level was set by `OPA_BUNDLE_BUILDER_LOG`, and is now set by `CONSOLE_LOG`. - - The file log level was set by `OPA_BUNDLE_BUILDER_LOG`, and is now set by `FILE_LOG`. + - The console log level was set by `OPA_BUNDLE_BUILDER_LOG`, and is now set by `CONSOLE_LOG_LEVEL`. + - The file log level was set by `OPA_BUNDLE_BUILDER_LOG`, and is now set by `FILE_LOG_LEVEL`. - The file log directory was set by `OPA_BUNDLE_BUILDER_LOG_DIRECTORY`, and is now set - by `ROLLING_LOGS_DIR` (or via `--rolling-logs `). + by `FILE_LOG_DIRECTORY` (or via `--file-log-directory `). - user-info-fetcher: - - The console log level was set by `OPA_OPERATOR_LOG`, and is now set by `CONSOLE_LOG`. - - The file log level was set by `OPA_OPERATOR_LOG`, and is now set by `FILE_LOG`. + - The console log level was set by `OPA_OPERATOR_LOG`, and is now set by `CONSOLE_LOG_LEVEL`. + - The file log level was set by `OPA_OPERATOR_LOG`, and is now set by `FILE_LOG_LEVEL`. - The file log directory was set by `OPA_OPERATOR_LOG_DIRECTORY`, and is now set - by `ROLLING_LOGS_DIR` (or via `--rolling-logs `). + by `FILE_LOG_DIRECTORY` (or via `--file-log-directory `). - Replace stackable-operator `print_startup_string` with `tracing::info!` with fields. - BREAKING: Inject the vector aggregator address into the vector config using the env var `VECTOR_AGGREGATOR_ADDRESS` instead of having the operator write it to the vector config ([#707]). @@ -38,6 +42,7 @@ All notable changes to this project will be documented in this file. [#707]: https://github.com/stackabletech/opa-operator/pull/707 [#709]: https://github.com/stackabletech/opa-operator/pull/709 [#710]: https://github.com/stackabletech/opa-operator/pull/710 +[#715]: https://github.com/stackabletech/opa-operator/pull/715 ## [25.3.0] - 2025-03-21 diff --git a/Cargo.lock b/Cargo.lock index 48bedf71..d65af525 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1623,7 +1623,7 @@ dependencies = [ [[package]] name = "k8s-version" version = "0.1.2" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.91.1#0f9b6f9669051e9c4f29e6e882acf3eff3ac3f14" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.92.0#5fdc47a10de685e4eea49fd0a3f6c3a15a4966c1" dependencies = [ "darling", "regex", @@ -3065,8 +3065,8 @@ dependencies = [ [[package]] name = "stackable-operator" -version = "0.91.1" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.91.1#0f9b6f9669051e9c4f29e6e882acf3eff3ac3f14" +version = "0.92.0" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.92.0#5fdc47a10de685e4eea49fd0a3f6c3a15a4966c1" dependencies = [ "chrono", "clap", @@ -3103,7 +3103,7 @@ dependencies = [ [[package]] name = "stackable-operator-derive" version = "0.3.1" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.91.1#0f9b6f9669051e9c4f29e6e882acf3eff3ac3f14" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.92.0#5fdc47a10de685e4eea49fd0a3f6c3a15a4966c1" dependencies = [ "darling", "proc-macro2", @@ -3114,7 +3114,7 @@ dependencies = [ [[package]] name = "stackable-shared" version = "0.0.1" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.91.1#0f9b6f9669051e9c4f29e6e882acf3eff3ac3f14" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.92.0#5fdc47a10de685e4eea49fd0a3f6c3a15a4966c1" dependencies = [ "kube", "semver", @@ -3125,8 +3125,8 @@ dependencies = [ [[package]] name = "stackable-telemetry" -version = "0.5.0" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.91.1#0f9b6f9669051e9c4f29e6e882acf3eff3ac3f14" +version = "0.6.0" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.92.0#5fdc47a10de685e4eea49fd0a3f6c3a15a4966c1" dependencies = [ "axum 0.8.3", "clap", @@ -3149,7 +3149,7 @@ dependencies = [ [[package]] name = "stackable-versioned" version = "0.7.1" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.91.1#0f9b6f9669051e9c4f29e6e882acf3eff3ac3f14" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.92.0#5fdc47a10de685e4eea49fd0a3f6c3a15a4966c1" dependencies = [ "stackable-versioned-macros", ] @@ -3157,7 +3157,7 @@ dependencies = [ [[package]] name = "stackable-versioned-macros" version = "0.7.1" -source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.91.1#0f9b6f9669051e9c4f29e6e882acf3eff3ac3f14" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.92.0#5fdc47a10de685e4eea49fd0a3f6c3a15a4966c1" dependencies = [ "convert_case", "darling", diff --git a/Cargo.nix b/Cargo.nix index 1ee8bac0..e12176cd 100644 --- a/Cargo.nix +++ b/Cargo.nix @@ -5146,8 +5146,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "0f9b6f9669051e9c4f29e6e882acf3eff3ac3f14"; - sha256 = "11zqwlwvfigca7lfsdch1wqd3vl694hff1avf6rhiawpnassj2cw"; + rev = "5fdc47a10de685e4eea49fd0a3f6c3a15a4966c1"; + sha256 = "0li9smdrz7danqz17lfkl0j9zl2i84csgc7d01lxs5qi8jcs9fzw"; }; libName = "k8s_version"; authors = [ @@ -10096,13 +10096,13 @@ rec { }; "stackable-operator" = rec { crateName = "stackable-operator"; - version = "0.91.1"; + version = "0.92.0"; edition = "2024"; workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "0f9b6f9669051e9c4f29e6e882acf3eff3ac3f14"; - sha256 = "11zqwlwvfigca7lfsdch1wqd3vl694hff1avf6rhiawpnassj2cw"; + rev = "5fdc47a10de685e4eea49fd0a3f6c3a15a4966c1"; + sha256 = "0li9smdrz7danqz17lfkl0j9zl2i84csgc7d01lxs5qi8jcs9fzw"; }; libName = "stackable_operator"; authors = [ @@ -10260,8 +10260,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "0f9b6f9669051e9c4f29e6e882acf3eff3ac3f14"; - sha256 = "11zqwlwvfigca7lfsdch1wqd3vl694hff1avf6rhiawpnassj2cw"; + rev = "5fdc47a10de685e4eea49fd0a3f6c3a15a4966c1"; + sha256 = "0li9smdrz7danqz17lfkl0j9zl2i84csgc7d01lxs5qi8jcs9fzw"; }; procMacro = true; libName = "stackable_operator_derive"; @@ -10295,8 +10295,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "0f9b6f9669051e9c4f29e6e882acf3eff3ac3f14"; - sha256 = "11zqwlwvfigca7lfsdch1wqd3vl694hff1avf6rhiawpnassj2cw"; + rev = "5fdc47a10de685e4eea49fd0a3f6c3a15a4966c1"; + sha256 = "0li9smdrz7danqz17lfkl0j9zl2i84csgc7d01lxs5qi8jcs9fzw"; }; libName = "stackable_shared"; authors = [ @@ -10331,13 +10331,13 @@ rec { }; "stackable-telemetry" = rec { crateName = "stackable-telemetry"; - version = "0.5.0"; + version = "0.6.0"; edition = "2024"; workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "0f9b6f9669051e9c4f29e6e882acf3eff3ac3f14"; - sha256 = "11zqwlwvfigca7lfsdch1wqd3vl694hff1avf6rhiawpnassj2cw"; + rev = "5fdc47a10de685e4eea49fd0a3f6c3a15a4966c1"; + sha256 = "0li9smdrz7danqz17lfkl0j9zl2i84csgc7d01lxs5qi8jcs9fzw"; }; libName = "stackable_telemetry"; authors = [ @@ -10441,8 +10441,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "0f9b6f9669051e9c4f29e6e882acf3eff3ac3f14"; - sha256 = "11zqwlwvfigca7lfsdch1wqd3vl694hff1avf6rhiawpnassj2cw"; + rev = "5fdc47a10de685e4eea49fd0a3f6c3a15a4966c1"; + sha256 = "0li9smdrz7danqz17lfkl0j9zl2i84csgc7d01lxs5qi8jcs9fzw"; }; libName = "stackable_versioned"; authors = [ @@ -10467,8 +10467,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "0f9b6f9669051e9c4f29e6e882acf3eff3ac3f14"; - sha256 = "11zqwlwvfigca7lfsdch1wqd3vl694hff1avf6rhiawpnassj2cw"; + rev = "5fdc47a10de685e4eea49fd0a3f6c3a15a4966c1"; + sha256 = "0li9smdrz7danqz17lfkl0j9zl2i84csgc7d01lxs5qi8jcs9fzw"; }; procMacro = true; libName = "stackable_versioned_macros"; diff --git a/Cargo.toml b/Cargo.toml index d74884a0..8b7e54a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ repository = "https://github.com/stackabletech/opa-operator" [workspace.dependencies] product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" } -stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", features = ["telemetry", "versioned"], tag = "stackable-operator-0.91.1" } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", features = ["telemetry", "versioned"], tag = "stackable-operator-0.92.0" } anyhow = "1.0" axum = "0.8" diff --git a/crate-hashes.json b/crate-hashes.json index e4629311..9dcf61ef 100644 --- a/crate-hashes.json +++ b/crate-hashes.json @@ -1,10 +1,10 @@ { - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.91.1#k8s-version@0.1.2": "11zqwlwvfigca7lfsdch1wqd3vl694hff1avf6rhiawpnassj2cw", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.91.1#stackable-operator-derive@0.3.1": "11zqwlwvfigca7lfsdch1wqd3vl694hff1avf6rhiawpnassj2cw", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.91.1#stackable-operator@0.91.1": "11zqwlwvfigca7lfsdch1wqd3vl694hff1avf6rhiawpnassj2cw", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.91.1#stackable-shared@0.0.1": "11zqwlwvfigca7lfsdch1wqd3vl694hff1avf6rhiawpnassj2cw", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.91.1#stackable-telemetry@0.5.0": "11zqwlwvfigca7lfsdch1wqd3vl694hff1avf6rhiawpnassj2cw", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.91.1#stackable-versioned-macros@0.7.1": "11zqwlwvfigca7lfsdch1wqd3vl694hff1avf6rhiawpnassj2cw", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.91.1#stackable-versioned@0.7.1": "11zqwlwvfigca7lfsdch1wqd3vl694hff1avf6rhiawpnassj2cw", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.92.0#k8s-version@0.1.2": "0li9smdrz7danqz17lfkl0j9zl2i84csgc7d01lxs5qi8jcs9fzw", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.92.0#stackable-operator-derive@0.3.1": "0li9smdrz7danqz17lfkl0j9zl2i84csgc7d01lxs5qi8jcs9fzw", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.92.0#stackable-operator@0.92.0": "0li9smdrz7danqz17lfkl0j9zl2i84csgc7d01lxs5qi8jcs9fzw", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.92.0#stackable-shared@0.0.1": "0li9smdrz7danqz17lfkl0j9zl2i84csgc7d01lxs5qi8jcs9fzw", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.92.0#stackable-telemetry@0.6.0": "0li9smdrz7danqz17lfkl0j9zl2i84csgc7d01lxs5qi8jcs9fzw", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.92.0#stackable-versioned-macros@0.7.1": "0li9smdrz7danqz17lfkl0j9zl2i84csgc7d01lxs5qi8jcs9fzw", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.92.0#stackable-versioned@0.7.1": "0li9smdrz7danqz17lfkl0j9zl2i84csgc7d01lxs5qi8jcs9fzw", "git+https://github.com/stackabletech/product-config.git?tag=0.7.0#product-config@0.7.0": "0gjsm80g6r75pm3824dcyiz4ysq1ka4c1if6k1mjm9cnd5ym0gny" } \ No newline at end of file diff --git a/rust/operator-binary/src/controller.rs b/rust/operator-binary/src/controller.rs index 0538dae0..415cdc66 100644 --- a/rust/operator-binary/src/controller.rs +++ b/rust/operator-binary/src/controller.rs @@ -782,6 +782,8 @@ fn build_server_rolegroup_daemonset( .context(AddVolumeMountSnafu)? .resources(merged_config.resources.to_owned().into()); + let console_and_file_log_level = bundle_builder_log_level(merged_config); + cb_bundle_builder .image_from_product_image(resolved_product_image) // inherit the pull policy and pull secrets, and then... .image(opa_bundle_builder_image) // ...override the image @@ -797,12 +799,10 @@ fn build_server_rolegroup_daemonset( &bundle_builder_container_name, )]) .add_env_var_from_field_path("WATCH_NAMESPACE", FieldPathEnvVar::Namespace) + .add_env_var("CONSOLE_LOG_LEVEL", console_and_file_log_level.to_string()) + .add_env_var("FILE_LOG_LEVEL", console_and_file_log_level.to_string()) .add_env_var( - "CONSOLE_LOG", - bundle_builder_log_level(merged_config).to_string(), - ) - .add_env_var( - "ROLLING_LOGS_DIR", + "FILE_LOG_DIRECTORY", format!("{STACKABLE_LOG_DIR}/{bundle_builder_container_name}"), ) .add_volume_mount(BUNDLES_VOLUME_NAME, BUNDLES_DIR) @@ -1180,11 +1180,7 @@ fn build_opa_start_command(merged_config: &v1alpha1::OpaConfig, container_name: // See https://stackoverflow.com/a/8048493 let logging_redirects = format!( - "&> >(CONSOLE_LEVEL={console} FILE_LEVEL={file} DECISION_LEVEL={decision} SERVER_LEVEL={server} OPA_ROLLING_LOG_FILE_SIZE_BYTES={OPA_ROLLING_LOG_FILE_SIZE_BYTES} OPA_ROLLING_LOG_FILES={OPA_ROLLING_LOG_FILES} STACKABLE_LOG_DIR={STACKABLE_LOG_DIR} CONTAINER_NAME={container_name} process-logs)", - file = file_log_level, - console = console_log_level, - decision = decision_log_level, - server = server_log_level + "&> >(CONSOLE_LEVEL={console_log_level} FILE_LEVEL={file_log_level} DECISION_LEVEL={decision_log_level} SERVER_LEVEL={server_log_level} OPA_ROLLING_LOG_FILE_SIZE_BYTES={OPA_ROLLING_LOG_FILE_SIZE_BYTES} OPA_ROLLING_LOG_FILES={OPA_ROLLING_LOG_FILES} STACKABLE_LOG_DIR={STACKABLE_LOG_DIR} CONTAINER_NAME={container_name} process-logs)" ); // TODO: Think about adding --shutdown-wait-period, as suggested by https://github.com/open-policy-agent/opa/issues/2764