Skip to content

Commit

Permalink
chore(bors): merge pull request #565
Browse files Browse the repository at this point in the history
565: build: update control-plane dep, nixpkgs and rust r=tiagolobocastro a=tiagolobocastro

<!

Co-authored-by: Tiago Castro <[email protected]>
  • Loading branch information
mayastor-bors and tiagolobocastro committed Nov 4, 2024
2 parents f270cdc + c614821 commit a5ae5fe
Show file tree
Hide file tree
Showing 40 changed files with 1,689 additions and 1,314 deletions.
2,205 changes: 1,491 additions & 714 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ members = [
"console-logger",
"metrics-exporter",
"k8s/plugin",
"k8s/proxy",
"k8s/supportability",
"k8s/upgrade",
]

exclude = [ "./dependencies/control-plane" ]
exclude = ["./dependencies/control-plane"]
resolver = "1"
46 changes: 23 additions & 23 deletions call-home/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,37 @@ constants = { path = "../constants" }
openapi = { path = "../dependencies/control-plane/openapi" }
kube = { version = "0.87.0", features = ["runtime", "derive"] }
k8s-openapi = { version = "0.20.0", features = ["v1_22"] }
futures = "0.3.28"
tokio = { version = "1.33.0", features = ["full"] }
clap = { version = "4.4.6", features = ["cargo", "derive", "string"] }
serde_json = "1.0.107"
serde_yaml = "0.9.25"
serde = { version = "1.0.188", features = ["derive"] }
sha256 = "1.4.0"
futures = "0.3.31"
tokio = { version = "1.41.0", features = ["full"] }
clap = { version = "4.5.20", features = ["cargo", "derive", "string"] }
serde_json = "1.0.132"
serde_yaml = "0.9.34"
serde = { version = "1.0.214", features = ["derive"] }
sha256 = "1.5.0"
jsonpath_lib = "0.3.0"
url = "2.4.1"
snafu = "0.7.5"
anyhow = "1.0.75"
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "std"] }
reqwest = "0.11.22"
reqwest-middleware = "0.2.3"
reqwest-retry = "0.3.0"
chrono = "0.4.31"
url = "2.5.2"
snafu = "0.8.5"
anyhow = "1.0.92"
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "std"] }
reqwest = "0.12.9"
reqwest-middleware = "0.3.3"
reqwest-retry = "0.6.1"
chrono = "0.4.38"
rand = "0.8.5"
tempfile = "3.8.0"
tempfile = "3.13.0"
humantime = "2.1.0"
once_cell = "1.18.0"
bytes = "1.5.0"
once_cell = "1.20.2"
bytes = "1.8.0"
utils = { path = "../dependencies/control-plane/utils/utils-lib" }
events-api = { path = "../dependencies/control-plane/utils/dependencies/apis/events" }
tokio-retry = "0.3"

# exporter
actix-web = { version = "4.4.0", features = ["rustls-0_21"] }
prometheus = "0.13.3"
actix-web = { version = "4.9.0", features = ["rustls-0_21"] }
prometheus = "0.13.4"
mime = "0.3.17"

# parse prometheus output
prometheus-parse = "0.2.4"
heck = "0.4.1"
prometheus-parse = "0.2.5"
heck = "0.5.0"
22 changes: 10 additions & 12 deletions call-home/src/bin/callhome/collector/report_models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ pub(crate) struct Volumes {
volume_state_counts: VolumeStateCounts,
}
impl Volumes {
/// Receives a openapi::models::Volumes object and returns a new report_models::volume object by
/// using the data provided.
/// Receives an openapi::models::Volumes object and returns a new report_models::volume object
/// by using the data provided.
pub(crate) fn new(volumes: Vec<Volume>, event_data: EventData) -> Self {
let volumes_size_vector = get_volumes_size_vector(volumes.as_slice());
Self {
Expand Down Expand Up @@ -64,8 +63,8 @@ struct VolumeReplicaCounts {
}

impl VolumeReplicaCounts {
// Receives a openapi::models::Volumes object and returns number of volumes with specific number
// of replicas.
// Receives an openapi::models::Volumes object and returns number of volumes with specific
// number of replicas.
fn new(volumes: &[Volume]) -> Self {
Self {
one_replica: volumes
Expand Down Expand Up @@ -103,7 +102,7 @@ struct VolumeStateCounts {
}

impl VolumeStateCounts {
// Receives a openapi::models::Volumes object and returns number of volumes with specific state
// Receives an openapi::models::Volumes object and returns number of volumes with specific state
// of the volume.
fn new(volumes: &[Volume]) -> Self {
Self {
Expand Down Expand Up @@ -172,7 +171,7 @@ pub(crate) struct Replicas {
count_per_volume_percentiles: Percentiles,
}
impl Replicas {
/// Receives a Option<openapi::models::Volumes> and replica_count and returns a new
/// Receives an Option<openapi::models::Volumes> and replica_count and returns a new
/// report_models::replica object by using the data provided.
pub(crate) fn new(replica_count: usize, volumes: Option<Vec<Volume>>) -> Self {
let mut replicas = Self::default();
Expand Down Expand Up @@ -359,7 +358,7 @@ impl MayastorManagedDisks {
for pool_state in pools.into_iter().filter_map(|pool| pool.state) {
// Retrieve the disks associated with the current pool's node.
if let Some(disks) = node_disks.get(&pool_state.node) {
if let Some(pool_disk) = &pool_state.disks.get(0) {
if let Some(pool_disk) = &pool_state.disks.first() {
// Retrieve the block device associated with the pool disk.
match get_bdev(disks, pool_disk) {
Some(bdev) => {
Expand Down Expand Up @@ -560,12 +559,11 @@ fn get_replicas_size_vector(volumes: Vec<Volume>) -> Vec<u64> {
}

/// Gets a vector containing pool sizes from Vec<openapi::models::Pool>.
fn get_pools_size_vector(pools: &Vec<openapi::models::Pool>) -> Vec<u64> {
fn get_pools_size_vector(pools: &[openapi::models::Pool]) -> Vec<u64> {
let mut pools_size_vector = Vec::with_capacity(pools.len());
for pool in pools.iter() {
match &pool.state {
Some(pool_state) => pools_size_vector.push(pool_state.capacity),
None => {}
if let Some(pool_state) = &pool.state {
pools_size_vector.push(pool_state.capacity)
};
}
pools_size_vector
Expand Down
23 changes: 13 additions & 10 deletions call-home/src/bin/stats/exporter/events_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ use prometheus::{
CounterVec, Opts,
};
use serde::{Deserialize, Serialize};
use std::{fmt::Debug, ops::DerefMut};
use std::{
fmt::{Debug, Display, Formatter},
ops::DerefMut,
};
use tracing::error;

/// StatsCollector contains the list of custom metrics that has to be exposed by exporter.
Expand All @@ -33,15 +36,15 @@ pub enum Metrics {
Nexus,
Unknown,
}

impl ToString for Metrics {
fn to_string(&self) -> String {
match self {
Metrics::Pool => "pool".to_string(),
Metrics::Volume => "volume".to_string(),
Metrics::Nexus => "nexus".to_string(),
Metrics::Unknown => "".to_string(),
}
impl Display for Metrics {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let metric = match self {
Metrics::Pool => "pool",
Metrics::Volume => "volume",
Metrics::Nexus => "nexus",
Metrics::Unknown => "",
};
write!(f, "{metric}")
}
}

Expand Down
1 change: 0 additions & 1 deletion call-home/src/common/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ pub const RECEIVER_ENDPOINT: &str = ::constants::CALL_HOME_ENDPOINT;

/// CALL_HOME_FREQUENCY_IN_HOURS is the frequency of call-home metrics transmission, in hours.
/// The function call_home_frequency() returns the frequency as an std::time::Duration.
const CALL_HOME_FREQUENCY_IN_HOURS: i64 = 24;

pub fn call_home_frequency() -> std::time::Duration {
Expand Down
2 changes: 1 addition & 1 deletion console-logger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ name = "console_logger"
path = "./src/console.rs"

[dependencies]
nu-ansi-term = "0.49.0"
nu-ansi-term = "0.50.1"
2 changes: 1 addition & 1 deletion constants/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ edition = "2021"

[dependencies]
utils = {path = "../dependencies/control-plane/utils/utils-lib" }
heck = "0.4.1"
heck = "0.5.0"
2 changes: 1 addition & 1 deletion dependencies/control-plane
Submodule control-plane updated 166 files
20 changes: 9 additions & 11 deletions k8s/plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,23 @@ path = "src/main.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = [ "rls" ]
rls = [ "openapi/tower-client-rls", "rest-plugin/rls" ]
tls = [ "openapi/tower-client-tls", "rest-plugin/tls" ]
default = ["rls"]
rls = ["openapi/tower-client-rls", "rest-plugin/rls"]
tls = ["openapi/tower-client-tls", "rest-plugin/tls"]


[dependencies]
openapi = { path = "../../dependencies/control-plane/openapi", default-features = false, features = [ "tower-trace" ] }
openapi = { path = "../../dependencies/control-plane/openapi", default-features = false, features = ["tower-trace"] }
utils = { path = "../../dependencies/control-plane/utils/utils-lib" }
constants = { path = "../../constants" }
rest-plugin = { path = "../../dependencies/control-plane/control-plane/plugin", default-features = false }
console-logger = { path = "../../console-logger" }
supportability = { path = "../supportability" }
upgrade = { path = "../upgrade" }
kube-proxy = { path = "../proxy" }
tokio = { version = "1.33.0" }
anyhow = "1.0.75"
clap = { version = "4.4.6", features = ["color", "derive"] }
kube-proxy = { path = "../../dependencies/control-plane/k8s/proxy" }
tokio = { version = "1.41.0" }
anyhow = "1.0.92"
clap = { version = "4.5.20", features = ["color", "derive"] }
humantime = "2.1.0"
async-trait = "0.1.73"
# Tracing
opentelemetry = { version = "0.20.0", features = ["rt-tokio-current-thread"] }
async-trait = "0.1.83"
shutdown = { path = "../../dependencies/control-plane/utils/shutdown" }
5 changes: 2 additions & 3 deletions k8s/plugin/src/resources/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,9 @@ impl ExecuteOperation for Operations {
Operations::Uncordon(resource) => resource.execute(cli_args).await?,
Operations::Dump(resources) => {
// todo: build and pass arguments
resources.execute(&()).await.map_err(|e| {
resources.execute(&()).await.inspect_err(|_| {
// todo: check why is this here, can it be removed?
println!("Partially collected dump information: ");
e
})?
}
Operations::Upgrade(resources) => {
Expand Down Expand Up @@ -165,7 +164,7 @@ impl From<anyhow::Error> for Error {
pub async fn init_rest(cli_args: &CliArgs) -> Result<(), Error> {
// Use the supplied URL if there is one otherwise obtain one from the kubeconfig file.
match cli_args.rest.clone() {
Some(url) => RestClient::init(url, *cli_args.timeout).map_err(Error::RestClient),
Some(url) => RestClient::init(url, false, *cli_args.timeout).map_err(Error::RestClient),
None => {
let config = kube_proxy::ConfigBuilder::default_api_rest()
.with_kube_config(cli_args.kube_config_path.clone())
Expand Down
20 changes: 0 additions & 20 deletions k8s/proxy/Cargo.toml

This file was deleted.

53 changes: 0 additions & 53 deletions k8s/proxy/src/lib.rs

This file was deleted.

Loading

0 comments on commit a5ae5fe

Please sign in to comment.