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

Label support #1862

Merged
merged 8 commits into from
May 20, 2017
Merged

Label support #1862

merged 8 commits into from
May 20, 2017

Conversation

justincormack
Copy link
Member

@justincormack justincormack commented May 19, 2017

Add support for using labels to specify the image configuration yaml, as done in moby/tool#39 - use org.mobyproject.config as the label with a JSON version of the yaml image config.

First example I have done sysctl, which I also converted to modern style build, and added a test to make sure it was still working correctly. I also added the test-sysctl one and poweroff to clean up the tests.

Once we do this elsewhere this will make the config files much simpler for the linuxkit images; external images will not have the correct labels.

dunnock_4185

This means Go code can use the same base image, which now includes Go tooling.

Signed-off-by: Justin Cormack <[email protected]>
@justincormack justincormack changed the title [WIP] Label support Label support May 19, 2017
@avsm
Copy link
Contributor

avsm commented May 19, 2017

From a Slack convo:

@avsm: does the old style still work? it was kind of nice to be able to grep for admin caps
@avsm: a CI could still add them (along with hashes) for a fully elaborated yaml file
@justincormack: yes putting config in the yaml overrides the label
@justincormack: you can also see the generated config if you use -v on build

@justincormack
Copy link
Member Author

cc @dave-tucker I changed the default command for poweroff to have a timeout of 3 but left overrides for the ones that were 10.

Copy link
Member

@dave-tucker dave-tucker left a comment

Choose a reason for hiding this comment

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

One nit otherwise LGTM

capabilities:
- CAP_SYS_BOOT
readonly: true
image: "linuxkit/poweroff:5673236900c6beae35bbceec90ded4b9add3f5ae"
Copy link
Member

Choose a reason for hiding this comment

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

Could you presvere the old behaviour by adding a 30 second delay here?

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm, but actually I didnt change the default, I should change back the other ones that were 3

Copy link
Member Author

Choose a reason for hiding this comment

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

oh yes I did but I shouldnt have, going to revert. It makes little sense having command in yaml as it is already in image

@justincormack
Copy link
Member Author

@dave-tucker they should be unchanged now

Copy link
Member

@rn rn left a comment

Choose a reason for hiding this comment

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

A few comments, but great to see config in labels and go-compile being phased out

CMD ["/usr/bin/sysctl"]
LABEL org.mobyproject.config='{"net": "host","pid": "host", "ipc": "host", "readonly": true, "capabilities": ["CAP_SYS_ADMIN"]}'
Copy link
Member

Choose a reason for hiding this comment

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

would it be possible to make this multi-line for better readability?

Copy link
Member Author

Choose a reason for hiding this comment

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

The advantage of this format is it is the only way to write something you can cut and paste as JSON, as it needs backslashes if it has line break. Hence the single quotes so the double ones don't need to be escaped.

Copy link
Member

Choose a reason for hiding this comment

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

OK, makes sense. escaping quotes makes this error prone and less readable

@@ -0,0 +1,37 @@
#!/bin/sh
# SUMMARY: LinuxKit security tests
Copy link
Member

Choose a reason for hiding this comment

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

not security tests

Copy link
Member Author

Choose a reason for hiding this comment

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

fixing


default: push

hash: Dockerfile check.sh
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason this package makefile is old-style rather than the new more compact form with git tree hash etc

Copy link
Member Author

Choose a reason for hiding this comment

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

all the test ones need redoing, was easier to leave this old style for now

Copy link
Member

Choose a reason for hiding this comment

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

Ok, agree best to re-do all the test ones new style in one PR

Signed-off-by: Justin Cormack <[email protected]>
And remove all the config options as they are now in the label.

Signed-off-by: Justin Cormack <[email protected]>
@rn
Copy link
Member

rn commented May 19, 2017

are you planning to convert the other packages using linuxkit/go-compile as well? Otherwise it's introducing more inconsistency while we should strive for more consistency...

@justincormack justincormack dismissed dave-tucker’s stale review May 19, 2017 21:13

fixed so unchanged now

@justincormack
Copy link
Member Author

@rneugeba yes, but didnt want to do anything else in the same PR its got enough in...

Copy link
Member

@dave-tucker dave-tucker left a comment

Choose a reason for hiding this comment

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

LGTM! 🎸

@justincormack justincormack merged commit a81a486 into linuxkit:master May 20, 2017
@justincormack justincormack deleted the label-support branch May 20, 2017 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants