示例#1
0
def serialize_aggregated(latest_event, type):
    resource_version, labels, object = extract_values(latest_event, type)
    return build_entry('aggregated',
                       name=latest_event['name'],
                       resource_version=resource_version,
                       labels=labels,
                       object=object)
示例#2
0
def serialize_verified(object):
    return build_entry('verified',
                       name=object.metadata.name,
                       resource_version=float(
                           object.metadata.resource_version),
                       labels=object.metadata.labels,
                       object=object)
def serialize_verified(object):
    return build_entry('verified',
                       name=object.metadata.name,
                       namespace=object.metadata.namespace,
                       resource_version=float(
                           object.metadata.resource_version),
                       labels=object.metadata.labels,
                       storage_class=object.spec.storage_class_name,
                       object=object)
示例#4
0
def serialize_streamed(object, event, stable):
    return build_entry('streamed',
                       name=object.metadata.name,
                       resource_version=float(
                           object.metadata.resource_version),
                       labels=object.metadata.labels,
                       event=event,
                       object=object,
                       time=datetime_now(),
                       stable=stable)
def serialize_aggregated(latest_event, type):
    resource_version, labels, object, node, memory, cpu, gpu, pvcs = extract_values(
        latest_event, type)
    return build_entry('aggregated',
                       name=latest_event['name'],
                       namespace=latest_event['namespace'],
                       labels=labels,
                       resource_version=resource_version,
                       node=node,
                       memory=memory,
                       cpu=cpu,
                       gpu=gpu,
                       pvcs=pvcs,
                       object=object)
def serialize_verified(object):
    pvcs = []
    if object.spec.volumes:
        for volume in object.spec.volumes:
            pvc = volume.persistent_volume_claim
            pvcs.append(pvc.claim_name) if pvc else None
    resources = pod_resources_requested(object)
    return build_entry('verified',
                       name=object.metadata.name,
                       namespace=object.metadata.namespace,
                       resource_version=float(
                           object.metadata.resource_version),
                       labels=object.metadata.labels,
                       node=object.spec.node_name,
                       memory=resources.get('memory'),
                       cpu=resources.get('cpu'),
                       gpu=resources.get('gpu'),
                       pvcs=tuple(pvcs),
                       object=object)