replicationcontroller

package
v1.1.0-beta1 Latest Latest
Warning

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

Go to latest
Published: May 20, 2016 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DescriptionAnnotationKey is annotation key for a description.
	DescriptionAnnotationKey = "description"
)

Variables

This section is empty.

Functions

func CreateObjectFromInfoFn

func CreateObjectFromInfoFn(info *kubectlResource.Info) (bool, error)

CreateObjectFromInfoFn is a implementation of createObjectFromInfo

func DeleteReplicationController

func DeleteReplicationController(client k8sClient.Interface, namespace, name string,
	deleteServices bool) error

TODO(floreks): This should be transactional to make sure that RC will not be deleted without pods DeleteReplicationController deletes replication controller with given name in given namespace and related pods. Also deletes services related to replication controller if deleteServices is true.

func DeleteReplicationControllerServices

func DeleteReplicationControllerServices(client k8sClient.Interface, namespace, name string) error

DeleteReplicationControllerServices deletes services related to replication controller with given name in given namespace.

func DeployApp

func DeployApp(spec *AppDeploymentSpec, client client.Interface) error

DeployApp deploys an app based on the given configuration. The app is deployed using the given client. App deployment consists of a replication controller and an optional service. Both of them share common labels.

func DeployAppFromFile

func DeployAppFromFile(spec *AppDeploymentFromFileSpec,
	createObjectFromInfoFn createObjectFromInfo, clientConfig clientcmd.ClientConfig) (bool, error)

DeployAppFromFile deploys an app based on the given yaml or json file.

func GetReplicationControllerEvents

func GetReplicationControllerEvents(client *client.Client, namespace, replicationControllerName string) (
	*common.EventList, error)

GetEvents returns events for particular namespace and replication controller or error if occurred.

func GetReplicationControllerPodsEvents

func GetReplicationControllerPodsEvents(client client.Interface, namespace,
	replicationControllerName string) ([]api.Event, error)

func UpdateReplicasCount

func UpdateReplicasCount(client k8sClient.Interface, namespace, name string,
	replicationControllerSpec *ReplicationControllerSpec) error

UpdateReplicasCount updates number of replicas in Replication Controller based on Replication Controller Spec

Types

type AppDeploymentFromFileResponse

type AppDeploymentFromFileResponse struct {
	// Name of the file
	Name string `json:"name"`

	// File content
	Content string `json:"content"`

	// Error after create resource
	Error string `json:"error"`
}

AppDeploymentFromFileResponse is a specification for deployment from file

type AppDeploymentFromFileSpec

type AppDeploymentFromFileSpec struct {
	// Name of the file
	Name string `json:"name"`

	// File content
	Content string `json:"content"`
}

AppDeploymentFromFileSpec is a specification for deployment from file

type AppDeploymentSpec

type AppDeploymentSpec struct {
	// Name of the application.
	Name string `json:"name"`

	// Docker image path for the application.
	ContainerImage string `json:"containerImage"`

	// The name of an image pull secret in case of a private docker repository.
	ImagePullSecret *string `json:"imagePullSecret"`

	// Command that is executed instead of container entrypoint, if specified.
	ContainerCommand *string `json:"containerCommand"`

	// Arguments for the specified container command or container entrypoint (if command is not
	// specified here).
	ContainerCommandArgs *string `json:"containerCommandArgs"`

	// Number of replicas of the image to maintain.
	Replicas int `json:"replicas"`

	// Port mappings for the service that is created. The service is created if there is at least
	// one port mapping.
	PortMappings []PortMapping `json:"portMappings"`

	// List of user-defined environment variables.
	Variables []EnvironmentVariable `json:"variables"`

	// Whether the created service is external.
	IsExternal bool `json:"isExternal"`

	// Description of the deployment.
	Description *string `json:"description"`

	// Target namespace of the application.
	Namespace string `json:"namespace"`

	// Optional memory requirement for the container.
	MemoryRequirement *resource.Quantity `json:"memoryRequirement"`

	// Optional CPU requirement for the container.
	CpuRequirement *resource.Quantity `json:"cpuRequirement"`

	// Labels that will be defined on Pods/RCs/Services
	Labels []Label `json:"labels"`

	// Whether to run the container as privileged user (essentially equivalent to root on the host).
	RunAsPrivileged bool `json:"runAsPrivileged"`
}

AppDeploymentSpec is a specification for an app deployment.

type EnvironmentVariable

type EnvironmentVariable struct {
	// Name of the variable. Must be a C_IDENTIFIER.
	Name string `json:"name"`

	// Value of the variable, as defined in Kubernetes core API.
	Value string `json:"value"`
}

EnvironmentVariable represents a named variable accessible for containers.

type Label

type Label struct {
	// Label key
	Key string `json:"key"`

	// Label value
	Value string `json:"value"`
}

Label is a structure representing label assignable to Pod/RC/Service

type PodContainer

type PodContainer struct {
	// Name of a Container.
	Name string `json:"name"`

	// Number of restarts.
	RestartCount int `json:"restartCount"`
}

PodContainer is a representation of a Container that belongs to a Pod.

type PortMapping

type PortMapping struct {
	// Port that will be exposed on the service.
	Port int `json:"port"`

	// Docker image path for the application.
	TargetPort int32 `json:"targetPort"`

	// IP protocol for the mapping, e.g., "TCP" or "UDP".
	Protocol api.Protocol `json:"protocol"`
}

PortMapping is a specification of port mapping for an application deployment.

type Protocols

type Protocols struct {
	// Array containing supported protocol types e.g., ["TCP", "UDP"]
	Protocols []api.Protocol `json:"protocols"`
}

Protocols is a structure representing supported protocol types for a service

func GetAvailableProtocols

func GetAvailableProtocols() *Protocols

GetAvailableProtocols returns list of available protocols. Currently it is TCP and UDP.

type ReplicationController

type ReplicationController struct {
	ObjectMeta common.ObjectMeta `json:"objectMeta"`
	TypeMeta   common.TypeMeta   `json:"typeMeta"`

	// Aggregate information about pods belonging to this Replication Controller.
	Pods common.PodInfo `json:"pods"`

	// Container images of the Replication Controller.
	ContainerImages []string `json:"containerImages"`

	// Internal endpoints of all Kubernetes services have the same label selector as this Replication Controller.
	InternalEndpoints []common.Endpoint `json:"internalEndpoints"`

	// External endpoints of all Kubernetes services have the same label selector as this Replication Controller.
	ExternalEndpoints []common.Endpoint `json:"externalEndpoints"`
}

ReplicationController (aka. Replication Controller) plus zero or more Kubernetes services that target the Replication Controller.

type ReplicationControllerDetail

type ReplicationControllerDetail struct {
	ObjectMeta common.ObjectMeta `json:"objectMeta"`
	TypeMeta   common.TypeMeta   `json:"typeMeta"`

	// Label selector of the Replication Controller.
	LabelSelector map[string]string `json:"labelSelector"`

	// Container image list of the pod template specified by this Replication Controller.
	ContainerImages []string `json:"containerImages"`

	// Aggregate information about pods of this replication controller.
	PodInfo common.PodInfo `json:"podInfo"`

	// Detailed information about Pods belonging to this Replication Controller.
	Pods pod.PodList `json:"pods"`

	// Detailed information about service related to Replication Controller.
	ServiceList resourceService.ServiceList `json:"serviceList"`

	// True when the data contains at least one pod with metrics information, false otherwise.
	HasMetrics bool `json:"hasMetrics"`
}

ReplicationControllerDetail represents detailed information about a Replication Controller.

func GetReplicationControllerDetail

func GetReplicationControllerDetail(client k8sClient.Interface, heapsterClient client.HeapsterClient,
	namespace, name string) (*ReplicationControllerDetail, error)

GetReplicationControllerDetail returns detailed information about the given replication controller in the given namespace.

type ReplicationControllerList

type ReplicationControllerList struct {
	// Unordered list of Replication Controllers.
	ReplicationControllers []ReplicationController `json:"replicationControllers"`
}

ReplicationControllerList contains a list of Replication Controllers in the cluster.

func GetReplicationControllerList

func GetReplicationControllerList(client *client.Client) (*ReplicationControllerList, error)

GetReplicationControllerList returns a list of all Replication Controllers in the cluster.

func GetReplicationControllerListFromChannels

func GetReplicationControllerListFromChannels(channels *common.ResourceChannels) (
	*ReplicationControllerList, error)

GetReplicationControllerList returns a list of all Replication Controllers in the cluster reading required resource list once from the channels.

type ReplicationControllerPodWithContainers

type ReplicationControllerPodWithContainers struct {
	// Name of the Pod.
	Name string `json:"name"`

	// Time the Pod has started. Empty if not started.
	StartTime *unversioned.Time `json:"startTime"`

	// Total number of restarts.
	TotalRestartCount int `json:"totalRestartCount"`

	// List of Containers that belongs to particular Pod.
	PodContainers []PodContainer `json:"podContainers"`
}

ReplicationControllerPodWithContainers is a representation of a Pod that belongs to a Replication Controller.

type ReplicationControllerPods

type ReplicationControllerPods struct {
	// List of pods that belongs to a Replication Controller.
	Pods []ReplicationControllerPodWithContainers `json:"pods"`
}

ReplicationControllerPods is a representation of pods list that belongs to a Replication Controller.

func GetReplicationControllerPods

func GetReplicationControllerPods(client *client.Client, namespace, name string, limit int) (
	*ReplicationControllerPods, error)

GetReplicationControllerPods returns list of pods with containers for the given replication controller in the given namespace. Limit specify the number of records to return. There is no limit when given value is zero.

type ReplicationControllerSpec

type ReplicationControllerSpec struct {
	// Replicas (pods) number in replicas set
	Replicas int `json:"replicas"`
}

ReplicationControllerSpec contains information needed to update replication controller.

type ReplicationControllerWithPods

type ReplicationControllerWithPods struct {
	ReplicationController *api.ReplicationController
	Pods                  *api.PodList
}

ReplicationControllerWithPods is a structure representing replication controller and its pods.

type TotalRestartCountSorter

type TotalRestartCountSorter []ReplicationControllerPodWithContainers

TotalRestartCountSorter sorts ReplicationControllerPodWithContainers by restarts number.

func (TotalRestartCountSorter) Len

func (a TotalRestartCountSorter) Len() int

func (TotalRestartCountSorter) Less

func (a TotalRestartCountSorter) Less(i, j int) bool

func (TotalRestartCountSorter) Swap

func (a TotalRestartCountSorter) Swap(i, j int)

Jump to

Keyboard shortcuts

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