-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for ReplicaSet targets (#3049)
* Added services and replicasets to mirrord ls output * Added replicaset variant * Updated schema and configuration.md * Changelog * Fix operator setup * Update mirrord/config/src/target.rs Co-authored-by: meowjesty <[email protected]> --------- Co-authored-by: meowjesty <[email protected]>
- Loading branch information
Showing
13 changed files
with
252 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added Kubernetes ReplicaSet as a new target type. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use std::str::Split; | ||
|
||
use schemars::JsonSchema; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::{FromSplit, FAIL_PARSE_DEPLOYMENT_OR_POD}; | ||
use crate::config::{ConfigError, Result}; | ||
|
||
#[derive(Serialize, Deserialize, Clone, Eq, PartialEq, Hash, Debug, JsonSchema)] | ||
#[serde(deny_unknown_fields)] | ||
pub struct ReplicaSetTarget { | ||
pub replica_set: String, | ||
pub container: Option<String>, | ||
} | ||
|
||
impl FromSplit for ReplicaSetTarget { | ||
fn from_split(split: &mut Split<char>) -> Result<Self> { | ||
let replica_set = split | ||
.next() | ||
.ok_or_else(|| ConfigError::InvalidTarget(FAIL_PARSE_DEPLOYMENT_OR_POD.to_string()))?; | ||
match (split.next(), split.next()) { | ||
(Some("container"), Some(container)) => Ok(Self { | ||
replica_set: replica_set.to_string(), | ||
container: Some(container.to_string()), | ||
}), | ||
(None, None) => Ok(Self { | ||
replica_set: replica_set.to_string(), | ||
container: None, | ||
}), | ||
_ => Err(ConfigError::InvalidTarget( | ||
FAIL_PARSE_DEPLOYMENT_OR_POD.to_string(), | ||
)), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.