Skip to content

Commit

Permalink
chore: bump operator rs 0.67.1 (#98)
Browse files Browse the repository at this point in the history
* WIP

* WIP

* .

* fix built

* bump to op-rs 0.67.1

---------

Co-authored-by: Malte Sander <[email protected]>
  • Loading branch information
fhennig and maltesander authored May 10, 2024
1 parent c497220 commit e5888eb
Show file tree
Hide file tree
Showing 10 changed files with 2,983 additions and 1,704 deletions.
1,146 changes: 627 additions & 519 deletions Cargo.lock

Large diffs are not rendered by default.

2,551 changes: 1,579 additions & 972 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,21 +11,21 @@ repository = "https://github.com/stackabletech/edc-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"] }
pin-project = "1.1"
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.6.0" }
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" }
strum = { version = "0.25", features = ["derive"] }
tokio = { version = "1.29", features = ["full"] }
snafu = "0.8"
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.67.1" }
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
291 changes: 287 additions & 4 deletions crate-hashes.json

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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();
}
55 changes: 33 additions & 22 deletions rust/operator-binary/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,18 @@ use product_config::{
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_operator::{
builder::{
resources::ResourceRequirementsBuilder, ConfigMapBuilder, ContainerBuilder,
ObjectMetaBuilder, ObjectMetaBuilderError, PodBuilder, PodSecurityContextBuilder,
SecretOperatorVolumeSourceBuilder, SecretOperatorVolumeSourceBuilderError, VolumeBuilder,
configmap::ConfigMapBuilder,
meta::ObjectMetaBuilder,
pod::{
container::ContainerBuilder,
resources::ResourceRequirementsBuilder,
security::PodSecurityContextBuilder,
volume::{
SecretOperatorVolumeSourceBuilder, SecretOperatorVolumeSourceBuilderError,
VolumeBuilder,
},
PodBuilder,
},
},
client::GetApi,
cluster_resources::{ClusterResourceApplyStrategy, ClusterResources},
Expand Down Expand Up @@ -98,47 +107,47 @@ pub enum Error {
RoleGroupServiceNameNotFound { rolegroup: RoleGroupRef<EDCCluster> },
#[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<EDCCluster>,
},
#[snafu(display("failed to build ConfigMap for {rolegroup}"))]
BuildRoleGroupConfig {
source: stackable_operator::error::Error,
source: stackable_operator::builder::configmap::Error,
rolegroup: RoleGroupRef<EDCCluster>,
},
#[snafu(display("failed to apply ConfigMap for {rolegroup}"))]
ApplyRoleGroupConfig {
source: stackable_operator::error::Error,
source: stackable_operator::cluster_resources::Error,
rolegroup: RoleGroupRef<EDCCluster>,
},
#[snafu(display("failed to apply StatefulSet for {rolegroup}"))]
ApplyRoleGroupStatefulSet {
source: stackable_operator::error::Error,
source: stackable_operator::cluster_resources::Error,
rolegroup: RoleGroupRef<EDCCluster>,
},
#[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 apply discovery ConfigMap"))]
ApplyDiscoveryConfig {
source: stackable_operator::error::Error,
source: stackable_operator::client::Error,
},
#[snafu(display("failed to update status"))]
ApplyStatus {
source: stackable_operator::error::Error,
source: stackable_operator::client::Error,
},
#[snafu(display("failed to format runtime properties"))]
PropertiesWriteError { source: PropertiesWriterError },
Expand All @@ -149,22 +158,22 @@ pub enum Error {
},
#[snafu(display("failed to resolve S3 connection"))]
ResolveS3Connection {
source: stackable_operator::error::Error,
source: stackable_operator::commons::s3::Error,
},
#[snafu(display("failed to resolve and merge resource config for role and role group"))]
FailedToResolveResourceConfig { source: crate::crd::Error },
#[snafu(display("failed to create EDC container [{name}]"))]
FailedToCreateEdcContainer {
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"))]
ResolveVectorAggregatorAddress {
Expand All @@ -177,15 +186,15 @@ 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(
"Druid does not support skipping the verification of the tls enabled S3 server"
Expand All @@ -204,7 +213,9 @@ pub enum Error {
BuildLabel { source: LabelError },

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

#[snafu(display("failed to build TLS volume for {volume_name:?}"))]
BuildTlsVolume {
Expand Down Expand Up @@ -232,7 +243,7 @@ pub async fn reconcile_edc(edc: Arc<EDCCluster>, ctx: Arc<Ctx>) -> Result<Action
let resolved_product_image: ResolvedProductImage = edc
.spec
.image
.resolve(DOCKER_IMAGE_BASE_NAME, crate::built_info::CARGO_PKG_VERSION);
.resolve(DOCKER_IMAGE_BASE_NAME, crate::built_info::PKG_VERSION);

let s3_bucket_spec = edc
.spec
Expand Down
14 changes: 8 additions & 6 deletions rust/operator-binary/src/crd.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! This file contains the definition of all the custom resources that this Operator manages.
//! In this case, it is only the `EDCCluster`.
use crate::affinity::get_affinity;
use std::collections::BTreeMap;

use serde::{Deserialize, Serialize};
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_operator::{
Expand All @@ -17,15 +18,16 @@ use stackable_operator::{
config::{fragment, fragment::Fragment, fragment::ValidationError, merge::Merge},
k8s_openapi::apimachinery::pkg::api::resource::Quantity,
kube::{runtime::reflector::ObjectRef, CustomResource, ResourceExt},
product_config_utils::{ConfigError, Configuration},
product_config_utils::{self, Configuration},
product_logging::{self, spec::Logging},
role_utils::{Role, RoleGroupRef},
schemars::{self, JsonSchema},
status::condition::{ClusterCondition, HasStatusCondition},
};
use std::collections::BTreeMap;
use strum::{Display, EnumIter};

use crate::affinity::get_affinity;

pub const APP_NAME: &str = "edc";
// directories
pub const STACKABLE_SECRETS_DIR: &str = "/stackable/secrets";
Expand Down Expand Up @@ -303,7 +305,7 @@ impl Configuration for ConnectorConfigFragment {
&self,
_connector: &Self::Configurable,
_role_name: &str,
) -> Result<BTreeMap<String, Option<String>>, ConfigError> {
) -> Result<BTreeMap<String, Option<String>>, product_config_utils::Error> {
let result = BTreeMap::new();
// no ENV args necessary
Ok(result)
Expand All @@ -313,7 +315,7 @@ impl Configuration for ConnectorConfigFragment {
&self,
_connector: &Self::Configurable,
_role_name: &str,
) -> Result<BTreeMap<String, Option<String>>, ConfigError> {
) -> Result<BTreeMap<String, Option<String>>, product_config_utils::Error> {
let result = BTreeMap::new();
// No CLI args necessary
Ok(result)
Expand All @@ -324,7 +326,7 @@ impl Configuration for ConnectorConfigFragment {
edc: &Self::Configurable,
_role_name: &str,
file: &str,
) -> Result<BTreeMap<String, Option<String>>, ConfigError> {
) -> Result<BTreeMap<String, Option<String>>, product_config_utils::Error> {
let name = edc.name_unchecked();

let mut result = BTreeMap::new();
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 @@ -22,8 +22,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 = "edc.stackable.tech";
Expand All @@ -39,7 +37,7 @@ struct Opts {
async fn main() -> anyhow::Result<()> {
let opts = Opts::parse();
match opts.cmd {
Command::Crd => EDCCluster::print_yaml_schema(built_info::CARGO_PKG_VERSION)?,
Command::Crd => EDCCluster::print_yaml_schema(built_info::PKG_VERSION)?,
Command::Run(ProductOperatorRun {
product_config,
watch_namespace,
Expand All @@ -54,7 +52,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
4 changes: 2 additions & 2 deletions rust/operator-binary/src/product_logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use snafu::{OptionExt, ResultExt, Snafu};
use stackable_operator::memory::BinaryMultiple;
use stackable_operator::product_logging::spec::{AutomaticContainerLogConfig, LogLevel};
use stackable_operator::{
builder::ConfigMapBuilder,
builder::configmap::ConfigMapBuilder,
client::Client,
k8s_openapi::api::core::v1::ConfigMap,
kube::ResourceExt,
Expand All @@ -21,7 +21,7 @@ pub enum Error {
ObjectHasNoNamespace,
#[snafu(display("failed to retrieve the ConfigMap [{cm_name}]"))]
ConfigMapNotFound {
source: stackable_operator::error::Error,
source: stackable_operator::client::Error,
cm_name: String,
},
#[snafu(display("failed to retrieve the entry [{entry}] for ConfigMap [{cm_name}]"))]
Expand Down

0 comments on commit e5888eb

Please sign in to comment.