Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
565 changes: 350 additions & 215 deletions Cargo.lock

Large diffs are not rendered by default.

1,094 changes: 773 additions & 321 deletions Cargo.nix

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ edition = "2021"
repository = "https://github.com/stackabletech/listener-operator"

[workspace.dependencies]
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", features = ["telemetry", "versioned"], tag = "stackable-operator-0.94.0" }
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", features = ["telemetry", "versioned"], tag = "stackable-operator-0.95.0" }

anyhow = "1.0"
built = { version = "0.8", features = ["chrono", "git2"] }
Expand All @@ -20,8 +20,8 @@ futures = { version = "0.3" }
h2 = "0.4"
libc = "0.2"
pin-project = "1.1"
prost = "0.13"
prost-types = "0.13"
prost = "0.14"
prost-types = "0.14"
serde = "1.0"
serde_json = "1.0"
serde_yaml = "0.9"
Expand All @@ -30,9 +30,10 @@ strum = { version = "0.27", features = ["derive"] }
socket2 = { version = "0.6", features = ["all"] }
tokio = { version = "1.40", features = ["full"] }
tokio-stream = { version = "0.1", features = ["net"] }
tonic = "0.13"
tonic-build = "0.13"
tonic-reflection = "0.13"
tonic = "0.14"
tonic-prost = "0.14"
tonic-prost-build = "0.14"
tonic-reflection = "0.14"
tracing = "0.1.40"
walkdir = "2.5.0"

Expand Down
14 changes: 7 additions & 7 deletions crate-hashes.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions deploy/helm/listener-operator/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,34 @@ spec:
- run
- controller
env:
# The following env vars are passed as clap (think CLI) arguments to the operator.
# They are picked up by clap using the structs defied in the operator.
# (which is turn pulls in https://github.com/stackabletech/operator-rs/blob/main/crates/stackable-operator/src/cli.rs)
# You can read there about the expected values and purposes.

- name: CSI_ENDPOINT
value: /csi/csi.sock

# Sometimes products need to know the operator image, e.g. the opa-bundle-builder OPA
# sidecar uses the operator image.
- name: OPERATOR_IMAGE
# Tilt can use annotations as image paths, but not env variables
valueFrom:
fieldRef:
fieldPath: metadata.annotations['internal.stackable.tech/image']

# Namespace the operator Pod is running in, e.g. used to construct the conversion
# webhook endpoint.
- name: OPERATOR_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace

# The name of the Kubernetes Service that point to the operator Pod, e.g. used to
# construct the conversion webhook endpoint.
- name: OPERATOR_SERVICE_NAME
value: {{ include "operator.fullname" . }}

# Operators need to know the node name they are running on, to e.g. discover the
# Kubernetes domain name from the kubelet API.
- name: KUBERNETES_NODE_NAME
Expand Down
25 changes: 25 additions & 0 deletions deploy/helm/listener-operator/templates/node-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,34 @@ spec:
- run
- node
env:
# The following env vars are passed as clap (think CLI) arguments to the operator.
# They are picked up by clap using the structs defied in the operator.
# (which is turn pulls in https://github.com/stackabletech/operator-rs/blob/main/crates/stackable-operator/src/cli.rs)
# You can read there about the expected values and purposes.

- name: CSI_ENDPOINT
value: /csi/csi.sock

# Sometimes products need to know the operator image, e.g. the opa-bundle-builder OPA
# sidecar uses the operator image.
- name: OPERATOR_IMAGE
# Tilt can use annotations as image paths, but not env variables
valueFrom:
fieldRef:
fieldPath: metadata.annotations['internal.stackable.tech/image']

# Namespace the operator Pod is running in, e.g. used to construct the conversion
# webhook endpoint.
- name: OPERATOR_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace

# The name of the Kubernetes Service that point to the operator Pod, e.g. used to
# construct the conversion webhook endpoint.
- name: OPERATOR_SERVICE_NAME
value: {{ include "operator.fullname" . }}

# Operators need to know the node name they are running on, to e.g. discover the
# Kubernetes domain name from the kubelet API.
- name: KUBERNETES_NODE_NAME
Expand Down
5 changes: 3 additions & 2 deletions rust/csi-grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ publish = false

[dependencies]
prost.workspace = true
prost-types.workspace = true
tonic.workspace = true
tonic-prost.workspace = true
prost-types.workspace = true

[build-dependencies]
tonic-build.workspace = true
tonic-prost-build.workspace = true
2 changes: 1 addition & 1 deletion rust/csi-grpc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::path::PathBuf;

fn main() {
let out_dir = PathBuf::from(std::env::var("OUT_DIR").expect("OUT_DIR is required"));
tonic_build::configure()
tonic_prost_build::configure()
.file_descriptor_set_path(out_dir.join("file_descriptor_set.bin"))
.compile_protos(&["csi.proto"], &["vendor/csi"])
.unwrap();
Expand Down
16 changes: 7 additions & 9 deletions rust/olm-deployer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use stackable_operator::{
discovery::{ApiResource, Discovery, Scope},
},
telemetry::{Tracing, tracing::TelemetryOptions},
utils::cluster_info::KubernetesClusterInfoOpts,
utils::cluster_info::KubernetesClusterInfoOptions,
};

pub const APP_NAME: &str = "stkbl-listener-olm-deployer";
Expand Down Expand Up @@ -73,10 +73,10 @@ struct OlmDeployerRun {
dir: std::path::PathBuf,

#[command(flatten)]
pub telemetry_arguments: TelemetryOptions,
pub telemetry: TelemetryOptions,

#[command(flatten)]
pub cluster_info_opts: KubernetesClusterInfoOpts,
pub cluster_info: KubernetesClusterInfoOptions,
}

#[tokio::main]
Expand All @@ -88,16 +88,15 @@ async fn main() -> Result<()> {
deployer,
namespace,
dir,
telemetry_arguments,
cluster_info_opts,
telemetry,
cluster_info,
}) = opts.cmd
{
// NOTE (@NickLarsenNZ): Before stackable-telemetry was used:
// - The console log level was set by `STKBL_LISTENER_OLM_DEPLOYER_LOG`, and is now `CONSOLE_LOG` (when using Tracing::pre_configured).
// - The file log level was (maybe?) set by `STKBL_LISTENER_OLM_DEPLOYER_LOG`, and is now set via `FILE_LOG` (when using Tracing::pre_configured).
// - The file log directory was set by `STKBL_LISTENER_OLM_DEPLOYER_LOG_DIRECTORY`, and is now set by `ROLLING_LOGS_DIR` (or via `--rolling-logs <DIRECTORY>`).
let _tracing_guard =
Tracing::pre_configured(built_info::PKG_NAME, telemetry_arguments).init()?;
let _tracing_guard = Tracing::pre_configured(built_info::PKG_NAME, telemetry).init()?;

tracing::info!(
built_info.pkg_version = built_info::PKG_VERSION,
Expand All @@ -109,8 +108,7 @@ async fn main() -> Result<()> {
description = built_info::PKG_DESCRIPTION
);

let client =
client::initialize_operator(Some(APP_NAME.to_string()), &cluster_info_opts).await?;
let client = client::initialize_operator(Some(APP_NAME.to_string()), &cluster_info).await?;

let deployment = get_deployment(&csv, &deployer, &namespace, &client).await?;
let cluster_role = get_cluster_role(&csv, &client).await?;
Expand Down
2 changes: 1 addition & 1 deletion rust/operator-binary/src/listener_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use stackable_operator::{
},
kvp::{Annotations, Labels},
logging::controller::{ReconcilerError, report_controller_reconciled},
time::Duration,
shared::time::Duration,
};
use strum::IntoStaticStr;

Expand Down
22 changes: 13 additions & 9 deletions rust/operator-binary/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ use csi_server::{
use futures::{FutureExt, TryStreamExt, pin_mut};
use stackable_operator::{
self, YamlSchema,
cli::OperatorEnvironmentOptions,
crd::listener::{
Listener, ListenerClass, ListenerClassVersion, ListenerVersion, PodListeners,
PodListenersVersion,
},
shared::yaml::SerializeOptions,
telemetry::{Tracing, tracing::TelemetryOptions},
utils::cluster_info::KubernetesClusterInfoOpts,
utils::cluster_info::KubernetesClusterInfoOptions,
};
use tokio::signal::unix::{SignalKind, signal};
use tokio_stream::wrappers::UnixListenerStream;
Expand Down Expand Up @@ -50,10 +51,13 @@ struct ListenerOperatorRun {
mode: RunMode,

#[command(flatten)]
pub telemetry_arguments: TelemetryOptions,
operator_environment: OperatorEnvironmentOptions,

#[command(flatten)]
pub cluster_info_opts: KubernetesClusterInfoOpts,
telemetry: TelemetryOptions,

#[command(flatten)]
cluster_info: KubernetesClusterInfoOptions,
}

#[derive(Debug, clap::Parser, strum::AsRefStr, strum::Display)]
Expand Down Expand Up @@ -84,15 +88,15 @@ async fn main() -> anyhow::Result<()> {
stackable_operator::cli::Command::Run(ListenerOperatorRun {
csi_endpoint,
mode,
telemetry_arguments,
cluster_info_opts,
operator_environment: _,
telemetry,
cluster_info,
}) => {
// NOTE (@NickLarsenNZ): Before stackable-telemetry was used:
// - The console log level was set by `LISTENER_OPERATOR_LOG`, and is now `CONSOLE_LOG` (when using Tracing::pre_configured).
// - The file log level was (maybe?) set by `LISTENER_OPERATOR_LOG`, and is now set via `FILE_LOG` (when using Tracing::pre_configured).
// - The file log directory was set by `LISTENER_OPERATOR_LOG_DIRECTORY`, and is now set by `ROLLING_LOGS_DIR` (or via `--rolling-logs <DIRECTORY>`).
let _tracing_guard =
Tracing::pre_configured(built_info::PKG_NAME, telemetry_arguments).init()?;
let _tracing_guard = Tracing::pre_configured(built_info::PKG_NAME, telemetry).init()?;

tracing::info!(
run_mode = %mode,
Expand All @@ -106,7 +110,7 @@ async fn main() -> anyhow::Result<()> {
);
let client = stackable_operator::client::initialize_operator(
Some(OPERATOR_KEY.to_string()),
&cluster_info_opts,
&cluster_info,
)
.await?;
if csi_endpoint
Expand Down Expand Up @@ -141,7 +145,7 @@ async fn main() -> anyhow::Result<()> {
.map_err(|err| err.factor_first().0)?;
}
RunMode::Node => {
let node_name = &cluster_info_opts.kubernetes_node_name;
let node_name = &cluster_info.kubernetes_node_name;
csi_server
.add_service(NodeServer::new(ListenerOperatorNode {
client: client.clone(),
Expand Down
Loading