deployment

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2017 License: Apache-2.0 Imports: 21 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 added in v1.4.2

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

CreateObjectFromInfoFn is an implementation of createObjectFromInfo

func DeployApp added in v1.4.2

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 deployment and an optional service. Both of them share common labels.

func DeployAppFromFile added in v1.4.2

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

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

func FindNewReplicaSet added in v1.6.0

func FindNewReplicaSet(deployment *extensions.Deployment, rsList []*extensions.ReplicaSet) (*extensions.ReplicaSet, error)

FindNewReplicaSet returns the new RS this given deployment targets (the one with the same pod template).

func FindOldReplicaSets added in v1.6.0

func FindOldReplicaSets(deployment *extensions.Deployment, rsList []*extensions.ReplicaSet) ([]*extensions.ReplicaSet, []*extensions.ReplicaSet, error)

FindOldReplicaSets returns the old replica sets targeted by the given Deployment, with the given slice of RSes. Note that the first set of old replica sets doesn't include the ones with no pods, and the second set of old replica sets include all old replica sets.

func GetDeploymentEvents

func GetDeploymentEvents(client client.Interface, dsQuery *dataselect.DataSelectQuery, namespace string,
	deploymentName string) (*common.EventList, error)

GetDeploymentEvents returns model events for a deployment with the given name in the given namespace.

func GetDeploymentOldReplicaSets added in v1.4.0

func GetDeploymentOldReplicaSets(client client.Interface, dsQuery *dataselect.DataSelectQuery,
	namespace string, deploymentName string) (*replicaset.ReplicaSetList, error)

GetDeploymentOldReplicaSets returns old replica sets targeting Deployment with given name

func GetDeploymentPods added in v1.4.0

func GetDeploymentPods(client client.Interface, metricClient metricapi.MetricClient,
	dsQuery *dataselect.DataSelectQuery, namespace, deploymentName string) (*pod.PodList, error)

GetDeploymentPods returns list of pods targeting deployment.

func GetNewReplicaSetTemplate added in v1.6.0

func GetNewReplicaSetTemplate(deployment *extensions.Deployment) v1.PodTemplateSpec

GetNewReplicaSetTemplate returns the desired PodTemplateSpec for the new ReplicaSet corresponding to the given ReplicaSet. Callers of this helper need to set the DefaultDeploymentUniqueLabelKey k/v pair.

Types

type AppDeploymentFromFileResponse added in v1.4.2

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 added in v1.4.2

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

	// Namespace that object should be deployed in
	Namespace string `json:"namespace"`

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

	// Whether validate content before creation or not
	Validate bool `json:"validate"`
}

AppDeploymentFromFileSpec is a specification for deployment from file

type AppDeploymentSpec added in v1.4.2

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 Deployment

type Deployment struct {
	ObjectMeta api.ObjectMeta `json:"objectMeta"`
	TypeMeta   api.TypeMeta   `json:"typeMeta"`

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

	// Container images of the Deployment.
	ContainerImages []string `json:"containerImages"`
}

Deployment is a presentation layer view of Kubernetes Deployment resource. This means it is Deployment plus additional augmented data we can get from other sources (like services that target the same pods).

type DeploymentCell added in v1.4.0

type DeploymentCell extensions.Deployment

func (DeploymentCell) GetProperty added in v1.4.0

func (DeploymentCell) GetResourceSelector added in v1.4.0

func (self DeploymentCell) GetResourceSelector() *metricapi.ResourceSelector

type DeploymentDetail

type DeploymentDetail struct {
	ObjectMeta api.ObjectMeta `json:"objectMeta"`
	TypeMeta   api.TypeMeta   `json:"typeMeta"`

	// Detailed information about Pods belonging to this Deployment.
	PodList pod.PodList `json:"podList"`

	// Label selector of the service.
	Selector map[string]string `json:"selector"`

	// Status information on the deployment
	StatusInfo `json:"statusInfo"`

	// The deployment strategy to use to replace existing pods with new ones.
	// Valid options: Recreate, RollingUpdate
	Strategy extensions.DeploymentStrategyType `json:"strategy"`

	// Min ready seconds
	MinReadySeconds int32 `json:"minReadySeconds"`

	// Rolling update strategy containing maxSurge and maxUnavailable
	RollingUpdateStrategy *RollingUpdateStrategy `json:"rollingUpdateStrategy,omitempty"`

	// RepliaSetList containing old replica sets from the deployment
	OldReplicaSetList replicaset.ReplicaSetList `json:"oldReplicaSetList"`

	// New replica set used by this deployment
	NewReplicaSet replicaset.ReplicaSet `json:"newReplicaSet"`

	// Optional field that specifies the number of old Replica Sets to retain to allow rollback.
	RevisionHistoryLimit *int32 `json:"revisionHistoryLimit"`

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

	// List of Horizontal Pod AutoScalers targeting this Deployment
	HorizontalPodAutoscalerList hpa.HorizontalPodAutoscalerList `json:"horizontalPodAutoscalerList"`

	// List of non-critical errors, that occurred during resource retrieval.
	Errors []error `json:"errors"`
}

DeploymentDetail is a presentation layer view of Kubernetes Deployment resource.

func GetDeploymentDetail

func GetDeploymentDetail(client client.Interface, metricClient metricapi.MetricClient, namespace string,
	deploymentName string) (*DeploymentDetail, error)

GetDeploymentDetail returns model object of deployment and error, if any.

type DeploymentList

type DeploymentList struct {
	ListMeta          api.ListMeta       `json:"listMeta"`
	CumulativeMetrics []metricapi.Metric `json:"cumulativeMetrics"`

	// Unordered list of Deployments.
	Deployments []Deployment `json:"deployments"`

	// List of non-critical errors, that occurred during resource retrieval.
	Errors []error `json:"errors"`
}

ReplicationSetList contains a list of Deployments in the cluster.

func GetDeploymentList

func GetDeploymentList(client client.Interface, nsQuery *common.NamespaceQuery, dsQuery *dataselect.DataSelectQuery,
	metricClient metricapi.MetricClient) (*DeploymentList, error)

GetDeploymentList returns a list of all Deployments in the cluster.

func GetDeploymentListFromChannels

func GetDeploymentListFromChannels(channels *common.ResourceChannels, dsQuery *dataselect.DataSelectQuery,
	metricClient metricapi.MetricClient) (*DeploymentList, error)

GetDeploymentList returns a list of all Deployments in the cluster reading required resource list once from the channels.

type EnvironmentVariable added in v1.4.2

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 added in v1.4.2

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 added in v1.4.2

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 added in v1.4.2

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 added in v1.4.2

func GetAvailableProtocols() *Protocols

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

type RollingUpdateStrategy

type RollingUpdateStrategy struct {
	MaxSurge       *intstr.IntOrString `json:"maxSurge"`
	MaxUnavailable *intstr.IntOrString `json:"maxUnavailable"`
}

RollingUpdateStrategy is behavior of a rolling update. See RollingUpdateDeployment K8s object.

type StatusInfo

type StatusInfo struct {
	// Total number of desired replicas on the deployment
	Replicas int32 `json:"replicas"`

	// Number of non-terminated pods that have the desired template spec
	Updated int32 `json:"updated"`

	// Number of available pods (ready for at least minReadySeconds)
	// targeted by this deployment
	Available int32 `json:"available"`

	// Total number of unavailable pods targeted by this deployment.
	Unavailable int32 `json:"unavailable"`
}

func GetStatusInfo

func GetStatusInfo(deploymentStatus *extensions.DeploymentStatus) StatusInfo

Jump to

Keyboard shortcuts

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