示例#1
0
func (self *hyperContainerHandler) GetSpec() (info.ContainerSpec, error) {
	var spec info.ContainerSpec

	podInfo, err := self.client.GetPod(self.podID)
	if err != nil {
		return spec, err
	}

	startedAt, err := parseTimeString(podInfo.Status.StartTime)
	if err != nil {
		return spec, err
	}
	spec.CreationTime = startedAt

	spec.Cpu = info.CpuSpec{Limit: uint64(1024 * podInfo.Spec.Vcpu)}
	spec.HasCpu = true

	spec.Memory = info.MemorySpec{Limit: uint64(1024 * 1024 * podInfo.Spec.Memory)}
	spec.HasMemory = true

	spec.HasDiskIo = true
	spec.HasNetwork = true
	spec.HasCustomMetrics = false

	spec.Labels = podInfo.Spec.Labels

	return spec, nil
}