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
8 changes: 4 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE/pre-release-rust-deps.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Bump Rust Dependencies for Stackable Release XX.(X)X
# Bump Rust Dependencies for Stackable Release YY.M.X

<!--
Make sure to update the link in 'issues/.github/ISSUE_TEMPLATE/pre-release-operator-rust-deps.md'
Expand Down Expand Up @@ -32,7 +32,7 @@ Part of <https://github.com/stackabletech/issues/issues/TRACKING_ISSUE>
```[tasklist]
### Bump Rust Dependencies
- [ ] Bump `stackable-operator` and friends.
- [ ] Bump `product-version`.
- [ ] Bump all other dependencies.
- [ ] Bump `stackable-operator` and friends
- [ ] Bump `product-config`
- [ ] Bump all other dependencies
```
9 changes: 6 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: '0'
CARGO_PROFILE_DEV_DEBUG: '0'
RUST_TOOLCHAIN_VERSION: "1.84.1"
RUST_TOOLCHAIN_VERSION: "1.85.0"
RUST_NIGHTLY_TOOLCHAIN_VERSION: "nightly-2025-01-15"
PYTHON_VERSION: "3.12"
RUSTFLAGS: "-D warnings"
RUSTDOCFLAGS: "-D warnings"
Expand Down Expand Up @@ -136,9 +137,11 @@ jobs:
submodules: recursive
- uses: dtolnay/rust-toolchain@c5a29ddb4d9d194e7c84ec8c3fba61b1c31fee8c
with:
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN_VERSION }}
components: rustfmt
- run: cargo fmt --all -- --check
- env:
RUST_TOOLCHAIN_VERSION: ${{ env.RUST_NIGHTLY_TOOLCHAIN_VERSION }}
run: cargo "+$RUST_TOOLCHAIN_VERSION" fmt --all -- --check

run_clippy:
name: Run Clippy
Expand Down
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"rust-analyzer.rustfmt.overrideCommand": [
"rustfmt",
"+nightly-2025-01-15",
"--"
],
}
9 changes: 0 additions & 9 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ ignore = [
#
# TODO: Remove after https://github.com/kube-rs/kube/pull/1652 is merged
"RUSTSEC-2024-0384",

# https://rustsec.org/advisories/RUSTSEC-2025-0012
# "backoff" is unmainted.
#
# Upstream (kube) has switched to backon in 0.99.0, and an upgrade is scheduled on our end. In the meantime,
# this is a very low-severity problem.
#
# TODO: Remove after upgrading to kube 0.99.
"RUSTSEC-2025-0012",
]

[bans]
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# DO NOT EDIT, this file is generated by operator-templating
[toolchain]
channel = "1.84.1"
channel = "1.85.0"
4 changes: 2 additions & 2 deletions rust/olm-deployer/src/data.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::{anyhow, Context};
use stackable_operator::kube::{api::DynamicObject, ResourceExt};
use anyhow::{Context, anyhow};
use stackable_operator::kube::{ResourceExt, api::DynamicObject};

pub fn container<'a>(
target: &'a mut DynamicObject,
Expand Down
2 changes: 1 addition & 1 deletion rust/olm-deployer/src/env/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use stackable_operator::{
k8s_openapi::api::{apps::v1::Deployment, core::v1::EnvVar},
kube::{
api::{DynamicObject, GroupVersionKind},
ResourceExt,
api::{DynamicObject, GroupVersionKind},
},
};

Expand Down
4 changes: 2 additions & 2 deletions rust/olm-deployer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ mod owner;
mod resources;
mod tolerations;

use anyhow::{anyhow, bail, Context, Result};
use clap::{crate_description, crate_version, Parser};
use anyhow::{Context, Result, anyhow, bail};
use clap::{Parser, crate_description, crate_version};
use stackable_operator::{
cli::Command,
client,
Expand Down
2 changes: 1 addition & 1 deletion rust/olm-deployer/src/owner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use stackable_operator::{
apimachinery::pkg::apis::meta::v1::OwnerReference,
},
kube::{
Resource,
api::{DynamicObject, ResourceExt},
discovery::Scope,
Resource,
},
};

Expand Down
2 changes: 1 addition & 1 deletion rust/olm-deployer/src/resources/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use stackable_operator::{
k8s_openapi::api::{apps::v1::Deployment, core::v1::ResourceRequirements},
kube::{
api::{DynamicObject, GroupVersionKind},
ResourceExt,
api::{DynamicObject, GroupVersionKind},
},
};

Expand Down
26 changes: 15 additions & 11 deletions rust/olm-deployer/src/tolerations/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use anyhow::{anyhow, Context};
use anyhow::{Context, anyhow};
use stackable_operator::{
k8s_openapi::api::{apps::v1::Deployment, core::v1::Toleration},
kube::{
api::{DynamicObject, GroupVersionKind},
ResourceExt,
api::{DynamicObject, GroupVersionKind},
},
};

Expand All @@ -27,10 +27,12 @@ pub(super) fn maybe_copy_tolerations(
.pointer_mut("/spec")
.context(anyhow!("DaemonSet named [{tname}] has empty .spec"))?,
path,
)? = serde_json::json!(tolerations
.iter()
.map(|t| serde_json::json!(t))
.collect::<Vec<serde_json::Value>>());
)? = serde_json::json!(
tolerations
.iter()
.map(|t| serde_json::json!(t))
.collect::<Vec<serde_json::Value>>()
);
}
}

Expand Down Expand Up @@ -114,11 +116,13 @@ spec:
let mut daemonset = DAEMONSET.clone();
maybe_copy_tolerations(&DEPLOYMENT, &mut daemonset, &gvk)?;

let expected = serde_json::json!(deployment_tolerations(&DEPLOYMENT)
.unwrap()
.iter()
.map(|t| serde_json::json!(t))
.collect::<Vec<serde_json::Value>>());
let expected = serde_json::json!(
deployment_tolerations(&DEPLOYMENT)
.unwrap()
.iter()
.map(|t| serde_json::json!(t))
.collect::<Vec<serde_json::Value>>()
);

assert_eq!(
daemonset.data.pointer("/spec/template/spec/tolerations"),
Expand Down
4 changes: 2 additions & 2 deletions rust/operator-binary/src/csi_server/controller.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use csi_grpc as csi;
use serde::{de::IntoDeserializer, Deserialize};
use serde::{Deserialize, de::IntoDeserializer};
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_operator::{
commons::listener::{Listener, ListenerClass, ServiceType},
Expand All @@ -8,7 +8,7 @@ use stackable_operator::{
};
use tonic::{Request, Response, Status};

use super::{tonic_unimplemented, ListenerSelector, ListenerVolumeContext};
use super::{ListenerSelector, ListenerVolumeContext, tonic_unimplemented};
use crate::utils::error::error_full_message;

pub struct ListenerOperatorController {
Expand Down
104 changes: 49 additions & 55 deletions rust/operator-binary/src/csi_server/node.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{fmt::Debug, path::PathBuf};

use csi_grpc::{self as csi, v1::Topology};
use serde::{de::IntoDeserializer, Deserialize};
use serde::{Deserialize, de::IntoDeserializer};
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_operator::{
builder::meta::OwnerReferenceBuilder,
Expand All @@ -17,11 +17,11 @@ use stackable_operator::{
};
use tonic::{Request, Response, Status};

use super::{tonic_unimplemented, ListenerSelector, ListenerVolumeContext};
use super::{ListenerSelector, ListenerVolumeContext, tonic_unimplemented};
use crate::{
listener_controller::{
listener_mounted_pod_label, listener_persistent_volume_label, ListenerMountedPodLabelError,
ListenerPersistentVolumeLabelError,
ListenerMountedPodLabelError, ListenerPersistentVolumeLabelError,
listener_mounted_pod_label, listener_persistent_volume_label,
},
utils::{address::node_primary_addresses, error::error_full_message},
};
Expand Down Expand Up @@ -258,10 +258,12 @@ impl csi::v1::node_server::Node for ListenerOperatorNode {
metadata: ObjectMeta {
namespace: Some(ns.clone()),
name: Some(pvc_name.to_string()),
owner_references: Some(vec![OwnerReferenceBuilder::new()
.initialize_from_resource(&pv)
.build()
.context(BuildListenerOwnerRefSnafu)?]),
owner_references: Some(vec![
OwnerReferenceBuilder::new()
.initialize_from_resource(&pv)
.build()
.context(BuildListenerOwnerRefSnafu)?,
]),
// Propagate the labels from the PVC to the Listener object, so it can be found easier, e.g. to
// determine the endpoints of stacklets.
labels: pvc.metadata.labels,
Expand Down Expand Up @@ -302,21 +304,17 @@ impl csi::v1::node_server::Node for ListenerOperatorNode {
// Add listener label to PV, allowing traffic to be directed based on reservations, rather than which replicas are *currently* active.
// See https://github.com/stackabletech/listener-operator/issues/220
self.client
.apply_patch(
FIELD_MANAGER_SCOPE,
&pv,
&PersistentVolume {
metadata: ObjectMeta {
labels: Some(listener_persistent_volume_label(&listener).context(
ListenerPvReferenceSnafu {
listener: ObjectRef::from_obj(&listener),
},
)?),
..Default::default()
},
.apply_patch(FIELD_MANAGER_SCOPE, &pv, &PersistentVolume {
metadata: ObjectMeta {
labels: Some(listener_persistent_volume_label(&listener).context(
ListenerPvReferenceSnafu {
listener: ObjectRef::from_obj(&listener),
},
)?),
..Default::default()
},
)
..Default::default()
})
.await
.with_context(|_| AddListenerLabelToPvSnafu {
pv: ObjectRef::from_obj(&pv),
Expand All @@ -327,23 +325,20 @@ impl csi::v1::node_server::Node for ListenerOperatorNode {
// IMPORTANT
// Use a merge patch rather than an apply so that we don't delete labels added by other listener volumes.
// Volumes aren't hot-swappable anyway, and all labels will be removed when the pod is deleted.
.merge_patch(
&pod,
&Pod {
metadata: ObjectMeta {
labels: Some(
[listener_mounted_pod_label(&listener).context(
ListenerPodSelectorSnafu {
listener: ObjectRef::from_obj(&listener),
},
)?]
.into(),
),
..Default::default()
},
.merge_patch(&pod, &Pod {
metadata: ObjectMeta {
labels: Some(
[listener_mounted_pod_label(&listener).context(
ListenerPodSelectorSnafu {
listener: ObjectRef::from_obj(&listener),
},
)?]
.into(),
),
..Default::default()
},
)
..Default::default()
})
.await
.with_context(|_| AddListenerLabelToPodSnafu {
pod: ObjectRef::from_obj(&pod),
Expand Down Expand Up @@ -517,29 +512,28 @@ async fn publish_pod_listener(
metadata: ObjectMeta {
name: pod.metadata.uid.as_deref().map(|uid| format!("pod-{uid}")),
namespace: pod.metadata.namespace.clone(),
owner_references: Some(vec![OwnerReferenceBuilder::new()
.initialize_from_resource(pod)
.build()
.context(BuildListenerOwnerRefSnafu)?]),
owner_references: Some(vec![
OwnerReferenceBuilder::new()
.initialize_from_resource(pod)
.build()
.context(BuildListenerOwnerRefSnafu)?,
]),
..Default::default()
},
spec: PodListenersSpec {
listeners: [(
listener_pod_volume.name.clone(),
PodListener {
scope: if listener
.status
.as_ref()
.and_then(|s| s.node_ports.as_ref())
.is_some()
{
PodListenerScope::Node
} else {
PodListenerScope::Cluster
},
ingress_addresses: Some(listener_addresses.to_vec()),
listeners: [(listener_pod_volume.name.clone(), PodListener {
scope: if listener
.status
.as_ref()
.and_then(|s| s.node_ports.as_ref())
.is_some()
{
PodListenerScope::Node
} else {
PodListenerScope::Cluster
},
)]
ingress_addresses: Some(listener_addresses.to_vec()),
})]
.into(),
},
};
Expand Down
Loading
Loading