mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-02 02:02:24 +00:00
runtime: Add support for key annotations to remote hyp
In order to support different pod VM instance type via
remote hypervisor implementation (cloud-api-adaptor),
we need to pass machine_type, default_vcpus
and default_memory annotations to cloud-api-adaptor.
The cloud-api-adaptor then uses these annotations to spin
up the appropriate cloud instance.
Reference PR for cloud-api-adaptor
https://github.com/confidential-containers/cloud-api-adaptor/pull/1088
Fixes: #7140
Signed-off-by: Pradipta Banerjee <pradipta.banerjee@gmail.com>
(based on commit 004f07f076
)
This commit is contained in:
parent
2910e333a8
commit
39e8c84269
@ -1268,6 +1268,8 @@ func newRemoteHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
|||||||
|
|
||||||
// No valid value so avoid to append block device to list in kata_agent.appendDevices
|
// No valid value so avoid to append block device to list in kata_agent.appendDevices
|
||||||
BlockDeviceDriver: "dummy",
|
BlockDeviceDriver: "dummy",
|
||||||
|
EnableAnnotations: h.EnableAnnotations,
|
||||||
|
GuestHookPath: h.guestHookPath(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,11 +7,13 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
cri "github.com/containerd/containerd/pkg/cri/annotations"
|
cri "github.com/containerd/containerd/pkg/cri/annotations"
|
||||||
persistapi "github.com/kata-containers/kata-containers/src/runtime/pkg/hypervisors"
|
persistapi "github.com/kata-containers/kata-containers/src/runtime/pkg/hypervisors"
|
||||||
pb "github.com/kata-containers/kata-containers/src/runtime/protocols/hypervisor"
|
pb "github.com/kata-containers/kata-containers/src/runtime/protocols/hypervisor"
|
||||||
|
hypannotations "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/annotations"
|
||||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
|
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -72,6 +74,9 @@ func (rh *remoteHypervisor) CreateVM(ctx context.Context, id string, network Net
|
|||||||
annotations := map[string]string{}
|
annotations := map[string]string{}
|
||||||
annotations[cri.SandboxName] = hypervisorConfig.SandboxName
|
annotations[cri.SandboxName] = hypervisorConfig.SandboxName
|
||||||
annotations[cri.SandboxNamespace] = hypervisorConfig.SandboxNamespace
|
annotations[cri.SandboxNamespace] = hypervisorConfig.SandboxNamespace
|
||||||
|
annotations[hypannotations.MachineType] = hypervisorConfig.HypervisorMachineType
|
||||||
|
annotations[hypannotations.DefaultVCPUs] = strconv.FormatUint(uint64(hypervisorConfig.NumVCPUs()), 10)
|
||||||
|
annotations[hypannotations.DefaultMemory] = strconv.FormatUint(uint64(hypervisorConfig.MemorySize), 10)
|
||||||
|
|
||||||
req := &pb.CreateVMRequest{
|
req := &pb.CreateVMRequest{
|
||||||
Id: id,
|
Id: id,
|
||||||
|
Loading…
Reference in New Issue
Block a user