Skip to content

Commit

Permalink
Reverted deploy->deployment change (#2717)
Browse files Browse the repository at this point in the history
  • Loading branch information
Razz4780 authored Sep 3, 2024
1 parent 5788f90 commit 6eba624
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions changelog.d/+fix-target-url.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed urlfied form of target types.
25 changes: 14 additions & 11 deletions mirrord/operator/src/crd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use kube_target::{KubeTarget, UnknownTargetType};
pub use mirrord_config::feature::split_queues::QueueId;
use mirrord_config::{
feature::split_queues::{SplitQueuesConfig, SqsMessageFilter},
target::{Target, TargetConfig, TargetDisplay},
target::{Target, TargetConfig},
};
use schemars::JsonSchema;
use semver::Version;
Expand Down Expand Up @@ -46,17 +46,20 @@ impl TargetCrd {
/// `deploy.nginx.container.pyrex`;
///
/// It's used to connect to a resource through the operator.
///
/// # Warning
///
/// Do **not** change url paths here, even if the operator recognizes the other format.
/// It can break exisiting [`MirrordPolicy`]s (see [`MirrordPolicySpec::target_path`]).
pub fn urlfied_name(target: &Target) -> String {
let type_name = target.type_();

let (target, container) = match target {
Target::Deployment(target) => (&target.deployment, &target.container),
Target::Pod(target) => (&target.pod, &target.container),
Target::Rollout(target) => (&target.rollout, &target.container),
Target::Job(target) => (&target.job, &target.container),
Target::CronJob(target) => (&target.cron_job, &target.container),
Target::StatefulSet(target) => (&target.stateful_set, &target.container),
Target::Targetless => return type_name.to_string(),
let (type_name, target, container) = match target {
Target::Deployment(target) => ("deploy", &target.deployment, &target.container),
Target::Pod(target) => ("pod", &target.pod, &target.container),
Target::Rollout(target) => ("rollout", &target.rollout, &target.container),
Target::Job(target) => ("job", &target.job, &target.container),
Target::CronJob(target) => ("cronjob", &target.cron_job, &target.container),
Target::StatefulSet(target) => ("statefulset", &target.stateful_set, &target.container),
Target::Targetless => return TARGETLESS_TARGET_NAME.to_string(),
};

if let Some(container) = container {
Expand Down

0 comments on commit 6eba624

Please sign in to comment.