-
Notifications
You must be signed in to change notification settings - Fork 141
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
support setting oom_score_adj #176
Conversation
@mrunalp , PTAL. |
930108c
to
8e409e5
Compare
Hmm. Is there a way to clear oom_score_adj with this interface? Does
IntFlag support explicitly setting a nil value (e.g. ‘--oom-score-adj=’
with no argument).
|
IIRC, =FALSE works for setting nil value. |
@wking nvm, I misunderstood your question. |
LGTM |
On Tue, Aug 02, 2016 at 02:25:07PM -0700, Mrunal Patel wrote:
I haven't tested =FALSE, but I think we want to figure out how we |
@@ -58,6 +58,7 @@ var generateFlags = []cli.Flag{ | |||
cli.StringSliceFlag{Name: "seccomp-errno", Usage: "specifies syscalls to be added to list that returns an error"}, | |||
cli.StringFlag{Name: "template", Usage: "base template to use for creating the configuration"}, | |||
cli.StringSliceFlag{Name: "label", Usage: "add annotations to the configuration e.g. key=value"}, | |||
cli.IntFlag{Name: "oom-score-adj", Usage: "specify oom_score_adj for the container"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specify->specifies
I think usage should keep same with man
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mashimiao , I was struggling with this when I made the change.
The man doc always use specifies
, adds
, uses
. However, most of flags defined in cmd/ocitools/generate.go are using specify,
add,
use`.
I will first change it to a phrase
instead of a verb + a noun
.
@wking, I am not sure what do you really want here. |
Signed-off-by: Haiyan Meng <hmeng@redhat.com>
8e409e5
to
1915407
Compare
@mrunalp , @Mashimiao , PTAL. |
Still LGTM |
GitHub seems to have eaten my emailed comment, so re-posting via the web UI: On Wed, Aug 03, 2016 at 07:36:34AM -0700, hmeng-19 wrote:
But I want a way to set the |
On Wed, Aug 03, 2016 at 07:36:34AM -0700, hmeng-19 wrote:
$ ./ocitools generate --template <(echo '{"linux": {"resources": {"oomScoreAdj": 5}}}') --oom-score-adj 0 | jq .linux But I want a way to set the |
@wking , first I am not sure we want to support the use cases you pointed out or not. If I understand correctly, you want to remove some fields from a template completely. Right? I would suggest always feed the minimal config.json as the template, and then only add new fields into it. If you really want to remove fields from a template, then we probably should add some new flags like |
@wking , it seems github was slow this morning. I noticed there was a 40 minutes delay before I got gmail notifications for others' comments. |
On Wed, Aug 03, 2016 at 10:56:48AM -0700, hmeng-19 wrote:
I think ‘ocitools generate --template ...’ is positioning itself to be
That's one approach, and the implementation might be more
With jq being a convenient, generic solution to config edits, I think |
@mrunalp , how do you think about this? |
Yes. But, it shouldn't block PRs while we figure it out as starting with minimal config.json is a workaround.
I think it would be good if we avoid adding new flags, but I don't see how --abc= will work for setting to nil unless the library we are using supports it by special treating some text like NIL to mean make it nil. |
@wking , I tried to use the
|
On Wed, Aug 03, 2016 at 11:40:01AM -0700, Mrunal Patel wrote:
I think that means we want to use a StringFlag here and add our own |
@wking , I would suggest we first merge PR. |
On Wed, Aug 03, 2016 at 12:02:36PM -0700, hmeng-19 wrote:
If you like. I don't see much need to push this through if we already |
@mrunalp , I think we can merge this PR for now, so that we can vendor it into ocid to set up oom_score_adj. |
@wking By using StringFlag we lose some of the checks that we get from the CLI library. |
On Wed, Aug 03, 2016 at 03:37:05PM -0700, Mrunal Patel wrote:
So put the checks in our helper? Are the checks really that |
@wking Yeah, we could look into that. We can open an issue to track this. |
LGTM (we can figure out the CLI conversion on the side). |
Signed-off-by: Haiyan Meng <hmeng@redhat.com> Backported to v1.0.0.rc1 from 1915407 opencontainers#176 (cherry-pick applied cleanly). Signed-off-by: W. Trevor King <wking@tremily.us>
* v1.0.0.rc1: man/ocitools.1: Replace "**...(1)**" with "**...**(1)" add namespace check for uid/gid mappings validation: add linux resource check add label manpage and fix help support setting oom_score_adj generate: fix mount-cgroups bug completions: update based on generate help message update urfave/cli package to v1.18.0 generate: optimize namespace setup log and fix manpage change param type of AddProcessAdditionalGid remove unnecessary return error value Modify generate API Add Travis CI badge to README generate: fix capability.List() for cap_last_cap not exist generate: remove unnecessary spec initialization generate: fix tmpfs adding based on manpage Check CAP_LAST_CAP while setting privileged generate: Remove superfluous err check from Save Signed-off-by: W. Trevor King <wking@tremily.us> Conflicts: cmd/ocitools/generate.go man/ocitools-generate.1.md The conflicts are because: * support setting oom_score_adj (opencontainers#176, opencontainers#185) * add label manpage and fix help (opencontainers#189, opencontainers#190) have landed in master and been backported to v1.0.0.rc1 since this branch split from master. They wouldn't have happend if I'd rebased this branch on the current master before merging v1.0.0.rc1, but then I'd have to repeat the initial dance done with eac0762 (Merge commit '30e2ea2', 2016-08-02) and b45bebd (Merge commit '6acca9e', 2016-08-02).
Signed-off-by: Haiyan Meng hmeng@redhat.com