Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bcox termination msg #71

Merged
merged 3 commits into from
Feb 15, 2020
Merged

Bcox termination msg #71

merged 3 commits into from
Feb 15, 2020

Conversation

justnoise
Copy link
Contributor

This adds a termination log file into the unit. This is a bit lighter weight change than mounting a file into the unit (ala the kubelet). In addition to this change, I also allowed all units to enter the terminated state after the unit's process finishes running. This will allow us to implement gracefully falling back to logs for the termination message.

Units need to know more and more configuration info so I've moved securityContext, probes and termination message configuration into a single structure that's written into the unit (unitConfig)

Falling back to logs on error hasn't been implemented yet but I'm not incredibly concerned about that right now. I believe, with this change, we can easily add that later.

@justnoise justnoise requested a review from ldx February 12, 2020 18:04
Copy link
Contributor

@ldx ldx left a comment

Choose a reason for hiding this comment

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

👍

}
assert.Equal(t, tc.success, retVal, msg)
closer()
cancel()
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpicking: usually cancel() should be called via defer right after creating the context. Does not matter much here, since this is just a unit test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we're doing this in a loop, I wanted the cancel to be called at the end of the test case, not at the end of the function. Not sure what the usual/idiomatic way of handling this in a test is. Do you know how it's usually handled? I suppose deferring til the end of the function would work just as well and cleanup all created contexts when the test finished...

Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't really matter here, even if there was a chance for leaking it, since this is just a unit test. The rule is to always use defer cancel() right after creating it, but rules are meant to be broken...

pkg/server/unit.go Outdated Show resolved Hide resolved
@justnoise justnoise merged commit 65de9ae into master Feb 15, 2020
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