Skip to content

Commit

Permalink
k8s: fix log on container crash detected (#4527)
Browse files Browse the repository at this point in the history
Accidentally commented this out in prior commit. Note that this
directly writes to the log store since it can't practically
dispatch a `LogAction`.
  • Loading branch information
milas committed May 7, 2021
1 parent c65a498 commit acdf0f5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/engine/k8swatch/reducers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package k8swatch

import (
"context"
"fmt"
"time"

v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -168,9 +169,10 @@ func CheckForContainerCrash(state *store.EngineState, mt *store.ManifestTarget)
// The pod isn't what we expect!
ms.NeedsRebuildFromCrash = true
ms.LiveUpdatedContainerIDs = container.NewIDSet()
//msg := fmt.Sprintf("Detected a container change for %s. We could be running stale code. Rebuilding and deploying a new image.", ms.Name)
//le := store.NewLogAction(ms.Name, ms.LastBuild().SpanID, logger.WarnLvl, nil, []byte(msg+"\n"))
//handleLogAction(state, le)

msg := fmt.Sprintf("Detected a container change for %s. We could be running stale code. Rebuilding and deploying a new image.", ms.Name)
le := store.NewLogAction(ms.Name, ms.LastBuild().SpanID, logger.WarnLvl, nil, []byte(msg+"\n"))
state.LogStore.Append(le, state.Secrets)
}

// If there's more than one pod, prune the deleting/dead ones so
Expand Down

0 comments on commit acdf0f5

Please sign in to comment.