-
Notifications
You must be signed in to change notification settings - Fork 347
Apply sandbox image config #48
Apply sandbox image config #48
Conversation
|
This PR passes sandbox and image CRI validation test: |
c6b9ac4 to
aa1ffe4
Compare
pkg/server/helpers.go
Outdated
| return &uid, "" | ||
| } | ||
|
|
||
| // getImageMetadata returns corresponding metadata of the image reference, if image is not |
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.
pulling the image makes getting metadata for the image expensive... Is there a use case for getting metadata for images that have not yet been pulled for containers?
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.
We need to pull image when running pod sandbox.
We may need a better function name here though.
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.
Sure as long as it's clear that this is a variant of an image pull... and not just a metadata retrieval.. that works!
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.
Yeah, will update the function name, probably something like ensureImage.
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.
Done. Updated the function name to ensureImageExists.
aa1ffe4 to
33f4f14
Compare
Signed-off-by: Lantao Liu <[email protected]>
33f4f14 to
4f6840c
Compare
pkg/server/helpers.go
Outdated
| // ensureImageExists returns corresponding metadata of the image reference, if image is not | ||
| // pulled yet, the function will pull the image when ensure is true, and return error when | ||
| // ensure if false. | ||
| func (c *criContainerdService) ensureImageExists(ctx context.Context, ref string, ensure bool) (*metadata.ImageMetadata, error) { |
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.
Can we break it up to two functions instead of relying on ensure to toggle the behavior? I think it's generally preferred making the functions more cohesive and easier to reuse.
You could also factor the logic the logic from 361 to 370 to check whether the image exists or not.
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.
Will do.
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.
Done.
pkg/server/helpers.go
Outdated
| if err == nil { | ||
| return meta, nil | ||
| } | ||
| if err != nil && !metadata.IsNotExistError(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.
Nit: no need to check err != nil because if err is nil, the code would've returned in line 368.
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.
Will do.
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.
Done.
|
@yujuhong Updated |
|
Close and reopen to trigger the test. |
|
LGTM |
Signed-off-by: Lantao Liu <[email protected]>
Signed-off-by: Lantao Liu <[email protected]>
a087112 to
6eb1ddb
Compare
|
Apply LGTM based on #48 (comment) Will merge after test passed. It seems that travis is overloaded. |
mikebrow
left a comment
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.
LGTM
…config Apply sandbox image config
Remove automange-vhd's on ContainerCreate failure
Based on #41 and #46.
This PR let sandbox container use pause image and applies image config.
Only the last commit is new. Will rebase the PR and previous PRs soon.