From 1be0cfd59f744266896e16a09f834a57bf5f8564 Mon Sep 17 00:00:00 2001 From: Razz4780 Date: Fri, 3 Nov 2023 16:19:46 +0100 Subject: [PATCH] warning when target is not a deployment --- mirrord/operator/src/client.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/mirrord/operator/src/client.rs b/mirrord/operator/src/client.rs index 0c18ee77970..8cffdb2c8fa 100644 --- a/mirrord/operator/src/client.rs +++ b/mirrord/operator/src/client.rs @@ -9,7 +9,9 @@ use mirrord_auth::{ certificate::Certificate, credential_store::CredentialStoreSync, error::AuthenticationError, }; use mirrord_config::{ - feature::network::incoming::ConcurrentSteal, target::TargetConfig, LayerConfig, + feature::network::incoming::ConcurrentSteal, + target::{Target, TargetConfig}, + LayerConfig, }; use mirrord_kube::{ api::kubernetes::{create_kube_api, get_k8s_resource_api}, @@ -245,6 +247,16 @@ impl OperatorApi { let target_to_connect = if config.feature.copy_target.enabled { let mut copy_progress = progress.subtask("copying target"); + + if config.feature.copy_target.scale_down { + let is_deployment = matches!(config.target.path, Some(Target::Deployment(..))); + if !is_deployment { + progress.warning( + "cannot scale down while copying target - target is not a deployment", + ) + } + } + let copied = operator_api .copy_target(&metadata, raw_target, config.feature.copy_target.scale_down) .await?;