Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow reusing copy targets #2185

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 16 additions & 14 deletions mirrord/operator/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,14 @@
}
version_progress.success(None);

let raw_target = operator_api.fetch_target().await?;

let target_to_connect = if config.feature.copy_target.enabled {
let target_name = &operator_api.target_config.path;
let target = target_name
.as_ref()
.ok_or_else(|| OperatorApiError::InvalidTarget {
reason: "copy target feature is enabled, but target is not set".into(),
})?;

let mut copy_progress = progress.subtask("copying target");

if config.feature.copy_target.scale_down {
Expand All @@ -300,12 +305,17 @@
}

let copied = operator_api
.copy_target(&metadata, raw_target, config.feature.copy_target.scale_down)
.copy_target(
&metadata,
target.clone(),
config.feature.copy_target.scale_down,
)
.await?;
copy_progress.success(None);

OperatorSessionTarget::Copied(copied)
} else {
let raw_target = operator_api.fetch_target().await?;
OperatorSessionTarget::Raw(raw_target)
};

Expand Down Expand Up @@ -537,21 +547,13 @@
async fn copy_target(
&self,
session_metadata: &OperatorSessionMetadata,
target: TargetCrd,
target: Target,
scale_down: bool,
) -> Result<CopyTargetCrd> {
let raw_target = target
.spec
.target
.clone()
.ok_or(OperatorApiError::InvalidTarget {
reason: "copy target feature is not compatible with targetless mode".into(),
})?;

let requested = CopyTargetCrd::new(
&target.name(),
&TargetCrd::target_name(&target),
CopyTargetSpec {
target: raw_target,
target: target,

Check failure on line 556 in mirrord/operator/src/client.rs

View workflow job for this annotation

GitHub Actions / lint

redundant field names in struct initialization

Check failure on line 556 in mirrord/operator/src/client.rs

View workflow job for this annotation

GitHub Actions / macos_tests

redundant field names in struct initialization
idle_ttl: Some(Self::COPIED_POD_IDLE_TTL),
scale_down,
},
Expand Down