Skip to content

Commit

Permalink
Report port locks and http filters in operator status (#2175)
Browse files Browse the repository at this point in the history
* Report port locks and http filters in operator status

* ..

* ..

* changelog
  • Loading branch information
infiniteregrets authored Jan 19, 2024
1 parent 1d70049 commit 7f31a60
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/+report-locks.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Report port locks and filters in operator status
22 changes: 22 additions & 0 deletions mirrord/cli/src/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,37 @@ Operator License
"Target",
"Namespace",
"User",
"Ports",
"Session Duration"
]);

for session in &status.sessions {
let locked_ports = session
.locked_ports
.as_deref()
.map(|ports| {
ports
.iter()
.map(|(port, type_, filter)| {
format!(
"Port: {port}, Type: {type_}{}",
filter
.as_ref()
.map(|f| format!(", Filter: {}", f))
.unwrap_or_default()
)
})
.collect::<Vec<_>>()
.join("\n")
})
.unwrap_or_default();

sessions.add_row(row![
session.id.as_deref().unwrap_or(""),
&session.target,
session.namespace.as_deref().unwrap_or("N/A"),
&session.user,
locked_ports,
humantime::format_duration(Duration::from_secs(session.duration_secs)),
]);
}
Expand Down
1 change: 1 addition & 0 deletions mirrord/operator/src/crd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ pub struct Session {
pub user: String,
pub target: String,
pub namespace: Option<String>,
pub locked_ports: Option<Vec<(u16, String, Option<String>)>>,
}

#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
Expand Down

0 comments on commit 7f31a60

Please sign in to comment.