kubernetes

package
v0.13.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHTTPClient = &http.Client{
	Timeout: 30 * time.Second,
	Transport: &http.Transport{
		TLSHandshakeTimeout: 10 * time.Second,
		TLSClientConfig: &tls.Config{
			InsecureSkipVerify: true,
		},
	},
}

Functions

func CoresFromCPUString

func CoresFromCPUString(str string) (float64, error)

func GiBFromMemString

func GiBFromMemString(memStr string) (float64, error)

Types

type AwsElasticBlockStore

type AwsElasticBlockStore struct {
	VolumeID string `json:"volumeID"`
	FSType   string `json:"fsType"`
}

type Cinder added in v0.12.0

type Cinder struct {
	VolumeID string `json:"volumeID"`
	FSType   string `json:"fsType"`
}

type Client

type Client struct {
	Kube       *model.Kube
	HTTPClient *http.Client
}

func (*Client) CreateResource

func (k *Client) CreateResource(kind string, namespace string, in map[string]interface{}, out *json.RawMessage) error

func (*Client) DeleteResource

func (k *Client) DeleteResource(kind string, namespace string, name string) error

func (*Client) EnsureNamespace

func (k *Client) EnsureNamespace(name string) error

EnsureNamespace implements the ClientInterface.

func (*Client) GetResource

func (k *Client) GetResource(kind string, namespace string, name string, out *json.RawMessage) error

func (*Client) ListEvents

func (k *Client) ListEvents(query string) ([]*Event, error)

func (*Client) ListNamespaces

func (k *Client) ListNamespaces(query string) ([]*Namespace, error)

func (*Client) ListNodeHeapsterStats

func (k *Client) ListNodeHeapsterStats() ([]*HeapsterStats, error)

func (*Client) ListNodes

func (k *Client) ListNodes(query string) ([]*Node, error)

func (*Client) ListPodHeapsterCPUUsageMetrics

func (k *Client) ListPodHeapsterCPUUsageMetrics(namespace string, name string) ([]*HeapsterMetric, error)

func (*Client) ListPodHeapsterRAMUsageMetrics

func (k *Client) ListPodHeapsterRAMUsageMetrics(namespace string, name string) ([]*HeapsterMetric, error)

func (*Client) ListPods

func (k *Client) ListPods(query string) ([]*Pod, error)

type ClientInterface

type ClientInterface interface {
	// EnsureNamespace creates a Kubernetes Namespace unless it already exists.
	EnsureNamespace(name string) error

	GetResource(kind string, namespace string, name string, out *json.RawMessage) error
	CreateResource(kind string, namespace string, objIn map[string]interface{}, out *json.RawMessage) error
	DeleteResource(kind string, namespace string, name string) error

	ListNamespaces(query string) ([]*Namespace, error)
	ListEvents(query string) ([]*Event, error)
	ListNodes(query string) ([]*Node, error)
	ListPods(query string) ([]*Pod, error)
	ListNodeHeapsterStats() ([]*HeapsterStats, error)
	ListPodHeapsterCPUUsageMetrics(namespace string, name string) ([]*HeapsterMetric, error)
	ListPodHeapsterRAMUsageMetrics(namespace string, name string) ([]*HeapsterMetric, error)
}

type Container

type Container struct {
	Name            string          `json:"name"`
	Image           string          `json:"image"`
	Command         []string        `json:"command"`
	Resources       Resources       `json:"resources"`
	Ports           []ContainerPort `json:"ports"`
	VolumeMounts    []VolumeMount   `json:"volumeMounts"`
	Env             []EnvVar        `json:"env"`
	SecurityContext SecurityContext `json:"securityContext"`
	ImagePullPolicy string          `json:"imagePullPolicy"`
}

type ContainerPort

type ContainerPort struct {
	Name          string `json:"name,omitempty"`
	ContainerPort int    `json:"containerPort"`
	Protocol      string `json:"protocol,omitempty"`
}

type ContainerState

type ContainerState struct {
	Running    ContainerStateRunning    `json:"running"`
	Terminated ContainerStateTerminated `json:"terminated"`
}

type ContainerStateRunning

type ContainerStateRunning struct {
	StartedAt string `json:"startedAt"` // TODO should be time type
}

type ContainerStateTerminated

type ContainerStateTerminated struct {
	ExitCode   int    `json:"exitcode"`
	StartedAt  string `json:"startedAt"`  // TODO should be time type
	FinishedAt string `json:"finishedAt"` // TODO should be time type
	Reason     string `json:"reason"`
}

type ContainerStatus

type ContainerStatus struct {
	ContainerID  string         `json:"containerID"`
	Image        string         `json:"image"`
	ImageID      string         `json:"imageID"`
	Name         string         `json:"name"`
	Ready        bool           `json:"ready"`
	RestartCount int            `json:"restartCount"`
	State        ContainerState `json:"state"`
	LastState    ContainerState `json:"state"`
}

type EnvVar

type EnvVar struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Event

type Event struct {
	Metadata Metadata `json:"metadata"`
	Message  string   `json:"message"`
	Count    int      `json:"count"`
	Source   Source   `json:"source"`
}

type EventList

type EventList struct {
	Items []*Event `json:"items"`
}

------------------------------------------------------------------------------

type FlexVolume

type FlexVolume struct {
	Driver  string            `json:"driver"`
	FSType  string            `json:"fsType"`
	Options map[string]string `json:"options"`
}

type HeapsterMetric

type HeapsterMetric struct {
	Timestamp time.Time `json:"timestamp"`
	Value     int64     `json:"value"`
}

type HeapsterMetrics

type HeapsterMetrics struct {
	Metrics []*HeapsterMetric `json:"metrics"`
}

type HeapsterStats

type HeapsterStats struct {
	Name     string `json:"name"`
	CPUUsage int64  `json:"cpuUsage"`
	RAMUsage int64  `json:"memUsage"`
}

type ImagePullSecret

type ImagePullSecret struct {
	Name string `json:"name"`
}

type Metadata

type Metadata struct {
	Name              string            `json:"name,omitempty"`
	Namespace         string            `json:"namespace,omitempty"`
	Labels            map[string]string `json:"labels,omitempty"`
	CreationTimestamp string            `json:"creationTimestamp,omitempty"`
}

type Namespace

type Namespace struct {
	Metadata Metadata `json:"metadata"`
}

type NamespaceList

type NamespaceList struct {
	Items []*Namespace `json:"items"`
}

------------------------------------------------------------------------------

type Node

type Node struct {
	Metadata Metadata   `json:"metadata"`
	Spec     NodeSpec   `json:"spec"`
	Status   NodeStatus `json:"status"`
}

type NodeAddress

type NodeAddress struct {
	Type    string `json:"type"`
	Address string `json:"address"`
}

type NodeList

type NodeList struct {
	Items []*Node `json:"items"`
}

------------------------------------------------------------------------------

type NodeSpec

type NodeSpec struct {
	ExternalID string `json:"externalID"`
}

type NodeStatus

type NodeStatus struct {
	Capacity   NodeStatusCapacity    `json:"capacity"`
	Conditions []NodeStatusCondition `json:"conditions"`
	Addresses  []NodeAddress         `json:"addresses"`
}

type NodeStatusCapacity

type NodeStatusCapacity struct {
	CPU    string `json:"cpu"`
	Memory string `json:"memory"`
}

type NodeStatusCondition

type NodeStatusCondition struct {
	Type   string `json:"type"`
	Status string `json:"status"`
}

type Pod

type Pod struct {
	Metadata Metadata  `json:"metadata"`
	Spec     PodSpec   `json:"spec"`
	Status   PodStatus `json:"status"`
}

type PodList

type PodList struct {
	Items []*Pod `json:"items"`
}

------------------------------------------------------------------------------

type PodSpec

type PodSpec struct {
	Volumes                       []Volume          `json:"volumes"`
	Containers                    []Container       `json:"containers"`
	ImagePullSecrets              []ImagePullSecret `json:"imagePullSecrets"`
	TerminationGracePeriodSeconds int               `json:"terminationGracePeriodSeconds"`
	RestartPolicy                 string            `json:"restartPolicy"`
	NodeName                      string            `json:"nodeName"`
}

type PodStatus

type PodStatus struct {
	Phase             string               `json:"phase"`
	Conditions        []PodStatusCondition `json:"conditions"`
	ContainerStatuses []ContainerStatus    `json:"containerStatuses"`
}

type PodStatusCondition

type PodStatusCondition struct {
	Type   string `json:"type"`
	Status string `json:"status"`
}

type ResourceValues

type ResourceValues struct {
	Memory string `json:"memory,omitempty"`
	CPU    string `json:"cpu,omitempty"`
}

type Resources

type Resources struct {
	Limits   ResourceValues `json:"limits"`
	Requests ResourceValues `json:"requests"`
}

type SecurityContext

type SecurityContext struct {
	Privileged bool `json:"privileged"`
}

type Source

type Source struct {
	Host string `json:"host"`
}

type Volume

type Volume struct {
	Name                 string                `json:"name"`
	AwsElasticBlockStore *AwsElasticBlockStore `json:"awsElasticBlockStore,omitempty"`
	FlexVolume           *FlexVolume           `json:"flexVolume,omitempty"`
	Cinder               *Cinder               `json:"cinder,omitempty"`
}

type VolumeMount

type VolumeMount struct {
	Name      string `json:"name"`
	MountPath string `json:"mountPath"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL