-
Notifications
You must be signed in to change notification settings - Fork 374
make sure kataAgent/createContainer can decode old specs.Spec #334
make sure kataAgent/createContainer can decode old specs.Spec #334
Conversation
4a3e33f
to
e195a6f
Compare
PSS Measurement: Memory inside container: |
Hi @keloyang - thanks for raising. However, I'm not clear why we need to support docker 1.11 since:
Also, note that this change breaks a number of the tests hence the CI failures. |
@jodh-intel thanks for your review. |
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.
@keloyang This looks good to me, but just want to make sure about functionality here. Do you get the expected capabilities inside your container with Docker 1.11 ?
Also, this might be worth adding a test to ensure that we get the expected list of capabilities listed as a vc.LinuxCapabilities
, no matter which spec version is used. This is important to make sure this PR solved an actual issue, and also to ensure this won't get broken later.
e195a6f
to
043fa5f
Compare
043fa5f
to
086d197
Compare
PSS Measurement: Memory inside container: |
@sboeuf I have added the test cases. PTAL |
PSS Measurement: Memory inside container: |
CI is failing on these:
I think they are real failing test cases, can you resolve this? |
c778371
to
29144d0
Compare
@WeiZhang555 fixed, thanks. |
PSS Measurement: Memory inside container: |
29144d0
to
1b592fa
Compare
PSS Measurement: Memory inside container: |
Looks like this broke with the kata-agent since the parsing is done in a couple of places now. I remember this working with clear-containers. |
cli/main_test.go
Outdated
@@ -421,7 +421,13 @@ func readOCIConfigFile(configPath string) (oci.CompatOCISpec, error) { | |||
if err := json.Unmarshal(data, &ociSpec); err != nil { | |||
return oci.CompatOCISpec{}, err | |||
} | |||
|
|||
if ociSpec.Process != nil { |
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.
I think it would be better to add this check for Process in containerCapabilities
function itself. If the process is nil, return empty capabilities in that function itself. You can avoid checking for nil value of Process at multiple places.
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.
If add the check in ContainerCapabilities, we don't know whether ociSpec.Process is nil, so we still need check outside of ContainerCapabilities.
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.
@amshinde what do you mean, like the following ?
caps, err := containerCapabilities(ocispec)
if err != nil {
return CompatOCISpec{}, err
}
ocispec.Process.Capabilities = caps
func containerCapabilities(s CompatOCISpec) (vc.LinuxCapabilities, error) {
if ocispec.Process == nil {
return vc.LinuxCapabilities{}, err
}
...
}
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.
I think @amshinde 's suggestion is right.
func containerCapabilities(s CompatOCISpec) (vc.LinuxCapabilities, error) {
if s.Process == nil {
return vc.LinuxCapabilities{}, nil
}
...
}
This is also necessary for avoiding contianerCapabilities()
to panic in case s.Process
is nil
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.
@keloyang Yes, basically what @WeiZhang555 pasted above.
@keloyang please rework as suggested by @WeiZhang555 and @amshinde. This LGTM when this will be done ! |
1b592fa
to
16bf8bf
Compare
Codecov Report
@@ Coverage Diff @@
## master #334 +/- ##
==========================================
+ Coverage 63.74% 63.89% +0.14%
==========================================
Files 87 87
Lines 8731 8633 -98
==========================================
- Hits 5566 5516 -50
+ Misses 2569 2532 -37
+ Partials 596 585 -11
Continue to review full report at Codecov.
|
ping @sboeuf @WeiZhang555 @amshinde |
16bf8bf
to
9a0434d
Compare
PSS Measurement: Memory inside container: |
Thanks @keloyang, this LGTM. I'm leaving the final words to @amshinde and @WeiZhang555 for merging this :) |
in old specs.Spec, Capabilities is [] string, but we don't use CompatOCISpec for compatibility in kataAgent/createContainer. fixes #333 Signed-off-by: y00316549 <yangshukui@huawei.com>
ping @WeiZhang555 @amshinde, PTAL, thanks. |
In old specs.Spec, Capabilities is [] string, but we don't use CompatOCISpec for compatibility in kataAgent/createContainer, it lead to docker-1.11.2 failed to start kata-container, this pr will fix this.
before this pr,
after this pr