Skip to content

Commit

Permalink
Remove unused CRD for operator and remove false error (#1592)
Browse files Browse the repository at this point in the history
* Remove unused CRD for operator and don't error on missing operator credentials

* a

* ..

* ..

* ..
  • Loading branch information
aviramha authored Jun 29, 2023
1 parent f176056 commit ca413ce
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 48 deletions.
1 change: 1 addition & 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 changelog.d/+cleanup-operator.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove unused CRD for operator and don't error on missing operator credentials
1 change: 1 addition & 0 deletions mirrord/auth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion mirrord/auth/src/credential_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use tokio::{
fs,
io::{AsyncRead, AsyncReadExt, AsyncSeekExt, AsyncWrite, AsyncWriteExt, SeekFrom},
};
use tracing::info;

use crate::{
credentials::Credentials,
Expand Down Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions mirrord/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,6 @@ pub(super) enum OperatorCommand {
#[arg(short = 'f')]
config_file: Option<String>,
},
/// 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<String>,
},
}

#[derive(ValueEnum, Clone, Debug)]
Expand Down
20 changes: 0 additions & 20 deletions mirrord/cli/src/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,23 +150,6 @@ Operator License
Ok(())
}

async fn operator_telemetry_export(config: Option<String>) -> 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 {
Expand All @@ -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
}
}
}
19 changes: 1 addition & 18 deletions mirrord/operator/src/crd.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -75,7 +75,6 @@ pub struct MirrordOperatorSpec {
pub operator_version: String,
pub default_namespace: String,
pub license: LicenseInfoOwned,
pub telemetry_exports: Option<MirrordOperatorTelemetryReports>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize, JsonSchema)]
Expand All @@ -84,22 +83,6 @@ pub struct MirrordOperatorStatus {
pub statistics: Option<MirrordOperatorStatusStatistics>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize, JsonSchema)]
pub struct MirrordOperatorTelemetryReports {
pub id: String,
pub reports: Vec<MirrordOperatorTelemetryReport>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize, JsonSchema)]
pub struct MirrordOperatorTelemetryReport {
#[serde(
serialize_with = "ts_milliseconds::serialize",
deserialize_with = "ts_milliseconds::deserialize"
)]
pub timestamp: DateTime<Utc>,
pub report: String,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize, JsonSchema)]
pub struct MirrordOperatorStatusStatistics {
pub dau: usize,
Expand Down

0 comments on commit ca413ce

Please sign in to comment.