-
Notifications
You must be signed in to change notification settings - Fork 297
Support for starting confidential containers #2495
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
Changes from all commits
d7d4e41
304f2ce
61b1bd4
c9a2cb9
e48451f
11fd4bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -338,7 +338,11 @@ func (b *Bridge) modifySettings(req *request) (err error) { | |
|
|
||
| case guestresource.ResourceTypeWCOWBlockCims: | ||
| // This is request to mount the merged cim at given volumeGUID | ||
| wcowBlockCimMounts := modifyGuestSettingsRequest.Settings.(*guestresource.WCOWBlockCIMMounts) | ||
| if modifyGuestSettingsRequest.RequestType == guestrequest.RequestTypeRemove { | ||
| return fmt.Errorf("not implemented") | ||
| } | ||
|
|
||
| wcowBlockCimMounts := modifyGuestSettingsRequest.Settings.(*guestresource.CWCOWBlockCIMMounts) | ||
| log.G(ctx).Tracef("WCOWBlockCIMMounts { %v}", wcowBlockCimMounts) | ||
|
|
||
| // The block device takes some time to show up. Wait for a few seconds. | ||
|
|
@@ -386,6 +390,11 @@ func (b *Bridge) modifySettings(req *request) (err error) { | |
| return nil | ||
|
|
||
| case guestresource.ResourceTypeCWCOWCombinedLayers: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ambarve As discussed, this was added intentionally. It is just logging in this commit, but my changes need containerID and is being used for enforcement. Please revert this commit. |
||
|
|
||
| if modifyGuestSettingsRequest.RequestType == guestrequest.RequestTypeRemove { | ||
| return fmt.Errorf("not implemented") | ||
| } | ||
|
|
||
| settings := modifyGuestSettingsRequest.Settings.(*guestresource.CWCOWCombinedLayers) | ||
| containerID := settings.ContainerID | ||
| log.G(ctx).Tracef("CWCOWCombinedLayers:: ContainerID: %v, ContainerRootPath: %v, Layers: %v, ScratchPath: %v", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -456,9 +456,9 @@ func (h *Host) CreateContainer(ctx context.Context, id string, settings *prot.VM | |
| // containing the files is exposed via UVM_SECURITY_CONTEXT_DIR env var. | ||
| // It may be an error to have a security policy but not expose it to the | ||
| // container as in that case it can never be checked as correct by a verifier. | ||
| if oci.ParseAnnotationsBool(ctx, settings.OCISpecification.Annotations, annotations.UVMSecurityPolicyEnv, true) { | ||
| if oci.ParseAnnotationsBool(ctx, settings.OCISpecification.Annotations, annotations.LCOWSecurityPolicyEnv, true) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There will need to be code exactly like this in the WCOW case too. As I mentioned elsewhere, this is likely a local scope annotation and we should have the same for both and not have duplicate code.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (also not a blocker) |
||
| encodedPolicy := h.securityPolicyEnforcer.EncodedSecurityPolicy() | ||
| hostAMDCert := settings.OCISpecification.Annotations[annotations.HostAMDCertificate] | ||
| hostAMDCert := settings.OCISpecification.Annotations[annotations.LCOWHostAMDCertificate] | ||
| if len(encodedPolicy) > 0 || len(hostAMDCert) > 0 || len(h.uvmReferenceInfo) > 0 { | ||
| // Use os.MkdirTemp to make sure that the directory is unique. | ||
| securityContextDir, err := os.MkdirTemp(settings.OCISpecification.Root.Path, securitypolicy.SecurityContextDirTemplate) | ||
|
|
||
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.
@ambarve Thanks for the changes. What about
RequestTypeAdd? Is it because the default Request type is Add? I understood from our discussion that you would add a no-op (for now) for both types.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.
The types are either Add or Remove. We do want the current handling to happen for Add. When I add the implementation for Remove (in a separate PR), I will restructure the code a bit better for to have a switch case on the type of request.
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.
Ok. I think you want the current handling only on
RequestTypeAddtype and not onRequestTypeRemove. So a switch case is necessary - a separate PR sounds good.