Extend pod resource API response to return the memory manager information

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>

Kubernetes-commit: 24023f9fcc7a2031d81a53add1e0054319f0b0f0
This commit is contained in:
Artyom Lukianov 2021-04-05 17:15:36 +03:00 committed by Kubernetes Publisher
parent e3f96a5805
commit 93cd3d97e3
2 changed files with 462 additions and 34 deletions

View File

@ -86,6 +86,7 @@ var xxx_messageInfo_AllocatableResourcesRequest proto.InternalMessageInfo
type AllocatableResourcesResponse struct {
Devices []*ContainerDevices `protobuf:"bytes,1,rep,name=devices,proto3" json:"devices,omitempty"`
CpuIds []int64 `protobuf:"varint,2,rep,packed,name=cpu_ids,json=cpuIds,proto3" json:"cpu_ids,omitempty"`
Memory []*ContainerMemory `protobuf:"bytes,3,rep,name=memory,proto3" json:"memory,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_sizecache int32 `json:"-"`
}
@ -136,6 +137,13 @@ func (m *AllocatableResourcesResponse) GetCpuIds() []int64 {
return nil
}
func (m *AllocatableResourcesResponse) GetMemory() []*ContainerMemory {
if m != nil {
return m.Memory
}
return nil
}
// ListPodResourcesRequest is the request made to the PodResourcesLister service
type ListPodResourcesRequest struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -287,6 +295,7 @@ type ContainerResources struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Devices []*ContainerDevices `protobuf:"bytes,2,rep,name=devices,proto3" json:"devices,omitempty"`
CpuIds []int64 `protobuf:"varint,3,rep,packed,name=cpu_ids,json=cpuIds,proto3" json:"cpu_ids,omitempty"`
Memory []*ContainerMemory `protobuf:"bytes,4,rep,name=memory,proto3" json:"memory,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_sizecache int32 `json:"-"`
}
@ -344,6 +353,75 @@ func (m *ContainerResources) GetCpuIds() []int64 {
return nil
}
func (m *ContainerResources) GetMemory() []*ContainerMemory {
if m != nil {
return m.Memory
}
return nil
}
// ContainerMemory contains information about memory and hugepages assigned to a container
type ContainerMemory struct {
MemoryType string `protobuf:"bytes,1,opt,name=memory_type,json=memoryType,proto3" json:"memory_type,omitempty"`
Size_ uint64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
Topology *TopologyInfo `protobuf:"bytes,3,opt,name=topology,proto3" json:"topology,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ContainerMemory) Reset() { *m = ContainerMemory{} }
func (*ContainerMemory) ProtoMessage() {}
func (*ContainerMemory) Descriptor() ([]byte, []int) {
return fileDescriptor_00212fb1f9d3bf1c, []int{6}
}
func (m *ContainerMemory) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *ContainerMemory) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_ContainerMemory.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *ContainerMemory) XXX_Merge(src proto.Message) {
xxx_messageInfo_ContainerMemory.Merge(m, src)
}
func (m *ContainerMemory) XXX_Size() int {
return m.Size()
}
func (m *ContainerMemory) XXX_DiscardUnknown() {
xxx_messageInfo_ContainerMemory.DiscardUnknown(m)
}
var xxx_messageInfo_ContainerMemory proto.InternalMessageInfo
func (m *ContainerMemory) GetMemoryType() string {
if m != nil {
return m.MemoryType
}
return ""
}
func (m *ContainerMemory) GetSize_() uint64 {
if m != nil {
return m.Size_
}
return 0
}
func (m *ContainerMemory) GetTopology() *TopologyInfo {
if m != nil {
return m.Topology
}
return nil
}
// ContainerDevices contains information about the devices assigned to a container
type ContainerDevices struct {
ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"`
@ -356,7 +434,7 @@ type ContainerDevices struct {
func (m *ContainerDevices) Reset() { *m = ContainerDevices{} }
func (*ContainerDevices) ProtoMessage() {}
func (*ContainerDevices) Descriptor() ([]byte, []int) {
return fileDescriptor_00212fb1f9d3bf1c, []int{6}
return fileDescriptor_00212fb1f9d3bf1c, []int{7}
}
func (m *ContainerDevices) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -416,7 +494,7 @@ type TopologyInfo struct {
func (m *TopologyInfo) Reset() { *m = TopologyInfo{} }
func (*TopologyInfo) ProtoMessage() {}
func (*TopologyInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_00212fb1f9d3bf1c, []int{7}
return fileDescriptor_00212fb1f9d3bf1c, []int{8}
}
func (m *TopologyInfo) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -462,7 +540,7 @@ type NUMANode struct {
func (m *NUMANode) Reset() { *m = NUMANode{} }
func (*NUMANode) ProtoMessage() {}
func (*NUMANode) Descriptor() ([]byte, []int) {
return fileDescriptor_00212fb1f9d3bf1c, []int{8}
return fileDescriptor_00212fb1f9d3bf1c, []int{9}
}
func (m *NUMANode) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -505,6 +583,7 @@ func init() {
proto.RegisterType((*ListPodResourcesResponse)(nil), "v1.ListPodResourcesResponse")
proto.RegisterType((*PodResources)(nil), "v1.PodResources")
proto.RegisterType((*ContainerResources)(nil), "v1.ContainerResources")
proto.RegisterType((*ContainerMemory)(nil), "v1.ContainerMemory")
proto.RegisterType((*ContainerDevices)(nil), "v1.ContainerDevices")
proto.RegisterType((*TopologyInfo)(nil), "v1.TopologyInfo")
proto.RegisterType((*NUMANode)(nil), "v1.NUMANode")
@ -513,37 +592,41 @@ func init() {
func init() { proto.RegisterFile("api.proto", fileDescriptor_00212fb1f9d3bf1c) }
var fileDescriptor_00212fb1f9d3bf1c = []byte{
// 480 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xcd, 0x6e, 0xd3, 0x40,
0x10, 0x80, 0xb3, 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 0x01, 0xda, 0x5c, 0x62, 0x79, 0x23, 0x22, 0xa3, 0xa7, 0xb0, 0x55, 0x4a,
0xf4, 0xa0, 0xcc, 0x77, 0xc3, 0x49, 0x75, 0x7b, 0x9b, 0x61, 0x75, 0x54, 0xac, 0x45, 0x3f, 0x42,
0xe7, 0x95, 0xc8, 0x37, 0x5d, 0x3e, 0x7d, 0x54, 0x86, 0xfe, 0xe7, 0xc9, 0x74, 0xdd, 0x9b, 0x1d,
0xea, 0xfc, 0x2f, 0x7b, 0x97, 0x57, 0x0e, 0xf9, 0x75, 0xe5, 0xb4, 0xbe, 0xce, 0x1d, 0x72, 0x39,
0x77, 0xc8, 0xcf, 0xb9, 0x43, 0x7e, 0xcf, 0x1d, 0xf2, 0xfd, 0x8f, 0xd3, 0x9a, 0x6c, 0xeb, 0xa7,
0xf9, 0xec, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6f, 0x70, 0xd4, 0x4f, 0xda, 0x03, 0x00, 0x00,
// 539 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xc1, 0x6e, 0xd3, 0x40,
0x10, 0xed, 0xda, 0x21, 0x6d, 0xa6, 0x29, 0x54, 0x0b, 0x22, 0x26, 0x4d, 0xdd, 0xc8, 0x5c, 0x22,
0x01, 0xae, 0x1a, 0x04, 0xf7, 0xd2, 0x48, 0x28, 0x12, 0x8d, 0x60, 0x55, 0xae, 0x44, 0x8e, 0xbd,
0x0d, 0x96, 0x12, 0xef, 0xe2, 0x5d, 0x47, 0x84, 0x13, 0x07, 0x3e, 0x80, 0x03, 0x67, 0xfe, 0x83,
0x3f, 0xe8, 0x91, 0x23, 0x47, 0x1a, 0x7e, 0x04, 0xed, 0xda, 0x4e, 0x9d, 0x26, 0x01, 0xf5, 0xe4,
0xd9, 0x79, 0x33, 0xb3, 0x6f, 0xe6, 0x8d, 0x17, 0x2a, 0x1e, 0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xaa, 0xde, 0x9a,
0xb5, 0xaf, 0x37, 0x56, 0x83, 0xe9, 0xe2, 0x3b, 0x1b, 0xf8, 0x1d, 0xd4, 0x5e, 0x52, 0xb9, 0xea,
0x57, 0xc6, 0x07, 0x2a, 0xf5, 0x1f, 0x8f, 0x40, 0xbd, 0xb9, 0x3e, 0x20, 0xaf, 0xff, 0xa2, 0x71,
0x71, 0x69, 0xa3, 0x5f, 0x97, 0xf6, 0xc6, 0xe7, 0x99, 0x8d, 0x2e, 0x66, 0x36, 0xfa, 0x39, 0xb3,
0xd1, 0xef, 0x99, 0x8d, 0xbe, 0xfe, 0xb1, 0x37, 0x06, 0x65, 0xfd, 0xd8, 0x3c, 0xfd, 0x1b, 0x00,
0x00, 0xff, 0xff, 0x43, 0x46, 0x5d, 0x7f, 0xac, 0x04, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -705,6 +788,20 @@ func (m *AllocatableResourcesResponse) MarshalToSizedBuffer(dAtA []byte) (int, e
_ = i
var l int
_ = l
if len(m.Memory) > 0 {
for iNdEx := len(m.Memory) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Memory[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintApi(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
}
}
if len(m.CpuIds) > 0 {
dAtA2 := make([]byte, len(m.CpuIds)*10)
var j1 int
@ -872,6 +969,20 @@ func (m *ContainerResources) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.Memory) > 0 {
for iNdEx := len(m.Memory) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Memory[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintApi(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
}
}
if len(m.CpuIds) > 0 {
dAtA4 := make([]byte, len(m.CpuIds)*10)
var j3 int
@ -915,6 +1026,53 @@ func (m *ContainerResources) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *ContainerMemory) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ContainerMemory) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ContainerMemory) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Topology != nil {
{
size, err := m.Topology.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintApi(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
}
if m.Size_ != 0 {
i = encodeVarintApi(dAtA, i, uint64(m.Size_))
i--
dAtA[i] = 0x10
}
if len(m.MemoryType) > 0 {
i -= len(m.MemoryType)
copy(dAtA[i:], m.MemoryType)
i = encodeVarintApi(dAtA, i, uint64(len(m.MemoryType)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *ContainerDevices) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@ -1070,6 +1228,12 @@ func (m *AllocatableResourcesResponse) Size() (n int) {
}
n += 1 + sovApi(uint64(l)) + l
}
if len(m.Memory) > 0 {
for _, e := range m.Memory {
l = e.Size()
n += 1 + l + sovApi(uint64(l))
}
}
return n
}
@ -1143,6 +1307,32 @@ func (m *ContainerResources) Size() (n int) {
}
n += 1 + sovApi(uint64(l)) + l
}
if len(m.Memory) > 0 {
for _, e := range m.Memory {
l = e.Size()
n += 1 + l + sovApi(uint64(l))
}
}
return n
}
func (m *ContainerMemory) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.MemoryType)
if l > 0 {
n += 1 + l + sovApi(uint64(l))
}
if m.Size_ != 0 {
n += 1 + sovApi(uint64(m.Size_))
}
if m.Topology != nil {
l = m.Topology.Size()
n += 1 + l + sovApi(uint64(l))
}
return n
}
@ -1220,9 +1410,15 @@ func (this *AllocatableResourcesResponse) String() string {
repeatedStringForDevices += strings.Replace(f.String(), "ContainerDevices", "ContainerDevices", 1) + ","
}
repeatedStringForDevices += "}"
repeatedStringForMemory := "[]*ContainerMemory{"
for _, f := range this.Memory {
repeatedStringForMemory += strings.Replace(f.String(), "ContainerMemory", "ContainerMemory", 1) + ","
}
repeatedStringForMemory += "}"
s := strings.Join([]string{`&AllocatableResourcesResponse{`,
`Devices:` + repeatedStringForDevices + `,`,
`CpuIds:` + fmt.Sprintf("%v", this.CpuIds) + `,`,
`Memory:` + repeatedStringForMemory + `,`,
`}`,
}, "")
return s
@ -1277,10 +1473,28 @@ func (this *ContainerResources) String() string {
repeatedStringForDevices += strings.Replace(f.String(), "ContainerDevices", "ContainerDevices", 1) + ","
}
repeatedStringForDevices += "}"
repeatedStringForMemory := "[]*ContainerMemory{"
for _, f := range this.Memory {
repeatedStringForMemory += strings.Replace(f.String(), "ContainerMemory", "ContainerMemory", 1) + ","
}
repeatedStringForMemory += "}"
s := strings.Join([]string{`&ContainerResources{`,
`Name:` + fmt.Sprintf("%v", this.Name) + `,`,
`Devices:` + repeatedStringForDevices + `,`,
`CpuIds:` + fmt.Sprintf("%v", this.CpuIds) + `,`,
`Memory:` + repeatedStringForMemory + `,`,
`}`,
}, "")
return s
}
func (this *ContainerMemory) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&ContainerMemory{`,
`MemoryType:` + fmt.Sprintf("%v", this.MemoryType) + `,`,
`Size_:` + fmt.Sprintf("%v", this.Size_) + `,`,
`Topology:` + strings.Replace(this.Topology.String(), "TopologyInfo", "TopologyInfo", 1) + `,`,
`}`,
}, "")
return s
@ -1519,6 +1733,40 @@ func (m *AllocatableResourcesResponse) Unmarshal(dAtA []byte) error {
} else {
return fmt.Errorf("proto: wrong wireType = %d for field CpuIds", wireType)
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Memory", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthApi
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthApi
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Memory = append(m.Memory, &ContainerMemory{})
if err := m.Memory[len(m.Memory)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipApi(dAtA[iNdEx:])
@ -1993,6 +2241,177 @@ func (m *ContainerResources) Unmarshal(dAtA []byte) error {
} else {
return fmt.Errorf("proto: wrong wireType = %d for field CpuIds", wireType)
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Memory", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthApi
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthApi
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Memory = append(m.Memory, &ContainerMemory{})
if err := m.Memory[len(m.Memory)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipApi(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthApi
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *ContainerMemory) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ContainerMemory: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ContainerMemory: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MemoryType", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthApi
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthApi
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MemoryType = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Size_", wireType)
}
m.Size_ = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Size_ |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Topology", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthApi
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthApi
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Topology == nil {
m.Topology = &TopologyInfo{}
}
if err := m.Topology.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipApi(dAtA[iNdEx:])

View File

@ -27,6 +27,7 @@ message AllocatableResourcesRequest {}
message AllocatableResourcesResponse {
repeated ContainerDevices devices = 1;
repeated int64 cpu_ids = 2;
repeated ContainerMemory memory = 3;
}
// ListPodResourcesRequest is the request made to the PodResourcesLister service
@ -49,6 +50,14 @@ message ContainerResources {
string name = 1;
repeated ContainerDevices devices = 2;
repeated int64 cpu_ids = 3;
repeated ContainerMemory memory = 4;
}
// ContainerMemory contains information about memory and hugepages assigned to a container
message ContainerMemory {
string memory_type = 1;
uint64 size = 2;
TopologyInfo topology = 3;
}
// ContainerDevices contains information about the devices assigned to a container