Skip to content

Commit c7273b5

Browse files
xeniapeTechassi
andauthored
chore: Version CRD (#597)
* chore: migrate crd crate to operator-binary module * chore: add stackable-versioned dependency * chore: separate impls from crd data structures * chore: version the crd * bump stackable-versioned, refactor version imports and references * adjust version references, remove redundant code * Merge branch 'main' into chore/add-crd-versioning * fix merge shenanigans * make regenerate-nix * small refactorings * add versions to status fields * bump stackable-operator and stackable-versioned * Update rust/operator-binary/src/crd/druidconnection.rs Co-authored-by: Techassi <[email protected]> * add space --------- Co-authored-by: Techassi <[email protected]>
1 parent d13f4e6 commit c7273b5

24 files changed

+1356
-1012
lines changed

Cargo.lock

+223-153
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.nix

+556-290
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace]
2-
members = ["rust/crd", "rust/operator-binary"]
2+
members = ["rust/operator-binary"]
33
resolver = "2"
44

55
[workspace.package]
@@ -23,11 +23,12 @@ serde = { version = "1.0", features = ["derive"] }
2323
serde_json = "1.0"
2424
serde_yaml = "0.9"
2525
snafu = "0.8"
26-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.87.0" }
26+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.87.4" }
27+
stackable-versioned = { git = "https://github.com/stackabletech/operator-rs.git", features = ["k8s"], tag = "stackable-versioned-0.7.0" }
2728
strum = { version = "0.27", features = ["derive"] }
2829
tokio = { version = "1.40", features = ["full"] }
2930
tracing = "0.1"
3031

31-
# [patch."https://github.com/stackabletech/operator-rs.git"]
32+
# [patch."https://github.com/stackabletech/operator-rs"]
3233
# stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "main" }
3334
# stackable-operator = { path = "../operator-rs/crates/stackable-operator" }

crate-hashes.json

+6-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/crd/Cargo.toml

-23
This file was deleted.

rust/crd/src/druidconnection.rs

-137
This file was deleted.

rust/operator-binary/Cargo.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,27 @@ repository.workspace = true
99
publish = false
1010

1111
[dependencies]
12-
stackable-superset-crd = { path = "../crd" }
13-
1412
anyhow.workspace = true
1513
clap.workspace = true
1614
const_format.workspace = true
1715
fnv.workspace = true
1816
futures.workspace = true
1917
indoc.workspace = true
2018
serde.workspace = true
19+
serde_json.workspace = true
2120
snafu.workspace = true
2221
stackable-operator.workspace = true
22+
stackable-versioned.workspace = true
2323
product-config.workspace = true
2424
strum.workspace = true
2525
tokio.workspace = true
2626
tracing.workspace = true
2727

2828
[dev-dependencies]
29+
indoc.workspace = true
2930
rstest.workspace = true
31+
serde_yaml.workspace = true
32+
tokio.workspace = true
3033

3134
[build-dependencies]
3235
built.workspace = true

rust/operator-binary/src/authorization/opa.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use std::collections::BTreeMap;
22

33
use stackable_operator::{client::Client, commons::opa::OpaApiVersion, time::Duration};
4-
use stackable_superset_crd::{SupersetCluster, SupersetOpaRoleMappingConfig};
4+
5+
use crate::crd::v1alpha1;
56

67
pub const OPA_IMPORTS: &[&str] =
78
&["from opa_authorizer.opa_manager import OpaSupersetSecurityManager"];
@@ -15,8 +16,8 @@ pub struct SupersetOpaConfigResolved {
1516
impl SupersetOpaConfigResolved {
1617
pub async fn from_opa_config(
1718
client: &Client,
18-
superset: &SupersetCluster,
19-
opa_config: &SupersetOpaRoleMappingConfig,
19+
superset: &v1alpha1::SupersetCluster,
20+
opa_config: &v1alpha1::SupersetOpaRoleMappingConfig,
2021
) -> Result<Self, stackable_operator::commons::opa::Error> {
2122
let opa_endpoint = opa_config
2223
.opa

rust/operator-binary/src/config.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ use std::collections::BTreeMap;
33
use indoc::formatdoc;
44
use snafu::{ResultExt, Snafu};
55
use stackable_operator::commons::authentication::{ldap, oidc};
6-
use stackable_superset_crd::{
6+
7+
use crate::crd::{
78
authentication::{
8-
FlaskRolesSyncMoment, SupersetAuthenticationClassResolved,
9-
SupersetClientAuthenticationDetailsResolved, DEFAULT_OIDC_PROVIDER,
9+
self, SupersetAuthenticationClassResolved, SupersetClientAuthenticationDetailsResolved,
10+
DEFAULT_OIDC_PROVIDER,
1011
},
1112
SupersetConfigOptions,
1213
};
@@ -120,7 +121,8 @@ fn append_authentication_config(
120121
);
121122
config.insert(
122123
SupersetConfigOptions::AuthRolesSyncAtLogin.to_string(),
123-
(auth_config.sync_roles_at == FlaskRolesSyncMoment::Login).to_string(),
124+
(auth_config.sync_roles_at == authentication::v1alpha1::FlaskRolesSyncMoment::Login)
125+
.to_string(),
124126
);
125127

126128
Ok(())

rust/operator-binary/src/controller_commons.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use stackable_operator::{
99
},
1010
},
1111
};
12-
use stackable_superset_crd::MAX_LOG_FILES_SIZE;
12+
13+
use crate::crd::MAX_LOG_FILES_SIZE;
1314

1415
pub const CONFIG_VOLUME_NAME: &str = "config";
1516
pub const LOG_CONFIG_VOLUME_NAME: &str = "log-config";

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use stackable_operator::{
33
k8s_openapi::api::core::v1::PodAntiAffinity,
44
};
55

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

88
pub fn get_affinity(cluster_name: &str, role: &SupersetRole) -> StackableAffinityFragment {
99
StackableAffinityFragment {
@@ -32,7 +32,7 @@ mod tests {
3232
};
3333

3434
use super::*;
35-
use crate::SupersetCluster;
35+
use crate::crd::v1alpha1;
3636

3737
#[test]
3838
fn test_affinity_defaults() {
@@ -51,7 +51,8 @@ mod tests {
5151
default:
5252
replicas: 1
5353
"#;
54-
let superset: SupersetCluster = serde_yaml::from_str(input).expect("illegal test input");
54+
let superset: v1alpha1::SupersetCluster =
55+
serde_yaml::from_str(input).expect("illegal test input");
5556
let merged_config = superset
5657
.merged_config(&SupersetRole::Node, &superset.node_rolegroup_ref("default"))
5758
.unwrap();

0 commit comments

Comments
 (0)