Skip to content

engine: Handle pod crashes when there are multiple containers#1953

Merged
nicks merged 1 commit into
masterfrom
nicks/ch2905/crashes
Jul 31, 2019
Merged

engine: Handle pod crashes when there are multiple containers#1953
nicks merged 1 commit into
masterfrom
nicks/ch2905/crashes

Conversation

@nicks

@nicks nicks commented Jul 31, 2019

Copy link
Copy Markdown
Contributor

Hello @maiamcc,

Please review the following commits I made in branch nicks/ch2905/crashes:

5b59a49 (2019-07-31 12:14:03 -0400)
engine: Handle pod crashes when there are multiple containers

6b9f39d (2019-07-30 18:49:10 -0400)
podbuilder: by default, use the image ref name from the YAML rather than making one up

@nicks
nicks requested a review from maiamcc July 31, 2019 16:15
@nicks
nicks force-pushed the nicks/ch2905/crashes branch from 5b59a49 to 4179073 Compare July 31, 2019 20:03
Comment thread internal/engine/buildcontroller_test.go Outdated
assert.Equal(t, 2, len(ms.LiveUpdatedContainerIDs))
})

// Restart one container id but not the other.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think you mean "restart"...? maybe:

// Simulate pod event where one of the containers has been replaced

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT, "restart" is consistent with the terminology that Kubernetes uses

if you kill the main container process, Kubernetes creates a new container ID and increments the restartCount field to 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. That makes sense -- but fwiw I read "restart" like restart_container, i.e. it's the same container, we just re-exec the entrypoint. So i might consider replacing cuz that word has a different meaning in our codebase. but nbd

Comment thread internal/engine/pod.go Outdated
}
func checkForPodCrash(ctx context.Context, state *store.EngineState, ms *store.ManifestState, podInfo store.Pod) {

func checkForPodCrash(ctx context.Context, state *store.EngineState, mt *store.ManifestTarget) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we're not JUST checking for pod crash now -- it's pod-or-container-crash. idk what i'd rename it to tho

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to checkForContainerCrash

Comment thread internal/engine/upper.go
}

// Track the container ids that have been live-updated whether the
// build succeeds or fails.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...why would we track a live-updated CID if the build failed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the distinction we spent a long time talking about on the other PR. If a user Run step fails on a syntax error, that is normal and expected. The container files have still diverged

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh i see! well shoot, we don't return a result in that case :/ -- can you make a ticket for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// NOTE(maia): this is used only to populate ms.LiveUpdatedContainerID, and will
// be removed in http://bit.ly/2LFAPDb when we implement crash detection
// for multiple containers
func (set BuildResultSet) OneLiveUpdatedContainerIDForOldBehavior() container.ID {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

f.assertAllBuildsConsumed()
}

func TestCrashRebuildTwoContainersOneImage(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it worth testing the behavior when it's two containers on a single pod, each with a different image? should work the same, but maybe good for the sake of coverage.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thought that didn't work yet?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OH! yeah that building behavior doesn't work, you're right -- was imaging that you could directly set up the pod/build-result state. but that's probably not worth it. leave a todo for that test tho, and i'll fill it in

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicks
nicks force-pushed the nicks/ch2905/crashes branch from 4179073 to 4b940a3 Compare July 31, 2019 20:35
@nicks
nicks merged commit 175c2e7 into master Jul 31, 2019
@nicks
nicks deleted the nicks/ch2905/crashes branch July 31, 2019 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants