Files
PandaX/apps/devops/entity/k8s/node.go
2022-01-22 17:07:04 +08:00

113 lines
4.4 KiB
Go

package k8s
import "time"
// ListMeta describes list of objects, i.e. holds information about pagination options set for the list.
type ListMeta struct {
// Total number of items on the list. Used for pagination.
TotalItems int `json:"totalItems"`
}
// ObjectMeta is metadata about an instance of a resource.
type ObjectMeta struct {
// Name is unique within a namespace. Name is primarily intended for creation
// idempotence and configuration definition.
Name string `json:"name,omitempty"`
// Namespace defines the space within which name must be unique. An empty namespace is
// equivalent to the "default" namespace, but "default" is the canonical representation.
// Not all objects are required to be scoped to a namespace - the value of this field for
// those objects will be empty.
Namespace string `json:"namespace,omitempty"`
// Labels are key value pairs that may be used to scope and select individual resources.
// Label keys are of the form:
// label-key ::= prefixed-name | name
// prefixed-name ::= prefix '/' name
// prefix ::= DNS_SUBDOMAIN
// name ::= DNS_LABEL
// The prefix is optional. If the prefix is not specified, the key is assumed to be private
// to the user. Other system components that wish to use labels must specify a prefix.
Labels map[string]string `json:"labels,omitempty"`
// Annotations are unstructured key value data stored with a resource that may be set by
// external tooling. They are not queryable and should be preserved when modifying
// objects. Annotation keys have the same formatting restrictions as Label keys. See the
// comments on Labels for details.
Annotations map[string]string `json:"annotations,omitempty"`
// CreationTimestamp is a timestamp representing the server time when this object was
// created. It is not guaranteed to be set in happens-before order across separate operations.
// Clients may not set this value. It is represented in RFC3339 form and is in UTC.
CreationTimestamp Time `json:"creationTimestamp,omitempty"`
}
// TypeMeta describes an individual object in an API response or request with strings representing
// the type of the object.
type TypeMeta struct {
// Kind is a string value representing the REST resource this object represents.
// Servers may infer this from the endpoint the client submits requests to.
// In smalllettercase.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
Kind ResourceKind `json:"kind,omitempty"`
}
// NodeAllocatedResources describes node allocated resources.
type NodeAllocatedResources struct {
// CPURequests is number of allocated milicores.
CPURequests int64 `json:"cpuRequests"`
// CPURequestsFraction is a fraction of CPU, that is allocated.
CPURequestsFraction float64 `json:"cpuRequestsFraction"`
// CPULimits is defined CPU limit.
CPULimits int64 `json:"cpuLimits"`
// CPULimitsFraction is a fraction of defined CPU limit, can be over 100%, i.e.
// overcommitted.
CPULimitsFraction float64 `json:"cpuLimitsFraction"`
// CPUCapacity is specified node CPU capacity in milicores.
CPUCapacity int64 `json:"cpuCapacity"`
// MemoryRequests is a fraction of memory, that is allocated.
MemoryRequests int64 `json:"memoryRequests"`
// MemoryRequestsFraction is a fraction of memory, that is allocated.
MemoryRequestsFraction float64 `json:"memoryRequestsFraction"`
// MemoryLimits is defined memory limit.
MemoryLimits int64 `json:"memoryLimits"`
// MemoryLimitsFraction is a fraction of defined memory limit, can be over 100%, i.e.
// overcommitted.
MemoryLimitsFraction float64 `json:"memoryLimitsFraction"`
// MemoryCapacity is specified node memory capacity in bytes.
MemoryCapacity int64 `json:"memoryCapacity"`
// AllocatedPods in number of currently allocated pods on the node.
AllocatedPods int `json:"allocatedPods"`
// PodCapacity is maximum number of pods, that can be allocated on the node.
PodCapacity int64 `json:"podCapacity"`
// PodFraction is a fraction of pods, that can be allocated on given node.
PodFraction float64 `json:"podFraction"`
}
type Time struct {
time.Time `protobuf:"-"`
}
// ResourceKind is an unique name for each resource. It can used for API discovery and generic
// code that does things based on the kind. For example, there may be a generic "deleter"
// that based on resource kind, name and namespace deletes it.
type ResourceKind string
type Unschedulable bool
type NodeIP string
type UID string