mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-15 20:34:19 +01:00
runtime: Adds annotations for SEV/kbs controls at the pod level
Note: only for online-kbs configuration Fixes #5782 Signed-off-by: Jim Cadden <jcadden@ibm.com>
This commit is contained in:
@@ -456,6 +456,10 @@ func addHypervisorConfigOverrides(ocispec specs.Spec, config *vc.SandboxConfig,
|
||||
return err
|
||||
}
|
||||
|
||||
if err := addConfidentialComputingOverrides(ocispec, config); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if value, ok := ocispec.Annotations[vcAnnotations.MachineType]; ok {
|
||||
if value != "" {
|
||||
config.HypervisorConfig.HypervisorMachineType = value
|
||||
@@ -912,6 +916,29 @@ func addAgentConfigOverrides(ocispec specs.Spec, config *vc.SandboxConfig) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func addConfidentialComputingOverrides(ocispec specs.Spec, sbConfig *vc.SandboxConfig) error {
|
||||
|
||||
if err := newAnnotationConfiguration(ocispec, vcAnnotations.GuestPreAttestation).setBool(func(guestPreAttestation bool) {
|
||||
sbConfig.HypervisorConfig.GuestPreAttestation = guestPreAttestation
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if value, ok := ocispec.Annotations[vcAnnotations.GuestPreAttestationURI]; ok {
|
||||
if value != "" {
|
||||
sbConfig.HypervisorConfig.GuestPreAttestationURI = value
|
||||
}
|
||||
}
|
||||
|
||||
if err := newAnnotationConfiguration(ocispec, vcAnnotations.SEVGuestPolicy).setUint(func(sevGuestPolicy uint64) {
|
||||
sbConfig.HypervisorConfig.SEVGuestPolicy = uint32(sevGuestPolicy)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SandboxConfig converts an OCI compatible runtime configuration file
|
||||
// to a virtcontainers sandbox configuration structure.
|
||||
func SandboxConfig(ocispec specs.Spec, runtime RuntimeConfig, bundlePath, cid string, detach, systemdCgroup bool) (vc.SandboxConfig, error) {
|
||||
|
||||
Reference in New Issue
Block a user