Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump operator rs to 0.67.1 #462

Merged
merged 11 commits into from
May 10, 2024
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
1,266 changes: 686 additions & 580 deletions Cargo.lock

Large diffs are not rendered by default.

3,491 changes: 1,508 additions & 1,983 deletions Cargo.nix

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ repository = "https://github.com/stackabletech/hive-operator"

[workspace.dependencies]
anyhow = "1.0"
built = { version = "0.6", features = ["chrono", "git2"] }
clap = "4.3"
built = { version = "0.7", features = ["chrono", "git2"] }
clap = "4.5"
fnv = "1.0"
futures = { version = "0.3", features = ["compat"] }
indoc = "2.0"
pin-project = "1.1"
rstest = "0.18"
rstest = "0.19"
semver = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.9"
snafu = "0.7"
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.64.0" }
snafu = "0.8"
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.67.1" }
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.6.0" }
strum = { version = "0.25", features = ["derive"] }
tokio = { version = "1.29", features = ["full"] }
strum = { version = "0.26", features = ["derive"] }
tokio = { version = "1.37", features = ["full"] }
tracing = "0.1"

# [patch."https://github.com/stackabletech/operator-rs.git"]
Expand Down
292 changes: 288 additions & 4 deletions crate-hashes.json

Large diffs are not rendered by default.

594 changes: 437 additions & 157 deletions deploy/helm/hive-operator/crds/crds.yaml

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions rust/crd/src/affinity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ mod tests {
WeightedPodAffinityTerm {
pod_affinity_term: PodAffinityTerm {
label_selector: Some(LabelSelector {
match_expressions: None,
match_labels: Some(BTreeMap::from([
("app.kubernetes.io/name".to_string(), "hive".to_string(),),
(
Expand All @@ -82,11 +81,11 @@ mod tests {
"app.kubernetes.io/component".to_string(),
"metastore".to_string(),
)
]))
])),
..LabelSelector::default()
}),
namespace_selector: None,
namespaces: None,
topology_key: "kubernetes.io/hostname".to_string(),
..PodAffinityTerm::default()
},
weight: 70
}
Expand Down
11 changes: 5 additions & 6 deletions rust/crd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use indoc::formatdoc;
use security::AuthenticationConfig;
use serde::{Deserialize, Serialize};
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_operator::kube::ResourceExt;
use stackable_operator::{
commons::{
affinity::StackableAffinity,
Expand All @@ -18,8 +17,8 @@ use stackable_operator::{
},
config::{fragment, fragment::Fragment, fragment::ValidationError, merge::Merge},
k8s_openapi::apimachinery::pkg::api::resource::Quantity,
kube::{runtime::reflector::ObjectRef, CustomResource},
product_config_utils::{ConfigError, Configuration},
kube::{runtime::reflector::ObjectRef, CustomResource, ResourceExt},
product_config_utils::{self, Configuration},
product_logging::{self, spec::Logging},
role_utils::{GenericRoleConfig, Role, RoleGroup, RoleGroupRef},
schemars::{self, JsonSchema},
Expand Down Expand Up @@ -442,7 +441,7 @@ impl Configuration for MetaStoreConfigFragment {
&self,
hive: &Self::Configurable,
_role_name: &str,
) -> Result<BTreeMap<String, Option<String>>, ConfigError> {
) -> Result<BTreeMap<String, Option<String>>, product_config_utils::Error> {
let mut result = BTreeMap::new();

let env = formatdoc! {"
Expand All @@ -464,7 +463,7 @@ impl Configuration for MetaStoreConfigFragment {
&self,
hive: &Self::Configurable,
_role_name: &str,
) -> Result<BTreeMap<String, Option<String>>, ConfigError> {
) -> Result<BTreeMap<String, Option<String>>, product_config_utils::Error> {
let mut result = BTreeMap::new();
result.insert(
MetaStoreConfig::DB_TYPE_CLI.to_string(),
Expand All @@ -478,7 +477,7 @@ impl Configuration for MetaStoreConfigFragment {
hive: &Self::Configurable,
_role_name: &str,
file: &str,
) -> Result<BTreeMap<String, Option<String>>, ConfigError> {
) -> Result<BTreeMap<String, Option<String>>, product_config_utils::Error> {
let mut result = BTreeMap::new();

match file {
Expand Down
12 changes: 1 addition & 11 deletions rust/operator-binary/build.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
use std::path::PathBuf;

fn main() {
let out_dir = PathBuf::from(std::env::var("OUT_DIR").expect("OUT_DIR is required"));
built::write_built_file_with_opts(
// built's env module depends on a whole bunch of variables that crate2nix doesn't provide
// so we grab the specific env variables that we care about out ourselves instead.
built::Options::default().set_env(false),
"Cargo.toml".as_ref(),
&out_dir.join("built.rs"),
)
.unwrap();
built::write_built_file().unwrap();
}
54 changes: 30 additions & 24 deletions rust/operator-binary/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ use stackable_hive_crd::{

use stackable_operator::{
builder::{
resources::ResourceRequirementsBuilder, ConfigMapBuilder, ContainerBuilder,
ObjectMetaBuilder, PodBuilder, PodSecurityContextBuilder,
SecretOperatorVolumeSourceBuilder, VolumeBuilder,
configmap::ConfigMapBuilder,
meta::ObjectMetaBuilder,
pod::{
container::ContainerBuilder,
resources::ResourceRequirementsBuilder,
security::PodSecurityContextBuilder,
volume::{SecretOperatorVolumeSourceBuilder, VolumeBuilder},
PodBuilder,
},
},
cluster_resources::{ClusterResourceApplyStrategy, ClusterResources},
commons::{
Expand Down Expand Up @@ -119,59 +125,59 @@ pub enum Error {

#[snafu(display("failed to apply global Service"))]
ApplyRoleService {
source: stackable_operator::error::Error,
source: stackable_operator::cluster_resources::Error,
},

#[snafu(display("failed to apply Service for {rolegroup}"))]
ApplyRoleGroupService {
source: stackable_operator::error::Error,
source: stackable_operator::cluster_resources::Error,
rolegroup: RoleGroupRef<HiveCluster>,
},

#[snafu(display("failed to build ConfigMap for {rolegroup}"))]
BuildRoleGroupConfig {
source: stackable_operator::error::Error,
source: stackable_operator::builder::configmap::Error,
rolegroup: RoleGroupRef<HiveCluster>,
},

#[snafu(display("failed to apply ConfigMap for {rolegroup}"))]
ApplyRoleGroupConfig {
source: stackable_operator::error::Error,
source: stackable_operator::cluster_resources::Error,
rolegroup: RoleGroupRef<HiveCluster>,
},

#[snafu(display("failed to apply StatefulSet for {rolegroup}"))]
ApplyRoleGroupStatefulSet {
source: stackable_operator::error::Error,
source: stackable_operator::cluster_resources::Error,
rolegroup: RoleGroupRef<HiveCluster>,
},

#[snafu(display("failed to generate product config"))]
GenerateProductConfig {
source: stackable_operator::product_config_utils::ConfigError,
source: stackable_operator::product_config_utils::Error,
},

#[snafu(display("invalid product config"))]
InvalidProductConfig {
source: stackable_operator::error::Error,
source: stackable_operator::product_config_utils::Error,
},

#[snafu(display("object is missing metadata to build owner reference"))]
ObjectMissingMetadataForOwnerRef {
source: stackable_operator::error::Error,
source: stackable_operator::builder::meta::Error,
},

#[snafu(display("failed to build discovery ConfigMap"))]
BuildDiscoveryConfig { source: discovery::Error },

#[snafu(display("failed to apply discovery ConfigMap"))]
ApplyDiscoveryConfig {
source: stackable_operator::error::Error,
source: stackable_operator::cluster_resources::Error,
},

#[snafu(display("failed to update status"))]
ApplyStatus {
source: stackable_operator::error::Error,
source: stackable_operator::client::Error,
},

#[snafu(display("failed to parse db type {db_type}"))]
Expand All @@ -182,7 +188,7 @@ pub enum Error {

#[snafu(display("failed to resolve S3 connection"))]
ResolveS3Connection {
source: stackable_operator::error::Error,
source: stackable_operator::commons::s3::Error,
},

#[snafu(display(
Expand All @@ -198,24 +204,24 @@ pub enum Error {

#[snafu(display("failed to convert java heap config to unit [{unit}]"))]
FailedToConvertJavaHeap {
source: stackable_operator::error::Error,
source: stackable_operator::memory::Error,
unit: String,
},

#[snafu(display("failed to create hive container [{name}]"))]
FailedToCreateHiveContainer {
source: stackable_operator::error::Error,
source: stackable_operator::builder::pod::container::Error,
name: String,
},

#[snafu(display("failed to create cluster resources"))]
CreateClusterResources {
source: stackable_operator::error::Error,
source: stackable_operator::cluster_resources::Error,
},

#[snafu(display("failed to delete orphaned resources"))]
DeleteOrphanedResources {
source: stackable_operator::error::Error,
source: stackable_operator::cluster_resources::Error,
},

#[snafu(display("failed to resolve the Vector aggregator address"))]
Expand All @@ -231,17 +237,17 @@ pub enum Error {

#[snafu(display("failed to patch service account"))]
ApplyServiceAccount {
source: stackable_operator::error::Error,
source: stackable_operator::cluster_resources::Error,
},

#[snafu(display("failed to patch role binding"))]
ApplyRoleBinding {
source: stackable_operator::error::Error,
source: stackable_operator::cluster_resources::Error,
},

#[snafu(display("failed to build RBAC resources"))]
BuildRbacResources {
source: stackable_operator::error::Error,
source: stackable_operator::commons::rbac::Error,
},

#[snafu(display("internal operator failure"))]
Expand All @@ -268,7 +274,7 @@ pub enum Error {

#[snafu(display("failed to build TLS certificate SecretClass Volume"))]
TlsCertSecretClassVolumeBuild {
source: stackable_operator::builder::SecretOperatorVolumeSourceBuilderError,
source: stackable_operator::builder::pod::volume::SecretOperatorVolumeSourceBuilderError,
},

#[snafu(display("failed to build S3 credentials SecretClass Volume"))]
Expand All @@ -283,7 +289,7 @@ pub enum Error {

#[snafu(display("failed to build Metadata"))]
MetadataBuild {
source: stackable_operator::builder::ObjectMetaBuilderError,
source: stackable_operator::builder::meta::Error,
},

#[snafu(display("failed to get required Labels"))]
Expand Down Expand Up @@ -318,7 +324,7 @@ pub async fn reconcile_hive(hive: Arc<HiveCluster>, ctx: Arc<Ctx>) -> Result<Act
let resolved_product_image: ResolvedProductImage = hive
.spec
.image
.resolve(DOCKER_IMAGE_BASE_NAME, crate::built_info::CARGO_PKG_VERSION);
.resolve(DOCKER_IMAGE_BASE_NAME, crate::built_info::PKG_VERSION);
let hive_role = HiveRole::MetaStore;

let s3_connection_spec: Option<S3ConnectionSpec> =
Expand Down
10 changes: 5 additions & 5 deletions rust/operator-binary/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use snafu::{OptionExt, ResultExt, Snafu};
use stackable_hive_crd::{HiveCluster, HiveRole, ServiceType, HIVE_PORT, HIVE_PORT_NAME};
use stackable_operator::commons::product_image_selection::ResolvedProductImage;
use stackable_operator::{
builder::{ConfigMapBuilder, ObjectMetaBuilder},
builder::{configmap::ConfigMapBuilder, meta::ObjectMetaBuilder},
k8s_openapi::api::core::v1::ConfigMap,
k8s_openapi::api::core::v1::{Endpoints, Service, ServiceSpec},
kube::{runtime::reflector::ObjectRef, Resource},
Expand All @@ -20,14 +20,14 @@ pub enum Error {
NoNamespace,
#[snafu(display("object is missing metadata to build owner reference {hive}"))]
ObjectMissingMetadataForOwnerRef {
source: stackable_operator::error::Error,
source: stackable_operator::builder::meta::Error,
hive: ObjectRef<HiveCluster>,
},
#[snafu(display("chroot path {chroot} was relative (must be absolute)"))]
RelativeChroot { chroot: String },
#[snafu(display("could not build discovery config map for {obj_ref}"))]
DiscoveryConfigMap {
source: stackable_operator::error::Error,
source: stackable_operator::builder::configmap::Error,
obj_ref: ObjectRef<HiveCluster>,
},
#[snafu(display("could not find service [{obj_ref}] port [{port_name}]"))]
Expand All @@ -42,7 +42,7 @@ pub enum Error {
},
#[snafu(display("could not find Endpoints for {svc}"))]
FindEndpoints {
source: stackable_operator::error::Error,
source: stackable_operator::client::Error,
svc: ObjectRef<Service>,
},
#[snafu(display("nodePort was out of range"))]
Expand All @@ -52,7 +52,7 @@ pub enum Error {

#[snafu(display("failed to build Metadata"))]
MetadataBuild {
source: stackable_operator::builder::ObjectMetaBuilderError,
source: stackable_operator::builder::meta::Error,
},
}

Expand Down
9 changes: 6 additions & 3 deletions rust/operator-binary/src/kerberos.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
use indoc::formatdoc;
use snafu::{ResultExt, Snafu};
use stackable_hive_crd::{HiveCluster, HiveRole, HIVE_SITE_XML, STACKABLE_CONFIG_DIR};
use stackable_operator::builder::{
ContainerBuilder, PodBuilder, SecretOperatorVolumeSourceBuilder,
SecretOperatorVolumeSourceBuilderError, VolumeBuilder,
use stackable_operator::builder::pod::{
container::ContainerBuilder,
volume::{
SecretOperatorVolumeSourceBuilder, SecretOperatorVolumeSourceBuilderError, VolumeBuilder,
},
PodBuilder,
};
use stackable_operator::kube::ResourceExt;
use std::collections::BTreeMap;
Expand Down
6 changes: 2 additions & 4 deletions rust/operator-binary/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ use std::sync::Arc;

mod built_info {
include!(concat!(env!("OUT_DIR"), "/built.rs"));
pub const TARGET_PLATFORM: Option<&str> = option_env!("TARGET");
pub const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
}

const OPERATOR_NAME: &str = "hive.stackable.tech";
Expand All @@ -42,7 +40,7 @@ struct Opts {
async fn main() -> anyhow::Result<()> {
let opts = Opts::parse();
match opts.cmd {
Command::Crd => HiveCluster::print_yaml_schema(built_info::CARGO_PKG_VERSION)?,
Command::Crd => HiveCluster::print_yaml_schema(built_info::PKG_VERSION)?,
Command::Run(ProductOperatorRun {
product_config,
watch_namespace,
Expand All @@ -57,7 +55,7 @@ async fn main() -> anyhow::Result<()> {
crate_description!(),
crate_version!(),
built_info::GIT_VERSION,
built_info::TARGET_PLATFORM.unwrap_or("unknown target"),
built_info::TARGET,
built_info::BUILT_TIME_UTC,
built_info::RUSTC_VERSION,
);
Expand Down
2 changes: 1 addition & 1 deletion rust/operator-binary/src/operations/graceful_shutdown.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use snafu::{ResultExt, Snafu};
use stackable_hive_crd::MetaStoreConfig;
use stackable_operator::builder::PodBuilder;
use stackable_operator::builder::pod::PodBuilder;

#[derive(Debug, Snafu)]
pub enum Error {
Expand Down
4 changes: 2 additions & 2 deletions rust/operator-binary/src/operations/pdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ use crate::{controller::HIVE_CONTROLLER_NAME, OPERATOR_NAME};
pub enum Error {
#[snafu(display("Cannot create PodDisruptionBudget for role [{role}]"))]
CreatePdb {
source: stackable_operator::error::Error,
source: stackable_operator::builder::pdb::Error,
role: String,
},
#[snafu(display("Cannot apply PodDisruptionBudget [{name}]"))]
ApplyPdb {
source: stackable_operator::error::Error,
source: stackable_operator::cluster_resources::Error,
name: String,
},
}
Expand Down
Loading
Loading