replicationcontroller

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2016 License: Apache-2.0 Imports: 18 Imported by: 79

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

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

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.Interface, pQuery *common.PaginationQuery,
	namespace, replicationControllerName string) (*common.EventList, error)

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

func GetReplicationControllerPods

func GetReplicationControllerPods(client k8sClient.Interface, heapsterClient client.HeapsterClient,
	pQuery *common.PaginationQuery, rcName, namespace string) (*pod.PodList, error)

GetReplicationControllerPods return list of pods targeting replication controller associated to given name.

func GetReplicationControllerServices added in v1.1.1

func GetReplicationControllerServices(client client.Interface, pQuery *common.PaginationQuery,
	namespace, rcName string) (*service.ServiceList, error)

GetReplicationControllerServices returns list of services that are related to replication controller targeted by given name.

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 int32 `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 PortMapping

type PortMapping struct {
	// Port that will be exposed on the service.
	Port int32 `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"`
}

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

func ToReplicationController added in v1.1.1

func ToReplicationController(replicationController *api.ReplicationController,
	podInfo *common.PodInfo) ReplicationController

ToReplicationController converts replication controller api object to replication controller model object.

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.
	PodList pod.PodList `json:"podList"`

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

	// List of events related to this Replication Controller.
	EventList common.EventList `json:"eventList"`

	// 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.

func ToReplicationControllerDetail added in v1.1.1

func ToReplicationControllerDetail(replicationController *api.ReplicationController,
	podInfo common.PodInfo, podList pod.PodList, eventList common.EventList,
	serviceList resourceService.ServiceList) ReplicationControllerDetail

ToReplicationControllerDetail converts replication controller api object to replication controller detail model object.

type ReplicationControllerList

type ReplicationControllerList struct {
	ListMeta common.ListMeta `json:"listMeta"`

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

ReplicationControllerList contains a list of Replication Controllers in the cluster.

func CreateReplicationControllerList added in v1.1.1

func CreateReplicationControllerList(replicationControllers []api.ReplicationController,
	pQuery *common.PaginationQuery, pods []api.Pod, events []api.Event) *ReplicationControllerList

CreateReplicationControllerList creates paginated list of Replication Controller model objects based on Kubernetes Replication Controller objects array and related resources arrays.

func GetReplicationControllerList

func GetReplicationControllerList(client *client.Client, nsQuery *common.NamespaceQuery,
	pQuery *common.PaginationQuery) (*ReplicationControllerList, error)

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

func GetReplicationControllerListFromChannels

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

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

type ReplicationControllerSpec

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

ReplicationControllerSpec contains information needed to update replication controller.

Jump to

Keyboard shortcuts

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