Skip to content

Commit 7cf4772

Browse files
committed
chore: Bump stackable_operator to 0.93.1
Part of stackabletech/issues#642. Bump stackable-operator to 0.93.1 which versions common CRD structs.
1 parent 8114bb8 commit 7cf4772

File tree

10 files changed

+461
-502
lines changed

10 files changed

+461
-502
lines changed

Cargo.lock

Lines changed: 95 additions & 106 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.nix

Lines changed: 280 additions & 320 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ repository = "https://github.com/stackabletech/kafka-operator"
1111

1212
[workspace.dependencies]
1313
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" }
14-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", features = ["telemetry", "versioned"], tag = "stackable-operator-0.92.0" }
14+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", features = ["telemetry", "versioned"], tag = "stackable-operator-0.93.1" }
1515

1616
anyhow = "1.0"
17-
built = { version = "0.7", features = ["chrono", "git2"] }
17+
built = { version = "0.8", features = ["chrono", "git2"] }
1818
clap = "4.5"
1919
const_format = "0.2"
2020
futures = "0.3"

crate-hashes.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
22
use snafu::{ResultExt, Snafu};
33
use stackable_operator::{
44
client::Client,
5-
commons::authentication::{AuthenticationClass, AuthenticationClassProvider},
5+
crd::authentication::core,
66
schemars::{self, JsonSchema},
77
};
88

@@ -15,7 +15,7 @@ pub enum Error {
1515
#[snafu(display("failed to retrieve AuthenticationClass [{}]", authentication_class))]
1616
AuthenticationClassRetrieval {
1717
source: stackable_operator::client::Error,
18-
authentication_class: ObjectRef<AuthenticationClass>,
18+
authentication_class: ObjectRef<core::v1alpha1::AuthenticationClass>,
1919
},
2020

2121
#[snafu(display(
@@ -27,7 +27,7 @@ pub enum Error {
2727
"failed to use authentication provider [{provider}] for authentication class [{authentication_class}] - supported providers: {SUPPORTED_AUTHENTICATION_CLASS_PROVIDERS:?}",
2828
))]
2929
AuthenticationProviderNotSupported {
30-
authentication_class: ObjectRef<AuthenticationClass>,
30+
authentication_class: ObjectRef<core::v1alpha1::AuthenticationClass>,
3131
provider: String,
3232
},
3333
}
@@ -56,11 +56,11 @@ pub struct KafkaAuthentication {
5656
#[derive(Clone, Debug)]
5757
/// Helper struct that contains resolved AuthenticationClasses to reduce network API calls.
5858
pub struct ResolvedAuthenticationClasses {
59-
resolved_authentication_classes: Vec<AuthenticationClass>,
59+
resolved_authentication_classes: Vec<core::v1alpha1::AuthenticationClass>,
6060
}
6161

6262
impl ResolvedAuthenticationClasses {
63-
pub fn new(resolved_authentication_classes: Vec<AuthenticationClass>) -> Self {
63+
pub fn new(resolved_authentication_classes: Vec<core::v1alpha1::AuthenticationClass>) -> Self {
6464
Self {
6565
resolved_authentication_classes,
6666
}
@@ -74,35 +74,46 @@ impl ResolvedAuthenticationClasses {
7474
client: &Client,
7575
auth_classes: &Vec<KafkaAuthentication>,
7676
) -> Result<ResolvedAuthenticationClasses, Error> {
77-
let mut resolved_authentication_classes: Vec<AuthenticationClass> = vec![];
77+
let mut resolved_authentication_classes: Vec<core::v1alpha1::AuthenticationClass> = vec![];
7878

7979
for auth_class in auth_classes {
8080
resolved_authentication_classes.push(
81-
AuthenticationClass::resolve(client, &auth_class.authentication_class)
82-
.await
83-
.context(AuthenticationClassRetrievalSnafu {
84-
authentication_class: ObjectRef::<AuthenticationClass>::new(
85-
&auth_class.authentication_class,
86-
),
87-
})?,
81+
core::v1alpha1::AuthenticationClass::resolve(
82+
client,
83+
&auth_class.authentication_class,
84+
)
85+
.await
86+
.context(AuthenticationClassRetrievalSnafu {
87+
authentication_class: ObjectRef::<core::v1alpha1::AuthenticationClass>::new(
88+
&auth_class.authentication_class,
89+
),
90+
})?,
8891
);
8992
}
9093

9194
ResolvedAuthenticationClasses::new(resolved_authentication_classes).validate()
9295
}
9396

9497
/// Return the (first) TLS `AuthenticationClass` if available
95-
pub fn get_tls_authentication_class(&self) -> Option<&AuthenticationClass> {
96-
self.resolved_authentication_classes
97-
.iter()
98-
.find(|auth| matches!(auth.spec.provider, AuthenticationClassProvider::Tls(_)))
98+
pub fn get_tls_authentication_class(&self) -> Option<&core::v1alpha1::AuthenticationClass> {
99+
self.resolved_authentication_classes.iter().find(|auth| {
100+
matches!(
101+
auth.spec.provider,
102+
core::v1alpha1::AuthenticationClassProvider::Tls(_)
103+
)
104+
})
99105
}
100106

101107
/// Return the (first) Kerberos `AuthenticationClass` if available
102-
pub fn get_kerberos_authentication_class(&self) -> Option<&AuthenticationClass> {
103-
self.resolved_authentication_classes
104-
.iter()
105-
.find(|auth| matches!(auth.spec.provider, AuthenticationClassProvider::Kerberos(_)))
108+
pub fn get_kerberos_authentication_class(
109+
&self,
110+
) -> Option<&core::v1alpha1::AuthenticationClass> {
111+
self.resolved_authentication_classes.iter().find(|auth| {
112+
matches!(
113+
auth.spec.provider,
114+
core::v1alpha1::AuthenticationClassProvider::Kerberos(_)
115+
)
116+
})
106117
}
107118

108119
/// Validates the resolved AuthenticationClasses.
@@ -117,10 +128,11 @@ impl ResolvedAuthenticationClasses {
117128
for auth_class in &self.resolved_authentication_classes {
118129
match &auth_class.spec.provider {
119130
// explicitly list each branch so new elements do not get overlooked
120-
AuthenticationClassProvider::Tls(_) | AuthenticationClassProvider::Kerberos(_) => {}
121-
AuthenticationClassProvider::Static(_)
122-
| AuthenticationClassProvider::Ldap(_)
123-
| AuthenticationClassProvider::Oidc(_) => {
131+
core::v1alpha1::AuthenticationClassProvider::Tls(_)
132+
| core::v1alpha1::AuthenticationClassProvider::Kerberos(_) => {}
133+
core::v1alpha1::AuthenticationClassProvider::Static(_)
134+
| core::v1alpha1::AuthenticationClassProvider::Ldap(_)
135+
| core::v1alpha1::AuthenticationClassProvider::Oidc(_) => {
124136
return Err(Error::AuthenticationProviderNotSupported {
125137
authentication_class: ObjectRef::from_obj(auth_class),
126138
provider: auth_class.spec.provider.to_string(),

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

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,8 @@ pub fn pod_fqdn(
262262
mod tests {
263263
use stackable_operator::{
264264
builder::meta::ObjectMetaBuilder,
265-
commons::{
266-
authentication::{
267-
AuthenticationClass, AuthenticationClassProvider, AuthenticationClassSpec,
268-
kerberos,
269-
tls::{self},
270-
},
271-
networking::DomainName,
272-
},
265+
commons::networking::DomainName,
266+
crd::authentication::{core, kerberos, tls},
273267
};
274268

275269
use super::*;
@@ -306,12 +300,14 @@ mod tests {
306300
let kafka: v1alpha1::KafkaCluster =
307301
serde_yaml::from_str(kafka_cluster).expect("illegal test input");
308302
let kafka_security = KafkaTlsSecurity::new(
309-
ResolvedAuthenticationClasses::new(vec![AuthenticationClass {
303+
ResolvedAuthenticationClasses::new(vec![core::v1alpha1::AuthenticationClass {
310304
metadata: ObjectMetaBuilder::new().name("auth-class").build(),
311-
spec: AuthenticationClassSpec {
312-
provider: AuthenticationClassProvider::Tls(tls::AuthenticationProvider {
313-
client_cert_secret_class: Some("client-auth-secret-class".to_string()),
314-
}),
305+
spec: core::v1alpha1::AuthenticationClassSpec {
306+
provider: core::v1alpha1::AuthenticationClassProvider::Tls(
307+
tls::v1alpha1::AuthenticationProvider {
308+
client_cert_secret_class: Some("client-auth-secret-class".to_string()),
309+
},
310+
),
315311
},
316312
}]),
317313
"internalTls".to_string(),
@@ -483,11 +479,11 @@ mod tests {
483479
let kafka: v1alpha1::KafkaCluster =
484480
serde_yaml::from_str(kafka_cluster).expect("illegal test input");
485481
let kafka_security = KafkaTlsSecurity::new(
486-
ResolvedAuthenticationClasses::new(vec![AuthenticationClass {
482+
ResolvedAuthenticationClasses::new(vec![core::v1alpha1::AuthenticationClass {
487483
metadata: ObjectMetaBuilder::new().name("auth-class").build(),
488-
spec: AuthenticationClassSpec {
489-
provider: AuthenticationClassProvider::Kerberos(
490-
kerberos::AuthenticationProvider {
484+
spec: core::v1alpha1::AuthenticationClassSpec {
485+
provider: core::v1alpha1::AuthenticationClassProvider::Kerberos(
486+
kerberos::v1alpha1::AuthenticationProvider {
491487
kerberos_secret_class: "kerberos-secret-class".to_string(),
492488
},
493489
),

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use stackable_operator::{
1818
},
1919
},
2020
client::Client,
21-
commons::authentication::{AuthenticationClass, AuthenticationClassProvider},
21+
crd::authentication::core,
2222
k8s_openapi::api::core::v1::Volume,
2323
product_logging::framework::{
2424
create_vector_shutdown_file_command, remove_vector_shutdown_file_command,
@@ -199,7 +199,7 @@ impl KafkaTlsSecurity {
199199
}
200200

201201
/// Retrieve an optional TLS `AuthenticationClass`.
202-
pub fn tls_client_authentication_class(&self) -> Option<&AuthenticationClass> {
202+
pub fn tls_client_authentication_class(&self) -> Option<&core::v1alpha1::AuthenticationClass> {
203203
self.resolved_authentication_classes
204204
.get_tls_authentication_class()
205205
}
@@ -223,7 +223,7 @@ impl KafkaTlsSecurity {
223223
.get_kerberos_authentication_class()
224224
{
225225
match &kerberos.spec.provider {
226-
AuthenticationClassProvider::Kerberos(kerberos) => {
226+
core::v1alpha1::AuthenticationClassProvider::Kerberos(kerberos) => {
227227
Some(kerberos.kerberos_secret_class.clone())
228228
}
229229
_ => None,
@@ -607,7 +607,9 @@ impl KafkaTlsSecurity {
607607
self.resolved_authentication_classes
608608
.get_tls_authentication_class()
609609
.and_then(|auth_class| match &auth_class.spec.provider {
610-
AuthenticationClassProvider::Tls(tls) => tls.client_cert_secret_class.as_ref(),
610+
core::v1alpha1::AuthenticationClassProvider::Tls(tls) => {
611+
tls.client_cert_secret_class.as_ref()
612+
}
611613
_ => None,
612614
})
613615
.or(self.server_secret_class.as_ref())

rust/operator-binary/src/discovery.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use std::num::TryFromIntError;
33
use snafu::{OptionExt, ResultExt, Snafu};
44
use stackable_operator::{
55
builder::{configmap::ConfigMapBuilder, meta::ObjectMetaBuilder},
6-
commons::{listener::Listener, product_image_selection::ResolvedProductImage},
6+
commons::product_image_selection::ResolvedProductImage,
7+
crd::listener,
78
k8s_openapi::api::core::v1::{ConfigMap, Service},
89
kube::{Resource, ResourceExt, runtime::reflector::ObjectRef},
910
};
@@ -61,7 +62,7 @@ pub async fn build_discovery_configmaps(
6162
owner: &impl Resource<DynamicType = ()>,
6263
resolved_product_image: &ResolvedProductImage,
6364
kafka_security: &KafkaTlsSecurity,
64-
listeners: &[Listener],
65+
listeners: &[listener::v1alpha1::Listener],
6566
) -> Result<Vec<ConfigMap>, Error> {
6667
let name = owner.name_unchecked();
6768
let port_name = if kafka_security.has_kerberos_enabled() {
@@ -145,7 +146,7 @@ fn build_discovery_configmap(
145146
}
146147

147148
fn listener_hosts(
148-
listeners: &[Listener],
149+
listeners: &[listener::v1alpha1::Listener],
149150
port_name: &str,
150151
) -> Result<impl IntoIterator<Item = (String, u16)>, Error> {
151152
listeners

rust/operator-binary/src/kafka_controller.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ use stackable_operator::{
2828
},
2929
cluster_resources::{ClusterResourceApplyStrategy, ClusterResources},
3030
commons::{
31-
authentication::AuthenticationClass,
32-
listener::{Listener, ListenerPort, ListenerSpec},
33-
opa::OpaApiVersion,
34-
product_image_selection::ResolvedProductImage,
31+
opa::OpaApiVersion, product_image_selection::ResolvedProductImage,
3532
rbac::build_rbac_resources,
3633
},
34+
crd::{authentication::core, listener},
3735
k8s_openapi::{
3836
DeepMerge,
3937
api::{
@@ -204,7 +202,7 @@ pub enum Error {
204202
#[snafu(display("failed to retrieve {}", authentication_class))]
205203
AuthenticationClassRetrieval {
206204
source: stackable_operator::commons::opa::Error,
207-
authentication_class: ObjectRef<AuthenticationClass>,
205+
authentication_class: ObjectRef<core::v1alpha1::AuthenticationClass>,
208206
},
209207

210208
#[snafu(display(
@@ -213,7 +211,7 @@ pub enum Error {
213211
supported
214212
))]
215213
AuthenticationProviderNotSupported {
216-
authentication_class: ObjectRef<AuthenticationClass>,
214+
authentication_class: ObjectRef<core::v1alpha1::AuthenticationClass>,
217215
supported: Vec<String>,
218216
provider: String,
219217
},
@@ -523,7 +521,7 @@ pub async fn reconcile_kafka(
523521
.await
524522
.context(ApplyRoleBindingSnafu)?;
525523

526-
let mut bootstrap_listeners = Vec::<Listener>::new();
524+
let mut bootstrap_listeners = Vec::<listener::v1alpha1::Listener>::new();
527525

528526
for (rolegroup_name, rolegroup_config) in role_broker_config.iter() {
529527
let rolegroup_ref = kafka.broker_rolegroup_ref(rolegroup_name);
@@ -639,14 +637,15 @@ pub async fn reconcile_kafka(
639637

640638
/// Kafka clients will use the load-balanced bootstrap listener to get a list of broker addresses and will use those to
641639
/// transmit data to the correct broker.
640+
// TODO (@NickLarsenNZ): Move shared functionality to stackable-operator
642641
pub fn build_broker_rolegroup_bootstrap_listener(
643642
kafka: &v1alpha1::KafkaCluster,
644643
resolved_product_image: &ResolvedProductImage,
645644
kafka_security: &KafkaTlsSecurity,
646645
rolegroup: &RoleGroupRef<v1alpha1::KafkaCluster>,
647646
merged_config: &KafkaConfig,
648-
) -> Result<Listener> {
649-
Ok(Listener {
647+
) -> Result<listener::v1alpha1::Listener> {
648+
Ok(listener::v1alpha1::Listener {
650649
metadata: ObjectMetaBuilder::new()
651650
.name_and_namespace(kafka)
652651
.name(kafka.bootstrap_service_name(rolegroup))
@@ -661,10 +660,10 @@ pub fn build_broker_rolegroup_bootstrap_listener(
661660
))
662661
.context(MetadataBuildSnafu)?
663662
.build(),
664-
spec: ListenerSpec {
663+
spec: listener::v1alpha1::ListenerSpec {
665664
class_name: Some(merged_config.bootstrap_listener_class.clone()),
666665
ports: Some(listener_ports(kafka_security)),
667-
..ListenerSpec::default()
666+
..listener::v1alpha1::ListenerSpec::default()
668667
},
669668
status: None,
670669
})
@@ -1166,7 +1165,7 @@ fn build_broker_rolegroup_statefulset(
11661165
),
11671166
..LabelSelector::default()
11681167
},
1169-
service_name: rolegroup_ref.object_name(),
1168+
service_name: Some(rolegroup_ref.object_name()),
11701169
template: pod_template,
11711170
volume_claim_templates: Some(pvcs),
11721171
..StatefulSetSpec::default()
@@ -1187,21 +1186,21 @@ pub fn error_policy(
11871186
}
11881187

11891188
/// We only expose client HTTP / HTTPS and Metrics ports.
1190-
fn listener_ports(kafka_security: &KafkaTlsSecurity) -> Vec<ListenerPort> {
1189+
fn listener_ports(kafka_security: &KafkaTlsSecurity) -> Vec<listener::v1alpha1::ListenerPort> {
11911190
let mut ports = vec![
1192-
ListenerPort {
1191+
listener::v1alpha1::ListenerPort {
11931192
name: METRICS_PORT_NAME.to_string(),
11941193
port: METRICS_PORT.into(),
11951194
protocol: Some("TCP".to_string()),
11961195
},
1197-
ListenerPort {
1196+
listener::v1alpha1::ListenerPort {
11981197
name: kafka_security.client_port_name().to_string(),
11991198
port: kafka_security.client_port().into(),
12001199
protocol: Some("TCP".to_string()),
12011200
},
12021201
];
12031202
if kafka_security.has_kerberos_enabled() {
1204-
ports.push(ListenerPort {
1203+
ports.push(listener::v1alpha1::ListenerPort {
12051204
name: kafka_security.bootstrap_port_name().to_string(),
12061205
port: kafka_security.bootstrap_port().into(),
12071206
protocol: Some("TCP".to_string()),

rust/operator-binary/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use stackable_operator::{
77
YamlSchema,
88
cli::{Command, ProductOperatorRun},
99
client::{self, Client},
10-
commons::listener::Listener,
10+
crd::listener,
1111
k8s_openapi::api::{
1212
apps::v1::StatefulSet,
1313
core::v1::{ConfigMap, Service, ServiceAccount},
@@ -138,7 +138,7 @@ pub async fn create_controller(
138138
watcher::Config::default(),
139139
)
140140
.owns(
141-
namespace.get_api::<Listener>(&client),
141+
namespace.get_api::<listener::v1alpha1::Listener>(&client),
142142
watcher::Config::default(),
143143
)
144144
.owns(

0 commit comments

Comments
 (0)