types

package
v1.2.0-alpha.1....-877bfa6 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Common types in the Kubelet.

Index

Constants

View Source
const (
	// This is the current pod configuration
	SET PodOperation = iota
	// Pods with the given ids are new to this source
	ADD
	// Pods with the given ids have been removed from this source
	REMOVE
	// Pods with the given ids have been updated in this source
	UPDATE

	// These constants identify the sources of pods
	// Updates from a file
	FileSource = "file"
	// Updates from querying a web page
	HTTPSource = "http"
	// Updates from Kubernetes API Server
	ApiserverSource = "api"
	// Updates from all sources
	AllSource = "*"

	// Used for ConfigMirrorAnnotationKey.
	MirrorType = "mirror"

	NamespaceDefault = api.NamespaceDefault
)
View Source
const ConfigFirstSeenAnnotationKey = "kubernetes.io/config.seen"
View Source
const ConfigMirrorAnnotationKey = "kubernetes.io/config.mirror"
View Source
const ConfigSourceAnnotationKey = "kubernetes.io/config.source"

Variables

This section is empty.

Functions

func GetPodSource

func GetPodSource(pod *api.Pod) (string, error)

GetPodSource returns the source of the pod based on the annotation.

func GetValidatedSources

func GetValidatedSources(sources []string) ([]string, error)

Gets all validated sources from the specified sources.

Types

type DockerID

type DockerID string

DockerID is an ID of docker container. It is a type to make it clear when we're working with docker container Ids

func (DockerID) ContainerID

func (id DockerID) ContainerID() kubecontainer.ContainerID

type HttpGetter

type HttpGetter interface {
	Get(url string) (*http.Response, error)
}

type PodOperation

type PodOperation int

PodOperation defines what changes will be made on a pod configuration.

type PodUpdate

type PodUpdate struct {
	Pods   []*api.Pod
	Op     PodOperation
	Source string
}

PodUpdate defines an operation sent on the channel. You can add or remove single services by sending an array of size one and Op == ADD|REMOVE (with REMOVE, only the ID is required). For setting the state of the system to a given state for this source configuration, set Pods as desired and Op to SET, which will reset the system state to that specified in this operation for this source channel. To remove all pods, set Pods to empty object and Op to SET.

Additionally, Pods should never be nil - it should always point to an empty slice. While functionally similar, this helps our unit tests properly check that the correct PodUpdates are generated.

type SortedContainerStatuses

type SortedContainerStatuses []api.ContainerStatus

A type to help sort container statuses based on container names.

func (SortedContainerStatuses) Len

func (s SortedContainerStatuses) Len() int

func (SortedContainerStatuses) Less

func (s SortedContainerStatuses) Less(i, j int) bool

func (SortedContainerStatuses) Swap

func (s SortedContainerStatuses) Swap(i, j int)

type SyncPodType

type SyncPodType int

SyncPodType classifies pod updates, eg: create, update.

const (
	SyncPodSync SyncPodType = iota
	SyncPodUpdate
	SyncPodCreate
)

func (SyncPodType) String

func (sp SyncPodType) String() string

type Timestamp

type Timestamp struct {
	// contains filtered or unexported fields
}

Timestamp wraps around time.Time and offers utilities to format and parse the time using RFC3339Nano

func ConvertToTimestamp

func ConvertToTimestamp(timeString string) *Timestamp

ConvertToTimestamp takes a string, parses it using the RFC3339Nano layout, and converts it to a Timestamp object.

func NewTimestamp

func NewTimestamp() *Timestamp

NewTimestamp returns a Timestamp object using the current time.

func (*Timestamp) Get

func (t *Timestamp) Get() time.Time

Get returns the time as time.Time.

func (*Timestamp) GetString

func (t *Timestamp) GetString() string

GetString returns the time in the string format using the RFC3339Nano layout.

Jump to

Keyboard shortcuts

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