Skip to content

Commit a5cc9fb

Browse files
committed
bump stackable-versioned, refactor imports and version references
1 parent d381155 commit a5cc9fb

File tree

15 files changed

+215
-1205
lines changed

15 files changed

+215
-1205
lines changed

Cargo.lock

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

Cargo.nix

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ serde_json = "1.0"
2424
serde_yaml = "0.9"
2525
snafu = "0.8"
2626
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.85.0" }
27-
stackable-versioned = { git = "https://github.com/stackabletech/operator-rs.git", features = ["k8s"], tag = "stackable-versioned-0.5.0" }
27+
stackable-versioned = { git = "https://github.com/stackabletech/operator-rs.git", features = ["k8s"], tag = "stackable-versioned-0.5.1" }
2828
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" }
2929
strum = { version = "0.26", features = ["derive"] }
3030
tokio = { version = "1.40", features = ["full"] }

crate-hashes.json

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

deploy/helm/zookeeper-operator/crds/crds.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ spec:
789789
kind: ZookeeperZnode
790790
plural: zookeeperznodes
791791
shortNames:
792+
- zno
792793
- znode
793794
singular: zookeeperznode
794795
scope: Namespaced

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ mod tests {
3737
role_utils::RoleGroupRef,
3838
};
3939

40-
use crate::crd::{affinity::ZookeeperRole, v1alpha1::ZookeeperCluster};
40+
use crate::crd::{affinity::ZookeeperRole, v1alpha1};
4141

4242
#[test]
4343
fn test_affinity_defaults() {
@@ -60,7 +60,8 @@ mod tests {
6060
default:
6161
replicas: 3
6262
"#;
63-
let zk: ZookeeperCluster = serde_yaml::from_str(input).expect("illegal test input");
63+
let zk: v1alpha1::ZookeeperCluster =
64+
serde_yaml::from_str(input).expect("illegal test input");
6465

6566
let rolegroup_ref = RoleGroupRef {
6667
cluster: ObjectRef::from_obj(&zk),

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ use stackable_operator::{
3636
use stackable_versioned::versioned;
3737
use strum::{Display, EnumIter, EnumString, IntoEnumIterator};
3838

39-
use crate::crd::{
40-
affinity::get_affinity, authentication::v1alpha1::ZookeeperAuthentication,
41-
tls::v1alpha1::ZookeeperTls,
42-
};
39+
use crate::crd::affinity::get_affinity;
4340

4441
pub mod affinity;
4542
pub mod authentication;
@@ -161,7 +158,7 @@ pub mod versioned {
161158
/// Authentication settings for ZooKeeper like mTLS authentication.
162159
/// Read more in the [authentication usage guide](DOCS_BASE_URL_PLACEHOLDER/zookeeper/usage_guide/authentication).
163160
#[serde(default)]
164-
pub authentication: Vec<ZookeeperAuthentication>,
161+
pub authentication: Vec<authentication::v1alpha1::ZookeeperAuthentication>,
165162

166163
/// Name of the Vector aggregator [discovery ConfigMap](DOCS_BASE_URL_PLACEHOLDER/concepts/service_discovery).
167164
/// It must contain the key `ADDRESS` with the address of the Vector aggregator.
@@ -176,7 +173,7 @@ pub mod versioned {
176173
default = "tls::default_zookeeper_tls",
177174
skip_serializing_if = "Option::is_none"
178175
)]
179-
pub tls: Option<ZookeeperTls>,
176+
pub tls: Option<tls::v1alpha1::ZookeeperTls>,
180177

181178
/// This field controls which type of Service the Operator creates for this ZookeeperCluster:
182179
///
@@ -306,9 +303,7 @@ pub mod versioned {
306303
group = "zookeeper.stackable.tech",
307304
kind = "ZookeeperZnode",
308305
plural = "zookeeperznodes",
309-
// TODO: stackable-versioned currently only supports a single shortname.
310-
// Leaving this one commented for now.
311-
// shortname = "zno",
306+
shortname = "zno",
312307
shortname = "znode",
313308
status = "ZookeeperZnodeStatus",
314309
namespaced,

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ use stackable_operator::{
2525
time::Duration,
2626
};
2727

28-
use crate::crd::{
29-
authentication, authentication::ResolvedAuthenticationClasses, tls, v1alpha1::ZookeeperCluster,
30-
};
28+
use crate::crd::{authentication, authentication::ResolvedAuthenticationClasses, tls, v1alpha1};
3129

3230
type Result<T, E = Error> = std::result::Result<T, E>;
3331

@@ -95,7 +93,7 @@ impl ZookeeperSecurity {
9593
/// all provided `AuthenticationClass` references.
9694
pub async fn new_from_zookeeper_cluster(
9795
client: &Client,
98-
zk: &ZookeeperCluster,
96+
zk: &v1alpha1::ZookeeperCluster,
9997
) -> Result<Self, Error> {
10098
Ok(ZookeeperSecurity {
10199
resolved_authentication_classes: authentication::resolve_authentication_classes(

rust/operator-binary/src/discovery.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use stackable_operator::{
1010
};
1111

1212
use crate::{
13-
crd::{security::ZookeeperSecurity, v1alpha1::ZookeeperCluster, ZookeeperRole},
13+
crd::{security::ZookeeperSecurity, v1alpha1, ZookeeperRole},
1414
utils::build_recommended_labels,
1515
};
1616

@@ -21,7 +21,7 @@ pub enum Error {
2121
#[snafu(display("object {} is missing metadata to build owner reference", zk))]
2222
ObjectMissingMetadataForOwnerRef {
2323
source: stackable_operator::builder::meta::Error,
24-
zk: ObjectRef<ZookeeperCluster>,
24+
zk: ObjectRef<v1alpha1::ZookeeperCluster>,
2525
},
2626

2727
#[snafu(display("chroot path {} was relative (must be absolute)", chroot))]
@@ -65,7 +65,7 @@ pub enum Error {
6565
/// Builds discovery [`ConfigMap`]s for connecting to a [`crate::crd::v1alpha1::ZookeeperCluster`] for all expected scenarios
6666
#[allow(clippy::too_many_arguments)]
6767
pub async fn build_discovery_configmaps(
68-
zk: &ZookeeperCluster,
68+
zk: &v1alpha1::ZookeeperCluster,
6969
owner: &impl Resource<DynamicType = ()>,
7070
client: &stackable_operator::client::Client,
7171
controller_name: &str,
@@ -112,7 +112,7 @@ pub async fn build_discovery_configmaps(
112112
/// `hosts` will usually come from either [`pod_hosts`] or [`nodeport_hosts`].
113113
#[allow(clippy::too_many_arguments)]
114114
fn build_discovery_configmap(
115-
zk: &ZookeeperCluster,
115+
zk: &v1alpha1::ZookeeperCluster,
116116
owner: &impl Resource<DynamicType = ()>,
117117
zookeeper_security: &ZookeeperSecurity,
118118
name: &str,
@@ -170,7 +170,7 @@ fn build_discovery_configmap(
170170

171171
/// Lists all Pods FQDNs expected to host the [`crate::crd::v1alpha1::ZookeeperCluster`]
172172
fn pod_hosts<'a>(
173-
zk: &'a ZookeeperCluster,
173+
zk: &'a v1alpha1::ZookeeperCluster,
174174
zookeeper_security: &'a ZookeeperSecurity,
175175
cluster_info: &'a KubernetesClusterInfo,
176176
) -> Result<impl IntoIterator<Item = (String, u16)> + 'a> {

rust/operator-binary/src/main.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
use std::sync::Arc;
22

33
use clap::{crate_description, crate_version, Parser};
4-
use crd::{
5-
v1alpha1::{ZookeeperCluster, ZookeeperZnode},
6-
APP_NAME, OPERATOR_NAME,
7-
};
4+
use crd::{v1alpha1, APP_NAME, OPERATOR_NAME};
85
use futures::{pin_mut, StreamExt};
96
use stackable_operator::{
107
cli::{Command, ProductOperatorRun},
@@ -54,8 +51,8 @@ async fn main() -> anyhow::Result<()> {
5451
let opts = Opts::parse();
5552
match opts.cmd {
5653
Command::Crd => {
57-
ZookeeperCluster::print_yaml_schema(built_info::CARGO_PKG_VERSION)?;
58-
ZookeeperZnode::print_yaml_schema(built_info::CARGO_PKG_VERSION)?;
54+
v1alpha1::ZookeeperCluster::print_yaml_schema(built_info::CARGO_PKG_VERSION)?;
55+
v1alpha1::ZookeeperZnode::print_yaml_schema(built_info::CARGO_PKG_VERSION)?;
5956
}
6057
Command::Run(ProductOperatorRun {
6158
product_config,
@@ -87,7 +84,7 @@ async fn main() -> anyhow::Result<()> {
8784
.await?;
8885

8986
let zk_controller = Controller::new(
90-
watch_namespace.get_api::<DeserializeGuard<ZookeeperCluster>>(&client),
87+
watch_namespace.get_api::<DeserializeGuard<v1alpha1::ZookeeperCluster>>(&client),
9188
watcher::Config::default(),
9289
);
9390

@@ -158,7 +155,7 @@ async fn main() -> anyhow::Result<()> {
158155
);
159156

160157
let znode_controller = Controller::new(
161-
watch_namespace.get_api::<DeserializeGuard<ZookeeperZnode>>(&client),
158+
watch_namespace.get_api::<DeserializeGuard<v1alpha1::ZookeeperZnode>>(&client),
162159
watcher::Config::default(),
163160
);
164161
let znode_event_recorder = Arc::new(Recorder::new(
@@ -176,7 +173,8 @@ async fn main() -> anyhow::Result<()> {
176173
watcher::Config::default(),
177174
)
178175
.watches(
179-
watch_namespace.get_api::<DeserializeGuard<ZookeeperCluster>>(&client),
176+
watch_namespace
177+
.get_api::<DeserializeGuard<v1alpha1::ZookeeperCluster>>(&client),
180178
watcher::Config::default(),
181179
move |zk| {
182180
znode_store

0 commit comments

Comments
 (0)