Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update templated files (f1f1a9e) #583

Merged
merged 6 commits into from
Apr 3, 2025
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"
11 changes: 4 additions & 7 deletions rust/krb5-provision-keytab/src/active_directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{
use byteorder::{LittleEndian, WriteBytesExt};
use krb5::{Keyblock, Keytab, KrbContext, Principal, PrincipalUnparseOptions};
use ldap3::{Ldap, LdapConnAsync, LdapConnSettings, Scope, SearchEntry};
use rand::{seq::IndexedRandom, CryptoRng};
use rand::{CryptoRng, seq::IndexedRandom};
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_krb5_provision_keytab::ActiveDirectorySamAccountNameRules;
use stackable_operator::{
Expand Down Expand Up @@ -399,12 +399,9 @@ async fn get_user_kvno(

// Perform search with KVNO attribute
let (search_results, _) = ldap
.search(
distinguished_name,
Scope::Base,
"(objectClass=user)",
vec!["msDS-KeyVersionNumber"],
)
.search(distinguished_name, Scope::Base, "(objectClass=user)", vec![
"msDS-KeyVersionNumber",
])
.await
.context(SearchLdapSnafu)?
.success()
Expand Down
2 changes: 1 addition & 1 deletion rust/krb5-provision-keytab/src/credential_cache.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use futures::{TryFuture, TryFutureExt};
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_operator::{
k8s_openapi::{api::core::v1::Secret, ByteString},
k8s_openapi::{ByteString, api::core::v1::Secret},
kube::{
self,
api::{Patch, PatchParams},
Expand Down
2 changes: 1 addition & 1 deletion rust/krb5-provision-keytab/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{
ffi::{CString, NulError},
fmt::Display,
io::{stdin, BufReader},
io::{BufReader, stdin},
};

use krb5::{Keyblock, Keytab};
Expand Down
2 changes: 1 addition & 1 deletion rust/krb5-provision-keytab/src/mit.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::ffi::CStr;

use krb5::{kadm5, Keytab, Principal};
use krb5::{Keytab, Principal, kadm5};
use snafu::{ResultExt, Snafu};

#[derive(Debug, Snafu)]
Expand Down
2 changes: 1 addition & 1 deletion rust/krb5/src/kadm5.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::{
ffi::{c_char, c_int, CStr, CString},
ffi::{CStr, CString, c_char, c_int},
fmt::Display,
slice,
};
Expand Down
2 changes: 1 addition & 1 deletion rust/krb5/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! The primary entry point is [`KrbContext`].

use std::{
ffi::{c_char, c_int, CStr},
ffi::{CStr, c_char, c_int},
fmt::{Debug, Display},
ops::Deref,
};
Expand Down
2 changes: 1 addition & 1 deletion rust/krb5/src/profile.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::{
ffi::{c_char, CStr, CString},
ffi::{CStr, CString, c_char},
fmt::Display,
};

Expand Down
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::{bail, Result};
use stackable_operator::kube::{api::DynamicObject, ResourceExt};
use anyhow::{Result, bail};
use stackable_operator::kube::{ResourceExt, api::DynamicObject};

pub fn data_field_as_mut<'a>(
value: &'a mut serde_json::Value,
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 @@ -18,8 +18,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/namespace/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Result;
use serde_json::{json, Value};
use serde_json::{Value, json};
use stackable_operator::kube::api::{DynamicObject, GroupVersionKind};

use crate::data;
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
19 changes: 11 additions & 8 deletions rust/olm-deployer/src/tolerations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ pub(super) fn maybe_copy_tolerations(
if target_gvk.kind == "DaemonSet" {
if let Some(tolerations) = deployment_tolerations(source) {
let path = "template/spec/tolerations".split("/");
*get_or_create(target.data.pointer_mut("/spec").unwrap(), path)? =
serde_json::json!(tolerations
*get_or_create(target.data.pointer_mut("/spec").unwrap(), path)? = serde_json::json!(
tolerations
.iter()
.map(|t| serde_json::json!(t))
.collect::<Vec<serde_json::Value>>());
.collect::<Vec<serde_json::Value>>()
);
}
}

Expand Down Expand Up @@ -104,11 +105,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
8 changes: 5 additions & 3 deletions rust/operator-binary/src/backend/cert_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ use std::collections::HashSet;
use async_trait::async_trait;
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_operator::{
k8s_openapi::{api::core::v1::Secret, ByteString},
k8s_openapi::{ByteString, api::core::v1::Secret},
kube::{api::ObjectMeta, runtime::reflector::ObjectRef},
time::Duration,
};

use super::{
ScopeAddressesError, SecretBackend, SecretBackendError, SecretContents, SecretVolumeSelector,
k8s_search::LABEL_SCOPE_NODE,
pod_info::{Address, PodInfo, SchedulingPodInfo},
scope::SecretScope,
ScopeAddressesError, SecretBackend, SecretBackendError, SecretContents, SecretVolumeSelector,
};
use crate::{
crd::{self, CertificateKeyGeneration},
Expand All @@ -32,7 +32,9 @@ const FIELD_MANAGER_SCOPE: &str = "backend.cert-manager";

#[derive(Debug, Snafu)]
pub enum Error {
#[snafu(display("unable to find PersistentVolumeClaim for volume (try deleting and recreating the Pod, ensure you are using the `ephemeral:` volume type, rather than `csi:`)"))]
#[snafu(display(
"unable to find PersistentVolumeClaim for volume (try deleting and recreating the Pod, ensure you are using the `ephemeral:` volume type, rather than `csi:`)"
))]
NoPvcName,

#[snafu(display("failed to get addresses for scope {:?}", format!("{scope}")))]
Expand Down
3 changes: 2 additions & 1 deletion rust/operator-binary/src/backend/dynamic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ use snafu::{ResultExt, Snafu};
use stackable_operator::kube::runtime::reflector::ObjectRef;

use super::{
SecretBackend, SecretBackendError, SecretVolumeSelector,
kerberos_keytab::{self, KerberosProfile},
pod_info::{PodInfo, SchedulingPodInfo},
tls, SecretBackend, SecretBackendError, SecretVolumeSelector,
tls,
};
use crate::{
crd::{self, SecretClass},
Expand Down
4 changes: 2 additions & 2 deletions rust/operator-binary/src/backend/k8s_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ use async_trait::async_trait;
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_operator::{
k8s_openapi::{
api::core::v1::Secret, apimachinery::pkg::apis::meta::v1::LabelSelector, ByteString,
ByteString, api::core::v1::Secret, apimachinery::pkg::apis::meta::v1::LabelSelector,
},
kube::api::ListParams,
kvp::{LabelError, LabelSelectorExt, Labels},
};

use super::{
SecretBackend, SecretBackendError, SecretContents, SecretVolumeSelector,
pod_info::{PodInfo, SchedulingPodInfo},
scope::SecretScope,
SecretBackend, SecretBackendError, SecretContents, SecretVolumeSelector,
};
use crate::{crd::SearchNamespace, format::SecretData, utils::Unloggable};

Expand Down
6 changes: 3 additions & 3 deletions rust/operator-binary/src/backend/kerberos_keytab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ use tokio::{
};

use super::{
pod_info::Address, scope::SecretScope, ScopeAddressesError, SecretBackend, SecretBackendError,
SecretContents,
ScopeAddressesError, SecretBackend, SecretBackendError, SecretContents, pod_info::Address,
scope::SecretScope,
};
use crate::{
crd::{
ActiveDirectorySamAccountNameRules, InvalidKerberosPrincipal, KerberosKeytabBackendAdmin,
KerberosPrincipal,
},
format::{well_known, SecretData, WellKnownSecretData},
format::{SecretData, WellKnownSecretData, well_known},
utils::Unloggable,
};

Expand Down
6 changes: 3 additions & 3 deletions rust/operator-binary/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub use k8s_search::K8sSearch;
pub use kerberos_keytab::KerberosKeytab;
use pod_info::Address;
use scope::SecretScope;
use serde::{de::Unexpected, Deserialize, Deserializer, Serialize};
use serde::{Deserialize, Deserializer, Serialize, de::Unexpected};
use snafu::{OptionExt, Snafu};
use stackable_operator::{
k8s_openapi::chrono::{DateTime, FixedOffset},
Expand All @@ -26,8 +26,8 @@ pub use tls::TlsGenerate;

use self::pod_info::SchedulingPodInfo;
use crate::format::{
well_known::{CompatibilityOptions, NamingOptions},
SecretData, SecretFormat,
well_known::{CompatibilityOptions, NamingOptions},
};

/// Configuration provided by the `Volume` selecting what secret data should be provided
Expand Down Expand Up @@ -302,7 +302,7 @@ impl SecretBackendError for Infallible {
mod tests {
use std::collections::HashMap;

use serde::de::{value::MapDeserializer, IntoDeserializer};
use serde::de::{IntoDeserializer, value::MapDeserializer};

use super::*;

Expand Down
12 changes: 7 additions & 5 deletions rust/operator-binary/src/backend/tls/ca.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ use openssl::{
pkey::{PKey, Private},
rsa::Rsa,
x509::{
X509, X509Builder, X509NameBuilder,
extension::{AuthorityKeyIdentifier, BasicConstraints, KeyUsage, SubjectKeyIdentifier},
X509Builder, X509NameBuilder, X509,
},
};
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_operator::{
k8s_openapi::{
api::core::v1::{ConfigMap, Secret},
ByteString,
api::core::v1::{ConfigMap, Secret},
},
kube::{
self,
api::{
entry::{self, Entry},
DynamicObject, PostParams,
entry::{self, Entry},
},
runtime::reflector::ObjectRef,
},
Expand All @@ -38,7 +38,7 @@ use tracing::{info, info_span, warn};
use crate::{
backend::SecretBackendError,
crd::{AdditionalTrustRoot, CertificateKeyGeneration},
utils::{asn1time_to_offsetdatetime, Asn1TimeParseError, Unloggable},
utils::{Asn1TimeParseError, Unloggable, asn1time_to_offsetdatetime},
};

/// v1 format: support a single cert/pkey pair
Expand Down Expand Up @@ -86,7 +86,9 @@ pub enum Error {
object: ObjectRef<DynamicObject>,
},

#[snafu(display("unsupported certificate format in key {key:?} of {object}; supported extensions: .crt, .der"))]
#[snafu(display(
"unsupported certificate format in key {key:?} of {object}; supported extensions: .crt, .der"
))]
UnsupportedCertificateFormat {
key: String,
object: ObjectRef<DynamicObject>,
Expand Down
Loading
Loading