Skip to content

Commit

Permalink
Add more context on statemanager logs (istio#1189)
Browse files Browse the repository at this point in the history
Ensure we always know what workload we are talking about
  • Loading branch information
howardjohn authored Jun 28, 2024
1 parent fa32afd commit 7d5724a
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/inpod/statemanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,18 @@ impl WorkloadProxyManagerState {
match msg {
WorkloadMessage::AddWorkload(poddata) => {
info!(
"pod {:?} received netns, starting proxy",
poddata.workload_uid
uid = poddata.workload_uid.0,
name = poddata
.workload_info
.as_ref()
.map(|w| w.name.as_str())
.unwrap_or_default(),
namespace = poddata
.workload_info
.as_ref()
.map(|w| w.namespace.as_str())
.unwrap_or_default(),
"pod received, starting proxy",
);
if !self.snapshot_received {
self.snapshot_names.insert(poddata.workload_uid.clone());
Expand All @@ -127,7 +137,10 @@ impl WorkloadProxyManagerState {
.map_err(Error::ProxyError)
}
WorkloadMessage::KeepWorkload(workload_uid) => {
info!("pod keep received. will not delete it when snapshot is sent");
info!(
uid = workload_uid.0,
"pod keep received. will not delete it when snapshot is sent"
);
if self.snapshot_received {
// this can only happen before snapshot is received.
return Err(Error::ProtocolError(
Expand All @@ -138,7 +151,7 @@ impl WorkloadProxyManagerState {
Ok(())
}
WorkloadMessage::DelWorkload(workload_uid) => {
info!("pod delete request, draining proxy");
info!(uid = workload_uid.0, "pod delete request, draining proxy");
if !self.snapshot_received {
// TODO: consider if this is an error. if not, do this instead:
// self.snapshot_names.remove(&workload_uid)
Expand Down

0 comments on commit 7d5724a

Please sign in to comment.