Skip to content

Commit 176ff5b

Browse files
chore: Update templated files (f1f1a9e) (#842)
* chore: Generated commit to update templated files since the last template run up to stackabletech/operator-templating@f1f1a9e Reference-to: stackabletech/operator-templating@f1f1a9e (Bump Rust to 1.85.0) * fix: rustfmt lint * ci: use nightly toolchain for cargo udeps * ci: use nightly toolchain for cargo udeps * Revert "ci: use nightly toolchain for cargo udeps" This reverts commit 0484f1a. * Revert "ci: use nightly toolchain for cargo udeps" This reverts commit ff696e1. --------- Co-authored-by: Nick Larsen <nick.larsen@stackable.tech>
1 parent 0de8277 commit 176ff5b

File tree

18 files changed

+148
-130
lines changed

18 files changed

+148
-130
lines changed

.github/PULL_REQUEST_TEMPLATE/pre-release-rust-deps.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Bump Rust Dependencies for Stackable Release XX.(X)X
1+
# Bump Rust Dependencies for Stackable Release YY.M.X
22

33
<!--
44
Make sure to update the link in 'issues/.github/ISSUE_TEMPLATE/pre-release-operator-rust-deps.md'
@@ -32,7 +32,7 @@ Part of <https://github.com/stackabletech/issues/issues/TRACKING_ISSUE>
3232
3333
```[tasklist]
3434
### Bump Rust Dependencies
35-
- [ ] Bump `stackable-operator` and friends.
36-
- [ ] Bump `product-version`.
37-
- [ ] Bump all other dependencies.
35+
- [ ] Bump `stackable-operator` and friends
36+
- [ ] Bump `product-config`
37+
- [ ] Bump all other dependencies
3838
```

.github/workflows/build.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ env:
2626
CARGO_TERM_COLOR: always
2727
CARGO_INCREMENTAL: '0'
2828
CARGO_PROFILE_DEV_DEBUG: '0'
29-
RUST_TOOLCHAIN_VERSION: "1.84.1"
29+
RUST_TOOLCHAIN_VERSION: "1.85.0"
30+
RUST_NIGHTLY_TOOLCHAIN_VERSION: "nightly-2025-01-15"
3031
PYTHON_VERSION: "3.12"
3132
RUSTFLAGS: "-D warnings"
3233
RUSTDOCFLAGS: "-D warnings"
@@ -136,9 +137,11 @@ jobs:
136137
submodules: recursive
137138
- uses: dtolnay/rust-toolchain@c5a29ddb4d9d194e7c84ec8c3fba61b1c31fee8c
138139
with:
139-
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
140+
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN_VERSION }}
140141
components: rustfmt
141-
- run: cargo fmt --all -- --check
142+
- env:
143+
RUST_TOOLCHAIN_VERSION: ${{ env.RUST_NIGHTLY_TOOLCHAIN_VERSION }}
144+
run: cargo "+$RUST_TOOLCHAIN_VERSION" fmt --all -- --check
142145

143146
run_clippy:
144147
name: Run Clippy

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"rust-analyzer.rustfmt.overrideCommand": [
3+
"rustfmt",
4+
"+nightly-2025-01-15",
5+
"--"
6+
],
7+
}

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# DO NOT EDIT, this file is generated by operator-templating
22
[toolchain]
3-
channel = "1.84.1"
3+
channel = "1.85.0"

rust/operator-binary/src/config/jvm.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use stackable_operator::{
55
};
66

77
use crate::crd::{
8-
KafkaConfig, KafkaConfigFragment, JVM_SECURITY_PROPERTIES_FILE, METRICS_PORT,
8+
JVM_SECURITY_PROPERTIES_FILE, KafkaConfig, KafkaConfigFragment, METRICS_PORT,
99
STACKABLE_CONFIG_DIR,
1010
};
1111

@@ -51,7 +51,9 @@ fn construct_jvm_args(
5151
format!("-Xmx{java_heap}"),
5252
format!("-Xms{java_heap}"),
5353
format!("-Djava.security.properties={STACKABLE_CONFIG_DIR}/{JVM_SECURITY_PROPERTIES_FILE}"),
54-
format!("-javaagent:/stackable/jmx/jmx_prometheus_javaagent.jar={METRICS_PORT}:/stackable/jmx/broker.yaml")
54+
format!(
55+
"-javaagent:/stackable/jmx/jmx_prometheus_javaagent.jar={METRICS_PORT}:/stackable/jmx/broker.yaml"
56+
),
5557
];
5658

5759
let operator_generated = JvmArgumentOverrides::new_with_only_additions(jvm_args);
@@ -99,7 +101,7 @@ fn is_heap_jvm_argument(jvm_argument: &str) -> bool {
99101
#[cfg(test)]
100102
mod tests {
101103
use super::*;
102-
use crate::crd::{v1alpha1, KafkaRole};
104+
use crate::crd::{KafkaRole, v1alpha1};
103105

104106
#[test]
105107
fn test_construct_jvm_arguments_defaults() {

rust/operator-binary/src/crd/affinity.rs

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use stackable_operator::{
2-
commons::affinity::{affinity_between_role_pods, StackableAffinityFragment},
2+
commons::affinity::{StackableAffinityFragment, affinity_between_role_pods},
33
k8s_openapi::api::core::v1::PodAntiAffinity,
44
};
55

6-
use crate::crd::{KafkaRole, APP_NAME};
6+
use crate::crd::{APP_NAME, KafkaRole};
77

88
pub fn get_affinity(cluster_name: &str, role: &KafkaRole) -> StackableAffinityFragment {
99
StackableAffinityFragment {
@@ -60,39 +60,36 @@ mod tests {
6060
.merged_config(&role, &role.rolegroup_ref(&kafka, "default"))
6161
.unwrap();
6262

63-
assert_eq!(
64-
merged_config.affinity,
65-
StackableAffinity {
66-
pod_affinity: None,
67-
pod_anti_affinity: Some(PodAntiAffinity {
68-
preferred_during_scheduling_ignored_during_execution: Some(vec![
69-
WeightedPodAffinityTerm {
70-
pod_affinity_term: PodAffinityTerm {
71-
label_selector: Some(LabelSelector {
72-
match_expressions: None,
73-
match_labels: Some(BTreeMap::from([
74-
("app.kubernetes.io/name".to_string(), "kafka".to_string(),),
75-
(
76-
"app.kubernetes.io/instance".to_string(),
77-
"simple-kafka".to_string(),
78-
),
79-
(
80-
"app.kubernetes.io/component".to_string(),
81-
"broker".to_string(),
82-
)
83-
]))
84-
}),
85-
topology_key: "kubernetes.io/hostname".to_string(),
86-
..PodAffinityTerm::default()
87-
},
88-
weight: 70
89-
}
90-
]),
91-
required_during_scheduling_ignored_during_execution: None,
92-
}),
93-
node_affinity: None,
94-
node_selector: None,
95-
}
96-
);
63+
assert_eq!(merged_config.affinity, StackableAffinity {
64+
pod_affinity: None,
65+
pod_anti_affinity: Some(PodAntiAffinity {
66+
preferred_during_scheduling_ignored_during_execution: Some(vec![
67+
WeightedPodAffinityTerm {
68+
pod_affinity_term: PodAffinityTerm {
69+
label_selector: Some(LabelSelector {
70+
match_expressions: None,
71+
match_labels: Some(BTreeMap::from([
72+
("app.kubernetes.io/name".to_string(), "kafka".to_string(),),
73+
(
74+
"app.kubernetes.io/instance".to_string(),
75+
"simple-kafka".to_string(),
76+
),
77+
(
78+
"app.kubernetes.io/component".to_string(),
79+
"broker".to_string(),
80+
)
81+
]))
82+
}),
83+
topology_key: "kubernetes.io/hostname".to_string(),
84+
..PodAffinityTerm::default()
85+
},
86+
weight: 70
87+
}
88+
]),
89+
required_during_scheduling_ignored_during_execution: None,
90+
}),
91+
node_affinity: None,
92+
node_selector: None,
93+
});
9794
}
9895
}

rust/operator-binary/src/crd/authentication.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ pub enum Error {
1818
authentication_class: ObjectRef<AuthenticationClass>,
1919
},
2020

21-
#[snafu(display("only one authentication class at a time is currently supported. Possible Authentication class providers are {SUPPORTED_AUTHENTICATION_CLASS_PROVIDERS:?}"))]
21+
#[snafu(display(
22+
"only one authentication class at a time is currently supported. Possible Authentication class providers are {SUPPORTED_AUTHENTICATION_CLASS_PROVIDERS:?}"
23+
))]
2224
MultipleAuthenticationClassesProvided,
2325

2426
#[snafu(display(
@@ -122,7 +124,7 @@ impl ResolvedAuthenticationClasses {
122124
return Err(Error::AuthenticationProviderNotSupported {
123125
authentication_class: ObjectRef::from_obj(auth_class),
124126
provider: auth_class.spec.provider.to_string(),
125-
})
127+
});
126128
}
127129
}
128130
}

rust/operator-binary/src/crd/listener.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use snafu::{OptionExt, Snafu};
77
use stackable_operator::{kube::ResourceExt, utils::cluster_info::KubernetesClusterInfo};
88
use strum::{EnumDiscriminants, EnumString};
99

10-
use crate::crd::{security::KafkaTlsSecurity, v1alpha1, STACKABLE_LISTENER_BROKER_DIR};
10+
use crate::crd::{STACKABLE_LISTENER_BROKER_DIR, security::KafkaTlsSecurity, v1alpha1};
1111

1212
const LISTENER_LOCAL_ADDRESS: &str = "0.0.0.0";
1313

@@ -264,9 +264,9 @@ mod tests {
264264
builder::meta::ObjectMetaBuilder,
265265
commons::{
266266
authentication::{
267+
AuthenticationClass, AuthenticationClassProvider, AuthenticationClassSpec,
267268
kerberos,
268269
tls::{self},
269-
AuthenticationClass, AuthenticationClassProvider, AuthenticationClassSpec,
270270
},
271271
networking::DomainName,
272272
},
@@ -512,7 +512,7 @@ mod tests {
512512
internal_port = kafka_security.internal_port(),
513513
bootstrap_name = KafkaListenerName::Bootstrap,
514514
bootstrap_host = LISTENER_LOCAL_ADDRESS,
515-
bootstrap_port = kafka_security.bootstrap_port(),
515+
bootstrap_port = kafka_security.bootstrap_port(),
516516
)
517517
);
518518

@@ -548,7 +548,6 @@ mod tests {
548548
internal_protocol = KafkaListenerProtocol::Ssl,
549549
bootstrap_name = KafkaListenerName::Bootstrap,
550550
bootstrap_protocol = KafkaListenerProtocol::SaslSsl,
551-
552551
)
553552
);
554553
}

rust/operator-binary/src/crd/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use stackable_operator::{
2828
k8s_openapi::{
2929
api::core::v1::PersistentVolumeClaim, apimachinery::pkg::api::resource::Quantity,
3030
},
31-
kube::{runtime::reflector::ObjectRef, CustomResource, ResourceExt},
31+
kube::{CustomResource, ResourceExt, runtime::reflector::ObjectRef},
3232
product_config_utils::Configuration,
3333
product_logging::{self, spec::Logging},
3434
role_utils::{GenericRoleConfig, JavaCommonConfig, Role, RoleGroup, RoleGroupRef},

rust/operator-binary/src/crd/security.rs

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
use std::collections::BTreeMap;
88

99
use indoc::formatdoc;
10-
use snafu::{ensure, ResultExt, Snafu};
10+
use snafu::{ResultExt, Snafu, ensure};
1111
use stackable_operator::{
1212
builder::{
1313
self,
1414
pod::{
15+
PodBuilder,
1516
container::ContainerBuilder,
1617
volume::{SecretFormat, SecretOperatorVolumeSourceBuilder, VolumeBuilder},
17-
PodBuilder,
1818
},
1919
},
2020
client::Client,
@@ -29,11 +29,12 @@ use stackable_operator::{
2929

3030
use super::listener::node_port_cmd;
3131
use crate::crd::{
32+
KafkaRole, LISTENER_BOOTSTRAP_VOLUME_NAME, LISTENER_BROKER_VOLUME_NAME, SERVER_PROPERTIES_FILE,
33+
STACKABLE_CONFIG_DIR, STACKABLE_KERBEROS_KRB5_PATH, STACKABLE_LISTENER_BOOTSTRAP_DIR,
34+
STACKABLE_LISTENER_BROKER_DIR, STACKABLE_LOG_DIR,
3235
authentication::{self, ResolvedAuthenticationClasses},
33-
listener::{self, node_address_cmd, KafkaListenerConfig},
34-
tls, v1alpha1, KafkaRole, LISTENER_BOOTSTRAP_VOLUME_NAME, LISTENER_BROKER_VOLUME_NAME,
35-
SERVER_PROPERTIES_FILE, STACKABLE_CONFIG_DIR, STACKABLE_KERBEROS_KRB5_PATH,
36-
STACKABLE_LISTENER_BOOTSTRAP_DIR, STACKABLE_LISTENER_BROKER_DIR, STACKABLE_LOG_DIR,
36+
listener::{self, KafkaListenerConfig, node_address_cmd},
37+
tls, v1alpha1,
3738
};
3839

3940
#[derive(Snafu, Debug)]
@@ -66,32 +67,12 @@ pub struct KafkaTlsSecurity {
6667
}
6768

6869
impl KafkaTlsSecurity {
69-
// ports
70-
pub const CLIENT_PORT_NAME: &'static str = "kafka";
71-
pub const CLIENT_PORT: u16 = 9092;
72-
pub const SECURE_CLIENT_PORT_NAME: &'static str = "kafka-tls";
73-
pub const SECURE_CLIENT_PORT: u16 = 9093;
70+
pub const BOOTSTRAP_PORT: u16 = 9094;
7471
// bootstrap: we will have a single named port with different values for
7572
// secure (9095) and insecure (9094). The bootstrap listener is needed to
7673
// be able to expose principals for both the broker and bootstrap in the
7774
// JAAS configuration, so that clients can use both.
7875
pub const BOOTSTRAP_PORT_NAME: &'static str = "bootstrap";
79-
pub const BOOTSTRAP_PORT: u16 = 9094;
80-
pub const SECURE_BOOTSTRAP_PORT: u16 = 9095;
81-
// internal
82-
pub const INTERNAL_PORT: u16 = 19092;
83-
pub const SECURE_INTERNAL_PORT: u16 = 19093;
84-
// - TLS global
85-
const SSL_STORE_PASSWORD: &'static str = "";
86-
// - TLS client
87-
const CLIENT_SSL_KEYSTORE_LOCATION: &'static str = "listener.name.client.ssl.keystore.location";
88-
const CLIENT_SSL_KEYSTORE_PASSWORD: &'static str = "listener.name.client.ssl.keystore.password";
89-
const CLIENT_SSL_KEYSTORE_TYPE: &'static str = "listener.name.client.ssl.keystore.type";
90-
const CLIENT_SSL_TRUSTSTORE_LOCATION: &'static str =
91-
"listener.name.client.ssl.truststore.location";
92-
const CLIENT_SSL_TRUSTSTORE_PASSWORD: &'static str =
93-
"listener.name.client.ssl.truststore.password";
94-
const CLIENT_SSL_TRUSTSTORE_TYPE: &'static str = "listener.name.client.ssl.truststore.type";
9576
// - Bootstrapper
9677
const BOOTSTRAP_SSL_KEYSTORE_LOCATION: &'static str =
9778
"listener.name.bootstrap.ssl.keystore.location";
@@ -104,6 +85,7 @@ impl KafkaTlsSecurity {
10485
"listener.name.bootstrap.ssl.truststore.password";
10586
const BOOTSTRAP_SSL_TRUSTSTORE_TYPE: &'static str =
10687
"listener.name.bootstrap.ssl.truststore.type";
88+
const CLIENT_AUTH_SSL_CLIENT_AUTH: &'static str = "listener.name.client_auth.ssl.client.auth";
10789
// - TLS client authentication
10890
const CLIENT_AUTH_SSL_KEYSTORE_LOCATION: &'static str =
10991
"listener.name.client_auth.ssl.keystore.location";
@@ -117,9 +99,23 @@ impl KafkaTlsSecurity {
11799
"listener.name.client_auth.ssl.truststore.password";
118100
const CLIENT_AUTH_SSL_TRUSTSTORE_TYPE: &'static str =
119101
"listener.name.client_auth.ssl.truststore.type";
120-
const CLIENT_AUTH_SSL_CLIENT_AUTH: &'static str = "listener.name.client_auth.ssl.client.auth";
102+
pub const CLIENT_PORT: u16 = 9092;
103+
// ports
104+
pub const CLIENT_PORT_NAME: &'static str = "kafka";
105+
// - TLS client
106+
const CLIENT_SSL_KEYSTORE_LOCATION: &'static str = "listener.name.client.ssl.keystore.location";
107+
const CLIENT_SSL_KEYSTORE_PASSWORD: &'static str = "listener.name.client.ssl.keystore.password";
108+
const CLIENT_SSL_KEYSTORE_TYPE: &'static str = "listener.name.client.ssl.keystore.type";
109+
const CLIENT_SSL_TRUSTSTORE_LOCATION: &'static str =
110+
"listener.name.client.ssl.truststore.location";
111+
const CLIENT_SSL_TRUSTSTORE_PASSWORD: &'static str =
112+
"listener.name.client.ssl.truststore.password";
113+
const CLIENT_SSL_TRUSTSTORE_TYPE: &'static str = "listener.name.client.ssl.truststore.type";
114+
// internal
115+
pub const INTERNAL_PORT: u16 = 19092;
121116
// - TLS internal
122117
const INTER_BROKER_LISTENER_NAME: &'static str = "inter.broker.listener.name";
118+
const INTER_SSL_CLIENT_AUTH: &'static str = "listener.name.internal.ssl.client.auth";
123119
const INTER_SSL_KEYSTORE_LOCATION: &'static str =
124120
"listener.name.internal.ssl.keystore.location";
125121
const INTER_SSL_KEYSTORE_PASSWORD: &'static str =
@@ -130,14 +126,19 @@ impl KafkaTlsSecurity {
130126
const INTER_SSL_TRUSTSTORE_PASSWORD: &'static str =
131127
"listener.name.internal.ssl.truststore.password";
132128
const INTER_SSL_TRUSTSTORE_TYPE: &'static str = "listener.name.internal.ssl.truststore.type";
133-
const INTER_SSL_CLIENT_AUTH: &'static str = "listener.name.internal.ssl.client.auth";
129+
pub const SECURE_BOOTSTRAP_PORT: u16 = 9095;
130+
pub const SECURE_CLIENT_PORT: u16 = 9093;
131+
pub const SECURE_CLIENT_PORT_NAME: &'static str = "kafka-tls";
132+
pub const SECURE_INTERNAL_PORT: u16 = 19093;
133+
// - TLS global
134+
const SSL_STORE_PASSWORD: &'static str = "";
135+
const STACKABLE_TLS_KAFKA_INTERNAL_DIR: &'static str = "/stackable/tls-kafka-internal";
136+
const STACKABLE_TLS_KAFKA_INTERNAL_VOLUME_NAME: &'static str = "tls-kafka-internal";
137+
const STACKABLE_TLS_KAFKA_SERVER_DIR: &'static str = "/stackable/tls-kafka-server";
138+
const STACKABLE_TLS_KAFKA_SERVER_VOLUME_NAME: &'static str = "tls-kafka-server";
134139
// directories
135140
const STACKABLE_TLS_KCAT_DIR: &'static str = "/stackable/tls-kcat";
136141
const STACKABLE_TLS_KCAT_VOLUME_NAME: &'static str = "tls-kcat";
137-
const STACKABLE_TLS_KAFKA_SERVER_DIR: &'static str = "/stackable/tls-kafka-server";
138-
const STACKABLE_TLS_KAFKA_SERVER_VOLUME_NAME: &'static str = "tls-kafka-server";
139-
const STACKABLE_TLS_KAFKA_INTERNAL_DIR: &'static str = "/stackable/tls-kafka-internal";
140-
const STACKABLE_TLS_KAFKA_INTERNAL_VOLUME_NAME: &'static str = "tls-kafka-internal";
141142

142143
#[cfg(test)]
143144
pub fn new(
@@ -685,7 +686,9 @@ impl KafkaTlsSecurity {
685686
"-X".to_string(),
686687
format!("sasl.kerberos.service.name={service_name}"),
687688
"-X".to_string(),
688-
format!("sasl.kerberos.principal={service_name}/$POD_BROKER_LISTENER_ADDRESS@$KERBEROS_REALM"),
689+
format!(
690+
"sasl.kerberos.principal={service_name}/$POD_BROKER_LISTENER_ADDRESS@$KERBEROS_REALM"
691+
),
689692
]
690693
}
691694
}

rust/operator-binary/src/discovery.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ use stackable_operator::{
55
builder::{configmap::ConfigMapBuilder, meta::ObjectMetaBuilder},
66
commons::{listener::Listener, product_image_selection::ResolvedProductImage},
77
k8s_openapi::api::core::v1::{ConfigMap, Service},
8-
kube::{runtime::reflector::ObjectRef, Resource, ResourceExt},
8+
kube::{Resource, ResourceExt, runtime::reflector::ObjectRef},
99
};
1010

1111
use crate::{
12-
crd::{security::KafkaTlsSecurity, v1alpha1, KafkaRole},
12+
crd::{KafkaRole, security::KafkaTlsSecurity, v1alpha1},
1313
kafka_controller::KAFKA_CONTROLLER_NAME,
1414
utils::build_recommended_labels,
1515
};

0 commit comments

Comments
 (0)