Help us shape the future of Go! Take the 2026 Go Developer Survey

kubernetes

package
v0.15.4 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 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(apiVersion, kind, namespace string, in interface{}, out interface{}) error

func (*Client) DeleteResource

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

func (*Client) EnsureNamespace

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

EnsureNamespace implements the ClientInterface.

func (*Client) GetPodLog added in v0.14.0

func (k *Client) GetPodLog(namespace, name string) (string, error)

func (*Client) GetResource

func (k *Client) GetResource(apiVersion, kind, namespace, name string, out interface{}) 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) ListPersistentVolumes added in v0.14.0

func (k *Client) ListPersistentVolumes(query string) ([]*PersistentVolume, 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)

func (*Client) ListServices added in v0.14.0

func (k *Client) ListServices(query string) ([]*Service, error)

func (*Client) UpdateResource added in v0.14.0

func (k *Client) UpdateResource(apiVersion, kind, namespace, name string, in interface{}, out interface{}) error

type ClientInterface

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

	GetResource(apiVersion, kind, namespace, name string, out interface{}) error
	CreateResource(apiVersion, kind, namespace string, objIn interface{}, out interface{}) error
	UpdateResource(apiVersion, kind, namespace, name string, objIn interface{}, out interface{}) error
	DeleteResource(apiVersion, kind, namespace, name string) error

	ListNamespaces(query string) ([]*Namespace, error)
	ListEvents(query string) ([]*Event, error)
	ListNodes(query string) ([]*Node, error)
	ListPods(query string) ([]*Pod, error)
	ListServices(query string) ([]*Service, error)
	ListPersistentVolumes(query string) ([]*PersistentVolume, error)

	GetPodLog(namespace, name string) (string, 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"`
	Args            []string        `json:"args"`
	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 GcePersistentDisk added in v0.13.5

type GcePersistentDisk struct {
	PDName string `json:"pdName"`
	FSType string `json:"fsType"`
}

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 LoadBalancerIngress added in v0.14.0

type LoadBalancerIngress struct {
	Hostname string `json:"hostname"`
}

type LoadBalancerStatus added in v0.14.0

type LoadBalancerStatus struct {
	Ingress []LoadBalancerIngress `json:"ingress"`
}

type Metadata

type Metadata struct {
	Name              string            `json:"name,omitempty"`
	GenerateName      string            `json:"generateName,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 PersistentVolume added in v0.14.0

type PersistentVolume struct {
	Metadata Metadata               `json:"metadata"`
	Spec     PersistentVolumeSpec   `json:"spec"`
	Status   PersistentVolumeStatus `json:"status"`
}

type PersistentVolumeCapacity added in v0.14.0

type PersistentVolumeCapacity struct {
	Storage string `json:"storage"`
}

type PersistentVolumeList added in v0.14.0

type PersistentVolumeList struct {
	Items []*PersistentVolume `json:"items"`
}

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

type PersistentVolumeSpec added in v0.14.0

type PersistentVolumeSpec struct {
	Capacity                      PersistentVolumeCapacity `json:"capacity"`
	AwsElasticBlockStore          *AwsElasticBlockStore    `json:"awsElasticBlockStore,omitempty"`
	FlexVolume                    *FlexVolume              `json:"flexVolume,omitempty"`
	Cinder                        *Cinder                  `json:"cinder,omitempty"`
	AccessModes                   []string                 `json:"accessModes"`
	ClaimRef                      Metadata                 `json:"claimRef"`
	PersistentVolumeReclaimPolicy string                   `json:"persistentVolumeReclaimPolicy"`
}

type PersistentVolumeStatus added in v0.14.0

type PersistentVolumeStatus struct {
	Phase string `json:"phase"`
}

TODO can this be generalized?

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 Service added in v0.14.0

type Service struct {
	Metadata Metadata      `json:"metadata"`
	Spec     ServiceSpec   `json:"spec"`
	Status   ServiceStatus `json:"status"`
}

type ServiceList added in v0.14.0

type ServiceList struct {
	Items []*Service `json:"items"`
}

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

type ServicePort added in v0.14.0

type ServicePort struct {
	Name       string `json:"name"`
	Port       int    `json:"port"`
	Protocol   string `json:"protocol,omitempty"`
	NodePort   int    `json:"nodePort,omitempty"`
	TargetPort int    `json:"targetPort,omitempty"`
}

type ServiceSpec added in v0.14.0

type ServiceSpec struct {
	Type      string            `json:"type,omitempty"`
	Selector  map[string]string `json:"selector"`
	Ports     []ServicePort     `json:"ports"`
	ClusterIP string            `json:"clusterIP,omitempty"`
}

type ServiceStatus added in v0.14.0

type ServiceStatus struct {
	LoadBalancer LoadBalancerStatus `json:"loadBalancer"`
}

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"`
	GcePersistentDisk    *GcePersistentDisk    `json:"gcePersistentDisk,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