From ca413ce5a07961cd9652ca4d55a4a222d58e678a Mon Sep 17 00:00:00 2001 From: Aviram Hassan Date: Thu, 29 Jun 2023 16:35:48 +0300 Subject: [PATCH] Remove unused CRD for operator and remove false error (#1592) * Remove unused CRD for operator and don't error on missing operator credentials * a * .. * .. * .. --- Cargo.lock | 1 + changelog.d/+cleanup-operator.internal.md | 1 + mirrord/auth/Cargo.toml | 1 + mirrord/auth/src/credential_store.rs | 3 ++- mirrord/cli/src/config.rs | 9 --------- mirrord/cli/src/operator.rs | 20 -------------------- mirrord/operator/src/crd.rs | 19 +------------------ 7 files changed, 6 insertions(+), 48 deletions(-) create mode 100644 changelog.d/+cleanup-operator.internal.md diff --git a/Cargo.lock b/Cargo.lock index 567206bea65..3e8a0b0d80f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3239,6 +3239,7 @@ dependencies = [ "serde_yaml", "thiserror", "tokio", + "tracing", "x509-certificate 0.19.0", ] diff --git a/changelog.d/+cleanup-operator.internal.md b/changelog.d/+cleanup-operator.internal.md new file mode 100644 index 00000000000..424de27d3b6 --- /dev/null +++ b/changelog.d/+cleanup-operator.internal.md @@ -0,0 +1 @@ +Remove unused CRD for operator and don't error on missing operator credentials \ No newline at end of file diff --git a/mirrord/auth/Cargo.toml b/mirrord/auth/Cargo.toml index 32bfa37fb44..8e11149c30a 100644 --- a/mirrord/auth/Cargo.toml +++ b/mirrord/auth/Cargo.toml @@ -42,3 +42,4 @@ thiserror = "1" x509-certificate = "0.19" # not direct dependency, but if we don't put it here it'll use openssl :( reqwest = { workspace = true, features=["json", "rustls-tls"], default-features = false, optional = true } +tracing.workspace = true \ No newline at end of file diff --git a/mirrord/auth/src/credential_store.rs b/mirrord/auth/src/credential_store.rs index 3d609ae86ae..1687adc5919 100644 --- a/mirrord/auth/src/credential_store.rs +++ b/mirrord/auth/src/credential_store.rs @@ -12,6 +12,7 @@ use tokio::{ fs, io::{AsyncRead, AsyncReadExt, AsyncSeekExt, AsyncWrite, AsyncWriteExt, SeekFrom}, }; +use tracing::info; use crate::{ credentials::Credentials, @@ -114,7 +115,7 @@ impl CredentialStoreSync { { let mut store = CredentialStore::load(store_file) .await - .inspect_err(|err| eprintln!("CredentialStore Load Error {err:?}")) + .inspect_err(|err| info!("CredentialStore Load Error {err:?}")) .unwrap_or_default(); let certificate_der = store diff --git a/mirrord/cli/src/config.rs b/mirrord/cli/src/config.rs index 26185cebf9e..c78b9fcbeeb 100644 --- a/mirrord/cli/src/config.rs +++ b/mirrord/cli/src/config.rs @@ -245,15 +245,6 @@ pub(super) enum OperatorCommand { #[arg(short = 'f')] config_file: Option, }, - /// Print telemtry export for offline operators - #[command( - override_usage = "mirrord operator telemetry-export [OPTIONS] > telemetry-export.json" - )] - TelemetryExport { - /// Specify config file to use - #[arg(short = 'f')] - config_file: Option, - }, } #[derive(ValueEnum, Clone, Debug)] diff --git a/mirrord/cli/src/operator.rs b/mirrord/cli/src/operator.rs index 83df42e193c..6e719cd2163 100644 --- a/mirrord/cli/src/operator.rs +++ b/mirrord/cli/src/operator.rs @@ -150,23 +150,6 @@ Operator License Ok(()) } -async fn operator_telemetry_export(config: Option) -> Result<()> { - let status_api = get_status_api(config).await?; - - let status = status_api - .get_subresource("telemetry-export", OPERATOR_STATUS_NAME) - .await - .map_err(KubeApiError::KubeError) - .map_err(OperatorApiError::KubeApiError) - .map_err(CliError::OperatorConnectionFailed)?; - - if let Some(exports) = status.spec.telemetry_exports { - println!("{}", serde_json::to_string(&exports)?); - } - - Ok(()) -} - /// Handle commands related to the operator `mirrord operator ...` pub(crate) async fn operator_command(args: OperatorArgs) -> Result<()> { match args.command { @@ -191,8 +174,5 @@ pub(crate) async fn operator_command(args: OperatorArgs) -> Result<()> { operator_setup(accept_tos, file, namespace, license, offline).await } OperatorCommand::Status { config_file } => operator_status(config_file).await, - OperatorCommand::TelemetryExport { config_file } => { - operator_telemetry_export(config_file).await - } } } diff --git a/mirrord/operator/src/crd.rs b/mirrord/operator/src/crd.rs index 502f44e0a0e..9cb369d179e 100644 --- a/mirrord/operator/src/crd.rs +++ b/mirrord/operator/src/crd.rs @@ -1,4 +1,4 @@ -use chrono::{serde::ts_milliseconds, DateTime, NaiveDate, Utc}; +use chrono::NaiveDate; use kube::CustomResource; use mirrord_config::target::{Target, TargetConfig}; use schemars::JsonSchema; @@ -75,7 +75,6 @@ pub struct MirrordOperatorSpec { pub operator_version: String, pub default_namespace: String, pub license: LicenseInfoOwned, - pub telemetry_exports: Option, } #[derive(Clone, Debug, Default, Deserialize, Serialize, JsonSchema)] @@ -84,22 +83,6 @@ pub struct MirrordOperatorStatus { pub statistics: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize, JsonSchema)] -pub struct MirrordOperatorTelemetryReports { - pub id: String, - pub reports: Vec, -} - -#[derive(Clone, Debug, Default, Deserialize, Serialize, JsonSchema)] -pub struct MirrordOperatorTelemetryReport { - #[serde( - serialize_with = "ts_milliseconds::serialize", - deserialize_with = "ts_milliseconds::deserialize" - )] - pub timestamp: DateTime, - pub report: String, -} - #[derive(Clone, Debug, Default, Deserialize, Serialize, JsonSchema)] pub struct MirrordOperatorStatusStatistics { pub dau: usize,