Skip to content

Commit c537512

Browse files
committed
fix conflict
2 parents f31b965 + 13e0232 commit c537512

26 files changed

Lines changed: 189 additions & 91 deletions

File tree

Cargo.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ json-patch = "4.0.0"
3737
k8s-openapi = { version = "0.26.0", default-features = false, features = ["schemars", "v1_34"] }
3838
# We use rustls instead of openssl for easier portability, e.g. so that we can build stackablectl without the need to vendor (build from source) openssl
3939
# We use ring instead of aws-lc-rs, as this currently fails to build in "make run-dev"
40-
# We pin the kube version, as we use a patch for 2.0.1 below
41-
kube = { version = "=2.0.1", default-features = false, features = ["client", "jsonpatch", "runtime", "derive", "rustls-tls", "ring"] }
40+
# We pin the kube version, as we use a patch for 2.0.1
41+
kube = { git = "https://github.com/stackabletech/kube-rs", branch = "2.0.1-fix-schema-hoisting", version = "=2.0.1", default-features = false, features = ["client", "jsonpatch", "runtime", "derive", "rustls-tls", "ring"] }
4242
opentelemetry = "0.31.0"
4343
opentelemetry_sdk = { version = "0.31.0", features = ["rt-tokio"] }
4444
opentelemetry-appender-tracing = "0.31.0"
@@ -84,6 +84,11 @@ url = { version = "2.5.2", features = ["serde"] }
8484
x509-cert = { version = "0.2.5", features = ["builder"] }
8585
zeroize = "1.8.1"
8686

87+
[workspace.lints.clippy]
88+
unwrap_in_result = "deny"
89+
unwrap_used = "deny"
90+
panic = "deny"
91+
8792
# Use O3 in tests to improve the RSA key generation speed in the stackable-certs crate
8893
[profile.test.package]
8994
stackable-certs.opt-level = 3
@@ -94,6 +99,3 @@ rsa.opt-level = 3
9499
[profile.dev.package]
95100
insta.opt-level = 3
96101
similar.opt-level = 3
97-
98-
[patch.crates-io]
99-
kube = { git = "https://github.com/stackabletech/kube-rs", branch = "2.0.1-fix-schema-hoisting" }

clippy.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
allow-unwrap-in-tests = true
2+
allow-panic-in-tests = true

crates/k8s-version/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ quote.workspace = true
2323
proc-macro2.workspace = true
2424
serde_yaml.workspace = true
2525
syn.workspace = true
26+
27+
[lints]
28+
workspace = true

crates/k8s-version/src/level/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ pub enum Level {
4747
impl FromStr for Level {
4848
type Err = ParseLevelError;
4949

50+
// SAFETY: We purposefully allow the `clippy::unwrap_in_result` lint below in this function.
51+
// We can use expect here, because the correct match labels must be used.
52+
//
53+
// FIXME (@Techassi): This attribute can be used on individual unwrap and expect calls since
54+
// Rust 1.91.0. We should move this attribute to not contaminate an unnecessarily large scope
55+
// once we bump the toolchain to 1.91.0.
56+
// See https://github.com/rust-lang/rust-clippy/pull/15445
57+
#[allow(clippy::unwrap_in_result)]
5058
fn from_str(input: &str) -> Result<Self, Self::Err> {
5159
let captures = LEVEL_REGEX.captures(input).context(InvalidFormatSnafu)?;
5260

crates/k8s-version/src/version/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ pub struct Version {
5353
impl FromStr for Version {
5454
type Err = ParseVersionError;
5555

56+
// SAFETY: We purposefully allow the `clippy::unwrap_in_result` lint below in this function.
57+
// We can use expect here, because the correct match label must be used.
58+
//
59+
// FIXME (@Techassi): This attribute can be used on individual unwrap and expect calls since
60+
// Rust 1.91.0. We should move this attribute to not contaminate an unnecessarily large scope
61+
// once we bump the toolchain to 1.91.0.
62+
// See https://github.com/rust-lang/rust-clippy/pull/15445
63+
#[allow(clippy::unwrap_in_result)]
5664
fn from_str(input: &str) -> Result<Self, Self::Err> {
5765
let captures = VERSION_REGEX.captures(input).context(InvalidFormatSnafu)?;
5866

@@ -141,6 +149,7 @@ mod test {
141149
#[case("v1gamma12", ParseVersionError::ParseLevel { source: ParseLevelError::UnknownIdentifier })]
142150
#[case("v1betä1", ParseVersionError::InvalidFormat)]
143151
#[case("1beta1", ParseVersionError::InvalidFormat)]
152+
#[case("v", ParseVersionError::InvalidFormat)]
144153
#[case("", ParseVersionError::InvalidFormat)]
145154
fn invalid_version(#[case] input: &str, #[case] error: ParseVersionError) {
146155
let err = Version::from_str(input).expect_err("invalid Kubernetes version");

crates/stackable-certs/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ tokio.workspace = true
2929
tracing.workspace = true
3030
x509-cert.workspace = true
3131
zeroize.workspace = true
32+
33+
[lints]
34+
workspace = true

crates/stackable-certs/src/ca/mod.rs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl PartialEq for Error {
110110
x509_cert::builder::Error::Signature(_),
111111
x509_cert::builder::Error::Signature(_),
112112
) => panic!(
113-
"it is impossible to compare the opaque Error contained witin signature::error::Error"
113+
"it is impossible to compare the opaque Error contained within signature::error::Error"
114114
),
115115
_ => false,
116116
},
@@ -205,6 +205,16 @@ where
205205
/// validity, this function offers complete control over these parameters.
206206
/// If this level of control is not needed, use [`CertificateAuthority::new`]
207207
/// instead.
208+
//
209+
// SAFETY: We purposefully allow the `clippy::unwrap_in_result` lint below in this function.
210+
// We can use expect here, because the subject name is defined as a constant which must be able
211+
// to be parsed.
212+
//
213+
// FIXME (@Techassi): This attribute can be used on individual unwrap and expect calls since
214+
// Rust 1.91.0. We should move this attribute to not contaminate an unnecessarily large scope
215+
// once we bump the toolchain to 1.91.0.
216+
// See https://github.com/rust-lang/rust-clippy/pull/15445
217+
#[allow(clippy::unwrap_in_result)]
208218
#[instrument(name = "create_certificate_authority_with", skip(signing_key_pair))]
209219
pub fn new_with(signing_key_pair: S, serial_number: u64, validity: Duration) -> Result<Self> {
210220
let serial_number = SerialNumber::from(serial_number);
@@ -214,7 +224,7 @@ where
214224
// created by us should contain the same subject consisting a common set
215225
// of distinguished names (DNs).
216226
let subject = Name::from_str(SDP_ROOT_CA_SUBJECT)
217-
.expect("the SDP_ROOT_CA_SUBJECT must be a valid subject");
227+
.expect("the constant SDP_ROOT_CA_SUBJECT must be a valid subject");
218228

219229
let spki_pem = signing_key_pair
220230
.verifying_key()
@@ -511,7 +521,7 @@ mod tests {
511521

512522
#[tokio::test]
513523
async fn rsa_key_generation() {
514-
let mut ca = CertificateAuthority::new_rsa().unwrap();
524+
let mut ca = CertificateAuthority::new_rsa().expect("must be able to create RSA-based CA");
515525
let cert = ca
516526
.generate_rsa_leaf_certificate("Product", "pod", [TEST_SAN], TEST_CERT_LIFETIME)
517527
.expect(
@@ -523,7 +533,9 @@ mod tests {
523533

524534
#[tokio::test]
525535
async fn ecdsa_key_generation() {
526-
let mut ca = CertificateAuthority::new_ecdsa().unwrap();
536+
let mut ca =
537+
CertificateAuthority::new_ecdsa().expect("must be able to create ECDSA-based CA");
538+
527539
let cert = ca
528540
.generate_ecdsa_leaf_certificate("Product", "pod", [TEST_SAN], TEST_CERT_LIFETIME)
529541
.expect(
@@ -535,11 +547,11 @@ mod tests {
535547

536548
fn assert_cert_attributes(cert: &Certificate) {
537549
let cert = &cert.tbs_certificate;
550+
let expected_subject = Name::from_str("CN=Product Certificate for pod")
551+
.expect("constant subject must be valid");
552+
538553
// Test subject
539-
assert_eq!(
540-
cert.subject,
541-
Name::from_str("CN=Product Certificate for pod").unwrap()
542-
);
554+
assert_eq!(cert.subject, expected_subject);
543555

544556
// Test SAN extension is present
545557
let extensions = cert.extensions.as_ref().expect("cert must have extensions");

crates/stackable-operator-derive/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ syn.workspace = true
2121

2222
[dev-dependencies]
2323
stackable-operator = { path = "../stackable-operator" }
24+
25+
[lints]
26+
workspace = true

crates/stackable-operator/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ All notable changes to this project will be documented in this file.
1414
- BREAKING: `ClusterResources` now requires the objects added to implement `DeepMerge`.
1515
This is very likely a stackable-operator internal change, but technically breaking ([#1118]).
1616
- Add support for the SSH protocol for pulling git content ([#1121]).
17+
- Depend on the patched version of kube-rs available at <https://github.com/stackabletech/kube-rs>,
18+
ensuring the operators automatically benefit from the fixes ([#1124]).
1719

1820
### Removed
1921

2022
- BREAKING: `ClusterResources` no longer derives `Eq` ([#1118]).
2123

2224
[#1118]: https://github.com/stackabletech/operator-rs/pull/1118
2325
[#1121]: https://github.com/stackabletech/operator-rs/pull/1121
26+
[#1124]: https://github.com/stackabletech/operator-rs/pull/1124
2427

2528
## [0.100.3] - 2025-10-31
2629

crates/stackable-operator/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,6 @@ url.workspace = true
5858
indoc.workspace = true
5959
rstest.workspace = true
6060
tempfile.workspace = true
61+
62+
[lints]
63+
workspace = true

0 commit comments

Comments
 (0)