Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ tracing-opentelemetry = "0.32.0"
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
trybuild = "1.0.99"
url = { version = "2.5.2", features = ["serde"] }
uuid = "1.23"
x509-cert = { version = "0.2.5", features = ["builder"] }
zeroize = "1.8.1"

Expand Down
1 change: 1 addition & 0 deletions crates/stackable-operator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ tracing.workspace = true
tracing-appender.workspace = true
tracing-subscriber.workspace = true
url.workspace = true
uuid.workspace = true

[dev-dependencies]
indoc.workspace = true
Expand Down
15 changes: 7 additions & 8 deletions crates/stackable-operator/src/v2/builder/meta.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use stackable_operator::{
use crate::{
builder::meta::OwnerReferenceBuilder,
k8s_openapi::apimachinery::pkg::apis::meta::v1::OwnerReference, kube::Resource,
k8s_openapi::apimachinery::pkg::apis::meta::v1::OwnerReference,
kube::Resource,
v2::{HasName, HasUid},
};

use crate::framework::{HasName, HasUid};

/// Infallible variant of
/// [`stackable_operator::builder::meta::ObjectMetaBuilder::ownerreference_from_resource`]
pub fn ownerreference_from_resource(
Expand Down Expand Up @@ -32,20 +32,19 @@ pub fn ownerreference_from_resource(
mod tests {
use std::borrow::Cow;

use stackable_operator::{
use crate::{
k8s_openapi::apimachinery::pkg::apis::meta::v1::{ObjectMeta, OwnerReference},
kube::Resource,
v2::{HasName, HasUid, Uid, builder::meta::ownerreference_from_resource},
};

use crate::framework::{HasName, HasUid, Uid, builder::meta::ownerreference_from_resource};

struct Cluster {
object_meta: ObjectMeta,
}

impl Cluster {
fn new() -> Self {
Cluster {
Self {
object_meta: ObjectMeta {
name: Some("cluster-name".to_owned()),
uid: Some("a6b89911-d48e-4328-88d6-b9251226583d".to_owned()),
Expand Down
30 changes: 14 additions & 16 deletions crates/stackable-operator/src/v2/builder/pdb.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use stackable_operator::{
use crate::{
builder::pdb::PodDisruptionBudgetBuilder,
k8s_openapi::apimachinery::pkg::apis::meta::v1::LabelSelector,
kube::{Resource, api::ObjectMeta},
};

use crate::framework::{
HasName, HasUid, NameIsValidLabelValue,
types::operator::{ControllerName, OperatorName, ProductName, RoleName},
v2::{
HasName, HasUid, NameIsValidLabelValue,
types::operator::{ControllerName, OperatorName, ProductName, RoleName},
},
};

/// Infallible variant of
Expand Down Expand Up @@ -35,7 +34,7 @@ pub fn pod_disruption_budget_builder_with_role(
mod tests {
use std::borrow::Cow;

use stackable_operator::{
use crate::{
k8s_openapi::{
api::policy::v1::{PodDisruptionBudget, PodDisruptionBudgetSpec},
apimachinery::pkg::{
Expand All @@ -44,14 +43,13 @@ mod tests {
},
},
kube::Resource,
};

use crate::framework::{
HasName, HasUid, NameIsValidLabelValue,
builder::pdb::pod_disruption_budget_builder_with_role,
types::{
kubernetes::Uid,
operator::{ControllerName, OperatorName, ProductName, RoleName},
v2::{
HasName, HasUid, NameIsValidLabelValue,
builder::pdb::pod_disruption_budget_builder_with_role,
types::{
kubernetes::Uid,
operator::{ControllerName, OperatorName, ProductName, RoleName},
},
},
};

Expand All @@ -61,7 +59,7 @@ mod tests {

impl Cluster {
fn new() -> Self {
Cluster {
Self {
object_meta: ObjectMeta {
name: Some("cluster-name".to_owned()),
uid: Some("a6b89911-d48e-4328-88d6-b9251226583d".to_owned()),
Expand Down
31 changes: 15 additions & 16 deletions crates/stackable-operator/src/v2/builder/pod/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ use std::{
};

use snafu::Snafu;
use stackable_operator::{
use strum::{EnumDiscriminants, IntoStaticStr};

use crate::{
builder::pod::container::{ContainerBuilder, FieldPathEnvVar},
k8s_openapi::api::core::v1::{ConfigMapKeySelector, EnvVar, EnvVarSource, ObjectFieldSelector},
v2::types::kubernetes::{ConfigMapKey, ConfigMapName, ContainerName},
};
use strum::{EnumDiscriminants, IntoStaticStr};

use crate::framework::types::kubernetes::{ConfigMapKey, ConfigMapName, ContainerName};

#[derive(Snafu, Debug, EnumDiscriminants)]
#[strum_discriminants(derive(IntoStaticStr))]
Expand All @@ -38,7 +38,7 @@ impl EnvVarName {
///
/// Use this only with constant names that are also tested in unit tests!
pub fn from_str_unsafe(s: &str) -> Self {
EnvVarName::from_str(s).expect("should be a valid environment variable name")
Self::from_str(s).expect("should be a valid environment variable name")
}
}

Expand Down Expand Up @@ -84,7 +84,7 @@ impl EnvVarSet {
/// Moves all [`EnvVar`]s from the given set into this one.
///
/// [`EnvVar`]s with the same name are overridden.
pub fn merge(mut self, mut env_var_set: EnvVarSet) -> Self {
pub fn merge(mut self, mut env_var_set: Self) -> Self {
self.0.append(&mut env_var_set.0);

self
Expand Down Expand Up @@ -124,7 +124,7 @@ impl EnvVarSet {
/// Adds an environment variable with the given name and field path to this set
///
/// An [`EnvVar`] with the same name is overridden.
pub fn with_field_path(mut self, name: &EnvVarName, field_path: FieldPathEnvVar) -> Self {
pub fn with_field_path(mut self, name: &EnvVarName, field_path: &FieldPathEnvVar) -> Self {
Comment thread
siegfriedweber marked this conversation as resolved.
self.0.insert(
name.clone(),
EnvVar {
Expand Down Expand Up @@ -191,17 +191,16 @@ impl IntoIterator for EnvVarSet {
mod tests {
use std::str::FromStr;

use stackable_operator::{
use super::{EnvVarName, EnvVarSet};
use crate::{
builder::pod::container::FieldPathEnvVar,
k8s_openapi::api::core::v1::{
ConfigMapKeySelector, EnvVar, EnvVarSource, ObjectFieldSelector,
},
};

use super::{EnvVarName, EnvVarSet};
use crate::framework::{
builder::pod::container::new_container_builder,
types::kubernetes::{ConfigMapKey, ConfigMapName, ContainerName},
v2::{
builder::pod::container::new_container_builder,
types::kubernetes::{ConfigMapKey, ConfigMapName, ContainerName},
},
};

#[test]
Expand Down Expand Up @@ -253,7 +252,7 @@ mod tests {
&EnvVarName::from_str_unsafe("ENV2"),
"value2 from env_var_set2",
)
.with_field_path(&EnvVarName::from_str_unsafe("ENV3"), FieldPathEnvVar::Name)
.with_field_path(&EnvVarName::from_str_unsafe("ENV3"), &FieldPathEnvVar::Name)
.with_value(
&EnvVarName::from_str_unsafe("ENV4"),
"value4 from env_var_set2",
Expand Down Expand Up @@ -335,7 +334,7 @@ mod tests {
#[test]
fn test_envvarset_with_field_path() {
let env_var_set = EnvVarSet::new()
.with_field_path(&EnvVarName::from_str_unsafe("ENV"), FieldPathEnvVar::Name);
.with_field_path(&EnvVarName::from_str_unsafe("ENV"), &FieldPathEnvVar::Name);

assert_eq!(
Some(&EnvVar {
Expand Down
20 changes: 7 additions & 13 deletions crates/stackable-operator/src/v2/builder/pod/volume.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use stackable_operator::{
use crate::{
builder::pod::volume::ListenerOperatorVolumeSourceBuilder,
k8s_openapi::api::core::v1::PersistentVolumeClaim, kvp::Labels,
};

use crate::framework::types::kubernetes::{
ListenerClassName, ListenerName, PersistentVolumeClaimName,
k8s_openapi::api::core::v1::PersistentVolumeClaim,
kvp::Labels,
v2::types::kubernetes::{ListenerClassName, ListenerName, PersistentVolumeClaimName},
};

/// Infallible variant of [`stackable_operator::builder::pod::volume::ListenerReference`]
Expand All @@ -14,18 +12,14 @@ pub enum ListenerReference {
Listener(ListenerName),
}

impl From<&ListenerReference> for stackable_operator::builder::pod::volume::ListenerReference {
impl From<&ListenerReference> for crate::builder::pod::volume::ListenerReference {
fn from(value: &ListenerReference) -> Self {
match value {
ListenerReference::ListenerClass(listener_class_name) => {
stackable_operator::builder::pod::volume::ListenerReference::ListenerClass(
listener_class_name.to_string(),
)
Self::ListenerClass(listener_class_name.to_string())
}
ListenerReference::Listener(listener_name) => {
stackable_operator::builder::pod::volume::ListenerReference::ListenerName(
listener_name.to_string(),
)
Self::ListenerName(listener_name.to_string())
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions crates/stackable-operator/src/v2/builder/statefulset.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use std::collections::BTreeMap;

use stackable_operator::kvp::Annotations;

use crate::framework::types::kubernetes::{ConfigMapName, SecretName};
use crate::{
kvp::Annotations,
v2::types::kubernetes::{ConfigMapName, SecretName},
};

/// Creates `restarter.stackable.tech/ignore-configmap.{i}` annotations for each given ConfigMap.
///
Expand Down
Loading
Loading