kubectl

package
Version: v1.12.1 Latest Latest
Warning

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

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

Documentation

Overview

Package kubectl provides the functions used by the kubectl command line tool under k8s.io/kubernetes/cmd. The functions are kept in this package to better support unit testing. The main() method for kubectl is only an entry point and should contain no functionality.

Index

Constants

View Source
const (
	ChangeCauseAnnotation = "kubernetes.io/change-cause"
)

Variables

View Source
var ErrContainerTerminated = fmt.Errorf("container terminated")

ErrContainerTerminated is returned by PodContainerRunning in the intermediate state where the pod indicates it's still running, but its container is already terminated

View Source
var ErrPodCompleted = fmt.Errorf("pod ran to completion")

ErrPodCompleted is returned by PodRunning or PodContainerRunning to indicate that the pod has already reached completed state.

Functions

func AbortRollingUpdate added in v0.17.0

func AbortRollingUpdate(c *RollingUpdaterConfig) error

func AddDeploymentKeyToReplicationController added in v0.17.0

func AddDeploymentKeyToReplicationController(oldRc *corev1.ReplicationController, rcClient corev1client.ReplicationControllersGetter, podClient corev1client.PodsGetter, deploymentKey, deploymentValue, namespace string, out io.Writer) (*corev1.ReplicationController, error)

func AnnotateFlags added in v1.2.0

func AnnotateFlags(cmd *cobra.Command, generators map[string]Generator)

AnnotateFlags annotates all flags that are used by generators.

func ControllerHasDesiredReplicas added in v1.10.0

func ControllerHasDesiredReplicas(rcClient corev1client.ReplicationControllersGetter, controller *corev1.ReplicationController) wait.ConditionFunc

ControllerHasDesiredReplicas returns a condition that will be true if and only if the desired replica count for a controller's ReplicaSelector equals the Replicas count.

func CreateApplyAnnotation added in v1.2.0

func CreateApplyAnnotation(obj runtime.Object, codec runtime.Encoder) error

CreateApplyAnnotation gets the modified configuration of the object, without embedding it again, and then sets it on the object as the annotation.

func CreateNewControllerFromCurrentController added in v0.17.0

func CreateNewControllerFromCurrentController(rcClient corev1client.ReplicationControllersGetter, codec runtime.Codec, cfg *NewControllerConfig) (*corev1.ReplicationController, error)

func CreateOrUpdateAnnotation added in v1.2.0

func CreateOrUpdateAnnotation(createAnnotation bool, obj runtime.Object, codec runtime.Encoder) error

Create the annotation used by kubectl apply only when createAnnotation is true Otherwise, only update the annotation when it already exists

func EnsureFlagsValid added in v1.2.0

func EnsureFlagsValid(cmd *cobra.Command, generators map[string]Generator, generatorInUse string) error

EnsureFlagsValid ensures that no invalid flags are being used against a generator.

func FindSourceController added in v0.17.0

func FindSourceController(r corev1client.ReplicationControllersGetter, namespace, name string) (*corev1.ReplicationController, error)

func GetBool added in v1.1.0

func GetBool(params map[string]string, key string, defValue bool) (bool, error)

func GetModifiedConfiguration added in v1.1.1

func GetModifiedConfiguration(obj runtime.Object, annotate bool, codec runtime.Encoder) ([]byte, error)

GetModifiedConfiguration retrieves the modified configuration of the object. If annotate is true, it embeds the result as an annotation in the modified configuration. If an object was read from the command input, it will use that version of the object. Otherwise, it will use the version from the server.

func GetNextControllerAnnotation added in v0.17.0

func GetNextControllerAnnotation(rc *corev1.ReplicationController) (string, bool)

func GetOriginalConfiguration added in v1.1.1

func GetOriginalConfiguration(obj runtime.Object) ([]byte, error)

GetOriginalConfiguration retrieves the original configuration of the object from the annotation, or nil if no annotation was found.

func HandleResourceRequirementsV1 added in v1.6.0

func HandleResourceRequirementsV1(params map[string]string) (v1.ResourceRequirements, error)

HandleResourceRequirementsV1 parses the limits and requests parameters if specified and returns ResourceRequirements.

func IsZero added in v1.1.0

func IsZero(i interface{}) bool

func LoadExistingNextReplicationController added in v0.17.0

func LoadExistingNextReplicationController(c corev1client.ReplicationControllersGetter, namespace, newName string) (*corev1.ReplicationController, error)

func MakeLabels added in v0.11.0

func MakeLabels(labels map[string]string) string

func MakeParams added in v0.9.0

func MakeParams(cmd *cobra.Command, params []GeneratorParam) map[string]interface{}

MakeParams is a utility that creates generator parameters from a command line

func MakeProtocols added in v1.3.0

func MakeProtocols(protocols map[string]string) string

func ParseLabels added in v0.9.0

func ParseLabels(labelSpec interface{}) (map[string]string, error)

ParseLabels turns a string representation of a label set into a map[string]string

func ParseProtocols added in v1.3.0

func ParseProtocols(protocols interface{}) (map[string]string, error)

func PodCompleted added in v1.10.0

func PodCompleted(event watch.Event) (bool, error)

PodCompleted returns true if the pod has run to completion, false if the pod has not yet reached running state, or an error in any other case.

func PodNotPending added in v1.10.0

func PodNotPending(event watch.Event) (bool, error)

PodNotPending returns true if the pod has left the pending state, false if it has not, or an error in any other case (such as if the pod was deleted).

func PodRunning added in v1.10.0

func PodRunning(event watch.Event) (bool, error)

PodRunning returns true if the pod is running, false if the pod has not yet reached running state, returns ErrPodCompleted if the pod has run to completion, or an error in any other case.

func PodRunningAndReady added in v1.10.0

func PodRunningAndReady(event watch.Event) (bool, error)

PodRunningAndReady returns true if the pod is running and ready, false if the pod has not yet reached those states, returns ErrPodCompleted if the pod has run to completion, or an error in any other case.

func Rename added in v0.17.0

func ScaleCondition added in v0.18.0

func ScaleCondition(r Scaler, precondition *ScalePrecondition, namespace, name string, count uint, updatedResourceVersion *string, gr schema.GroupResource) wait.ConditionFunc

ScaleCondition is a closure around Scale that facilitates retries via util.wait

func SetNextControllerAnnotation added in v0.17.0

func SetNextControllerAnnotation(rc *corev1.ReplicationController, name string)

func UpdateApplyAnnotation added in v1.1.1

func UpdateApplyAnnotation(obj runtime.Object, codec runtime.Encoder) error

UpdateApplyAnnotation calls CreateApplyAnnotation if the last applied configuration annotation is already present. Otherwise, it does nothing.

func UpdateExistingReplicationController added in v0.17.0

func UpdateExistingReplicationController(rcClient corev1client.ReplicationControllersGetter, podClient corev1client.PodsGetter, oldRc *corev1.ReplicationController, namespace, newName, deploymentKey, deploymentValue string, out io.Writer) (*corev1.ReplicationController, error)

func ValidateParams added in v0.9.0

func ValidateParams(paramSpec []GeneratorParam, params map[string]interface{}) error

ValidateParams ensures that all required params are present in the params map

func WaitForScaleHasDesiredReplicas added in v1.11.0

func WaitForScaleHasDesiredReplicas(sClient scaleclient.ScalesGetter, gr schema.GroupResource, resourceName string, namespace string, newSize uint, waitForReplicas *RetryParams) error

WaitForScaleHasDesiredReplicas waits until condition scaleHasDesiredReplicas is satisfied or returns error when timeout happens

Types

type BaseDeploymentGenerator added in v1.8.0

type BaseDeploymentGenerator struct {
	Name   string
	Images []string
}

BaseDeploymentGenerator: implement the common functionality of DeploymentBasicGeneratorV1, DeploymentBasicAppsGeneratorV1Beta1 and DeploymentBasicAppsGeneratorV1. To reduce confusion, it's best to keep this struct in the same file as those generators.

type BasicPod added in v1.1.0

type BasicPod struct{}

func (BasicPod) Generate added in v1.1.0

func (BasicPod) Generate(genericParams map[string]interface{}) (runtime.Object, error)

func (BasicPod) ParamNames added in v1.1.0

func (BasicPod) ParamNames() []GeneratorParam

type BasicReplicationController added in v0.9.0

type BasicReplicationController struct{}

func (BasicReplicationController) Generate added in v0.9.0

func (BasicReplicationController) Generate(genericParams map[string]interface{}) (runtime.Object, error)

func (BasicReplicationController) ParamNames added in v0.9.0

type ClusterRoleBindingGeneratorV1 added in v1.6.0

type ClusterRoleBindingGeneratorV1 struct {
	// Name of clusterRoleBinding (required)
	Name string
	// ClusterRole for the clusterRoleBinding (required)
	ClusterRole string
	// Users to derive the clusterRoleBinding from (optional)
	Users []string
	// Groups to derive the clusterRoleBinding from (optional)
	Groups []string
	// ServiceAccounts to derive the clusterRoleBinding from in namespace:name format(optional)
	ServiceAccounts []string
}

ClusterRoleBindingGeneratorV1 supports stable generation of a clusterRoleBinding.

func (ClusterRoleBindingGeneratorV1) Generate added in v1.6.0

func (s ClusterRoleBindingGeneratorV1) Generate(genericParams map[string]interface{}) (runtime.Object, error)

Generate returns a clusterRoleBinding using the specified parameters.

func (ClusterRoleBindingGeneratorV1) ParamNames added in v1.6.0

ParamNames returns the set of supported input parameters when using the parameter injection generator pattern.

func (ClusterRoleBindingGeneratorV1) StructuredGenerate added in v1.6.0

func (s ClusterRoleBindingGeneratorV1) StructuredGenerate() (runtime.Object, error)

StructuredGenerate outputs a clusterRoleBinding object using the configured fields.

type ConfigMapGeneratorV1 added in v1.2.0

type ConfigMapGeneratorV1 struct {
	// Name of configMap (required)
	Name string
	// Type of configMap (optional)
	Type string
	// FileSources to derive the configMap from (optional)
	FileSources []string
	// LiteralSources to derive the configMap from (optional)
	LiteralSources []string
	// EnvFileSource to derive the configMap from (optional)
	EnvFileSource string
	// AppendHash; if true, derive a hash from the ConfigMap and append it to the name
	AppendHash bool
}

ConfigMapGeneratorV1 supports stable generation of a configMap.

func (ConfigMapGeneratorV1) Generate added in v1.2.0

func (s ConfigMapGeneratorV1) Generate(genericParams map[string]interface{}) (runtime.Object, error)

Generate returns a configMap using the specified parameters.

func (ConfigMapGeneratorV1) ParamNames added in v1.2.0

func (s ConfigMapGeneratorV1) ParamNames() []GeneratorParam

ParamNames returns the set of supported input parameters when using the parameter injection generator pattern.

func (ConfigMapGeneratorV1) StructuredGenerate added in v1.2.0

func (s ConfigMapGeneratorV1) StructuredGenerate() (runtime.Object, error)

StructuredGenerate outputs a configMap object using the configured fields.

type CronJobV1Beta1 added in v1.8.0

type CronJobV1Beta1 struct{}

func (CronJobV1Beta1) Generate added in v1.8.0

func (CronJobV1Beta1) Generate(genericParams map[string]interface{}) (runtime.Object, error)

func (CronJobV1Beta1) ParamNames added in v1.8.0

func (CronJobV1Beta1) ParamNames() []GeneratorParam

type CronJobV2Alpha1 added in v1.5.0

type CronJobV2Alpha1 struct{}

func (CronJobV2Alpha1) Generate added in v1.5.0

func (CronJobV2Alpha1) Generate(genericParams map[string]interface{}) (runtime.Object, error)

func (CronJobV2Alpha1) ParamNames added in v1.5.0

func (CronJobV2Alpha1) ParamNames() []GeneratorParam

type DaemonSetHistoryViewer added in v1.7.0

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

func (*DaemonSetHistoryViewer) ViewHistory added in v1.7.0

func (h *DaemonSetHistoryViewer) ViewHistory(namespace, name string, revision int64) (string, error)

ViewHistory returns a revision-to-history map as the revision history of a deployment TODO: this should be a describer

type DaemonSetRollbacker added in v1.7.0

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

func (*DaemonSetRollbacker) Rollback added in v1.7.0

func (r *DaemonSetRollbacker) Rollback(obj runtime.Object, updatedAnnotations map[string]string, toRevision int64, dryRun bool) (string, error)

type DaemonSetStatusViewer added in v1.6.0

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

DaemonSetStatusViewer implements the StatusViewer interface.

func (*DaemonSetStatusViewer) Status added in v1.6.0

func (s *DaemonSetStatusViewer) Status(obj runtime.Unstructured, revision int64) (string, bool, error)

Status returns a message describing daemon set status, and a bool value indicating if the status is considered done.

type DeploymentAppsV1Beta1 added in v1.6.0

type DeploymentAppsV1Beta1 struct{}

func (DeploymentAppsV1Beta1) Generate added in v1.6.0

func (DeploymentAppsV1Beta1) Generate(genericParams map[string]interface{}) (runtime.Object, error)

func (DeploymentAppsV1Beta1) ParamNames added in v1.6.0

func (DeploymentAppsV1Beta1) ParamNames() []GeneratorParam

type DeploymentBasicAppsGeneratorV1 added in v1.6.0

type DeploymentBasicAppsGeneratorV1 struct {
	BaseDeploymentGenerator
}

DeploymentBasicAppsGeneratorV1 supports stable generation of a deployment under apps/v1 endpoint

func (*DeploymentBasicAppsGeneratorV1) StructuredGenerate added in v1.6.0

func (s *DeploymentBasicAppsGeneratorV1) StructuredGenerate() (runtime.Object, error)

StructuredGenerate outputs a deployment object using the configured fields

type DeploymentBasicAppsGeneratorV1Beta1 added in v1.11.0

type DeploymentBasicAppsGeneratorV1Beta1 struct {
	BaseDeploymentGenerator
}

DeploymentBasicAppsGeneratorV1Beta1 supports stable generation of a deployment under apps/v1beta1 endpoint

func (*DeploymentBasicAppsGeneratorV1Beta1) StructuredGenerate added in v1.11.0

func (s *DeploymentBasicAppsGeneratorV1Beta1) StructuredGenerate() (runtime.Object, error)

StructuredGenerate outputs a deployment object using the configured fields

type DeploymentBasicGeneratorV1 added in v1.4.0

type DeploymentBasicGeneratorV1 struct {
	BaseDeploymentGenerator
}

DeploymentBasicGeneratorV1 supports stable generation of a deployment

func (*DeploymentBasicGeneratorV1) StructuredGenerate added in v1.4.0

func (s *DeploymentBasicGeneratorV1) StructuredGenerate() (runtime.Object, error)

StructuredGenerate outputs a deployment object using the configured fields

type DeploymentHistoryViewer added in v1.2.0

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

func (*DeploymentHistoryViewer) ViewHistory added in v1.4.0

func (h *DeploymentHistoryViewer) ViewHistory(namespace, name string, revision int64) (string, error)

ViewHistory returns a revision-to-replicaset map as the revision history of a deployment TODO: this should be a describer

type DeploymentRollbacker added in v1.2.0

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

func (*DeploymentRollbacker) Rollback added in v1.2.0

func (r *DeploymentRollbacker) Rollback(obj runtime.Object, updatedAnnotations map[string]string, toRevision int64, dryRun bool) (string, error)

type DeploymentStatusViewer added in v1.3.0

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

DeploymentStatusViewer implements the StatusViewer interface.

func (*DeploymentStatusViewer) Status added in v1.3.0

func (s *DeploymentStatusViewer) Status(obj runtime.Unstructured, revision int64) (string, bool, error)

Status returns a message describing deployment status, and a bool value indicating if the status is considered done.

type DeploymentV1Beta1 added in v1.2.0

type DeploymentV1Beta1 struct{}

func (DeploymentV1Beta1) Generate added in v1.2.0

func (DeploymentV1Beta1) Generate(genericParams map[string]interface{}) (runtime.Object, error)

func (DeploymentV1Beta1) ParamNames added in v1.2.0

func (DeploymentV1Beta1) ParamNames() []GeneratorParam

type Generator added in v0.9.0

type Generator interface {
	// Generate creates an API object given a set of parameters
	Generate(params map[string]interface{}) (runtime.Object, error)
	// ParamNames returns the list of parameters that this generator uses
	ParamNames() []GeneratorParam
}

Generator is an interface for things that can generate API objects from input parameters. One example is the "expose" generator that is capable of exposing new replication controllers and services, among other things.

type GeneratorParam added in v0.9.0

type GeneratorParam struct {
	Name     string
	Required bool
}

GeneratorParam is a parameter for a generator TODO: facilitate structured json generator input schemes

type HistoryViewer added in v1.2.0

type HistoryViewer interface {
	ViewHistory(namespace, name string, revision int64) (string, error)
}

HistoryViewer provides an interface for resources have historical information.

func HistoryViewerFor added in v1.2.0

func HistoryViewerFor(kind schema.GroupKind, c kubernetes.Interface) (HistoryViewer, error)

HistoryViewerFor returns an implementation of HistoryViewer interface for the given schema kind

type HistoryVisitor added in v1.9.0

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

func (*HistoryVisitor) VisitCronJob added in v1.9.0

func (v *HistoryVisitor) VisitCronJob(kind kapps.GroupKindElement)

func (*HistoryVisitor) VisitDaemonSet added in v1.9.0

func (v *HistoryVisitor) VisitDaemonSet(kind kapps.GroupKindElement)

func (*HistoryVisitor) VisitDeployment added in v1.9.0

func (v *HistoryVisitor) VisitDeployment(elem kapps.GroupKindElement)

func (*HistoryVisitor) VisitJob added in v1.9.0

func (v *HistoryVisitor) VisitJob(kind kapps.GroupKindElement)

func (*HistoryVisitor) VisitPod added in v1.9.0

func (v *HistoryVisitor) VisitPod(kind kapps.GroupKindElement)

func (*HistoryVisitor) VisitReplicaSet added in v1.9.0

func (v *HistoryVisitor) VisitReplicaSet(kind kapps.GroupKindElement)

func (*HistoryVisitor) VisitReplicationController added in v1.9.0

func (v *HistoryVisitor) VisitReplicationController(kind kapps.GroupKindElement)

func (*HistoryVisitor) VisitStatefulSet added in v1.9.0

func (v *HistoryVisitor) VisitStatefulSet(kind kapps.GroupKindElement)

type HorizontalPodAutoscalerGeneratorV1 added in v1.10.0

type HorizontalPodAutoscalerGeneratorV1 struct {
	Name               string
	ScaleRefKind       string
	ScaleRefName       string
	ScaleRefApiVersion string
	MinReplicas        int32
	MaxReplicas        int32
	CPUPercent         int32
}

HorizontalPodAutoscalerV1Generator supports stable generation of a horizontal pod autoscaler.

func (*HorizontalPodAutoscalerGeneratorV1) StructuredGenerate added in v1.10.0

func (s *HorizontalPodAutoscalerGeneratorV1) StructuredGenerate() (runtime.Object, error)

StructuredGenerate outputs a horizontal pod autoscaler object using the configured fields.

type JobV1 added in v1.2.0

type JobV1 struct{}

func (JobV1) Generate added in v1.2.0

func (JobV1) Generate(genericParams map[string]interface{}) (runtime.Object, error)

func (JobV1) ParamNames added in v1.2.0

func (JobV1) ParamNames() []GeneratorParam

type NamespaceGeneratorV1 added in v1.2.0

type NamespaceGeneratorV1 struct {
	// Name of namespace
	Name string
}

NamespaceGeneratorV1 supports stable generation of a namespace

func (NamespaceGeneratorV1) Generate added in v1.2.0

func (g NamespaceGeneratorV1) Generate(genericParams map[string]interface{}) (runtime.Object, error)

Generate returns a namespace using the specified parameters

func (NamespaceGeneratorV1) ParamNames added in v1.2.0

func (g NamespaceGeneratorV1) ParamNames() []GeneratorParam

ParamNames returns the set of supported input parameters when using the parameter injection generator pattern

func (*NamespaceGeneratorV1) StructuredGenerate added in v1.2.0

func (g *NamespaceGeneratorV1) StructuredGenerate() (runtime.Object, error)

StructuredGenerate outputs a namespace object using the configured fields

type NewControllerConfig added in v1.2.5

type NewControllerConfig struct {
	Namespace        string
	OldName, NewName string
	Image            string
	Container        string
	DeploymentKey    string
	PullPolicy       corev1.PullPolicy
}

type PodDisruptionBudgetV1Generator added in v1.6.0

type PodDisruptionBudgetV1Generator struct {
	Name         string
	MinAvailable string
	Selector     string
}

PodDisruptionBudgetV1Generator supports stable generation of a pod disruption budget.

func (PodDisruptionBudgetV1Generator) Generate added in v1.6.0

func (s PodDisruptionBudgetV1Generator) Generate(params map[string]interface{}) (runtime.Object, error)

func (PodDisruptionBudgetV1Generator) ParamNames added in v1.6.0

func (*PodDisruptionBudgetV1Generator) StructuredGenerate added in v1.6.0

func (s *PodDisruptionBudgetV1Generator) StructuredGenerate() (runtime.Object, error)

StructuredGenerate outputs a pod disruption budget object using the configured fields.

type PodDisruptionBudgetV2Generator added in v1.7.0

type PodDisruptionBudgetV2Generator struct {
	Name           string
	MinAvailable   string
	MaxUnavailable string
	Selector       string
}

PodDisruptionBudgetV2Generator supports stable generation of a pod disruption budget.

func (PodDisruptionBudgetV2Generator) Generate added in v1.7.0

func (s PodDisruptionBudgetV2Generator) Generate(params map[string]interface{}) (runtime.Object, error)

func (PodDisruptionBudgetV2Generator) ParamNames added in v1.7.0

func (*PodDisruptionBudgetV2Generator) StructuredGenerate added in v1.7.0

func (s *PodDisruptionBudgetV2Generator) StructuredGenerate() (runtime.Object, error)

StructuredGenerate outputs a pod disruption budget object using the configured fields.

type PreconditionError added in v0.9.0

type PreconditionError struct {
	Precondition  string
	ExpectedValue string
	ActualValue   string
}

A PreconditionError is returned when a resource fails to match the scale preconditions passed to kubectl.

func (PreconditionError) Error added in v0.9.0

func (pe PreconditionError) Error() string

type PriorityClassV1Generator added in v1.9.0

type PriorityClassV1Generator struct {
	Name          string
	Value         int32
	GlobalDefault bool
	Description   string
}

PriorityClassV1Generator supports stable generation of a priorityClass.

func (PriorityClassV1Generator) Generate added in v1.9.0

func (s PriorityClassV1Generator) Generate(params map[string]interface{}) (runtime.Object, error)

func (PriorityClassV1Generator) ParamNames added in v1.9.0

func (*PriorityClassV1Generator) StructuredGenerate added in v1.9.0

func (s *PriorityClassV1Generator) StructuredGenerate() (runtime.Object, error)

StructuredGenerate outputs a priorityClass object using the configured fields.

type RESTClient

type RESTClient interface {
	Get() *client.Request
	Post() *client.Request
	Patch(types.PatchType) *client.Request
	Delete() *client.Request
	Put() *client.Request
}

RESTClient is a client helper for dealing with RESTful resources in a generic way.

type ResourceQuotaGeneratorV1 added in v1.4.0

type ResourceQuotaGeneratorV1 struct {
	// The name of a quota object.
	Name string

	// The hard resource limit string before parsing.
	Hard string

	// The scopes of a quota object before parsing.
	Scopes string
}

ResourceQuotaGeneratorV1 supports stable generation of a resource quota

func (ResourceQuotaGeneratorV1) Generate added in v1.4.0

func (g ResourceQuotaGeneratorV1) Generate(genericParams map[string]interface{}) (runtime.Object, error)

func (ResourceQuotaGeneratorV1) ParamNames added in v1.4.0

func (g ResourceQuotaGeneratorV1) ParamNames() []GeneratorParam

ParamNames returns the set of supported input parameters when using the parameter injection generator pattern

func (*ResourceQuotaGeneratorV1) StructuredGenerate added in v1.4.0

func (g *ResourceQuotaGeneratorV1) StructuredGenerate() (runtime.Object, error)

StructuredGenerate outputs a ResourceQuota object using the configured fields

type RetryParams added in v0.15.0

type RetryParams struct {
	Interval, Timeout time.Duration
}

RetryParams encapsulates the retry parameters used by kubectl's scaler.

func NewRetryParams added in v0.18.0

func NewRetryParams(interval, timeout time.Duration) *RetryParams

type RoleBindingGeneratorV1 added in v1.6.0

type RoleBindingGeneratorV1 struct {
	// Name of roleBinding (required)
	Name string
	// ClusterRole for the roleBinding
	ClusterRole string
	// Role for the roleBinding
	Role string
	// Users to derive the roleBinding from (optional)
	Users []string
	// Groups to derive the roleBinding from (optional)
	Groups []string
	// ServiceAccounts to derive the roleBinding from in namespace:name format(optional)
	ServiceAccounts []string
}

RoleBindingGeneratorV1 supports stable generation of a roleBinding.

func (RoleBindingGeneratorV1) Generate added in v1.6.0

func (s RoleBindingGeneratorV1) Generate(genericParams map[string]interface{}) (runtime.Object, error)

Generate returns a roleBinding using the specified parameters.

func (RoleBindingGeneratorV1) ParamNames added in v1.6.0

func (s RoleBindingGeneratorV1) ParamNames() []GeneratorParam

ParamNames returns the set of supported input parameters when using the parameter injection generator pattern.

func (RoleBindingGeneratorV1) StructuredGenerate added in v1.6.0

func (s RoleBindingGeneratorV1) StructuredGenerate() (runtime.Object, error)

StructuredGenerate outputs a roleBinding object using the configured fields.

type RollbackVisitor added in v1.10.0

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

func (*RollbackVisitor) VisitCronJob added in v1.10.0

func (v *RollbackVisitor) VisitCronJob(kind kapps.GroupKindElement)

func (*RollbackVisitor) VisitDaemonSet added in v1.10.0

func (v *RollbackVisitor) VisitDaemonSet(kind kapps.GroupKindElement)

func (*RollbackVisitor) VisitDeployment added in v1.10.0

func (v *RollbackVisitor) VisitDeployment(elem kapps.GroupKindElement)

func (*RollbackVisitor) VisitJob added in v1.10.0

func (v *RollbackVisitor) VisitJob(kind kapps.GroupKindElement)

func (*RollbackVisitor) VisitPod added in v1.10.0

func (v *RollbackVisitor) VisitPod(kind kapps.GroupKindElement)

func (*RollbackVisitor) VisitReplicaSet added in v1.10.0

func (v *RollbackVisitor) VisitReplicaSet(kind kapps.GroupKindElement)

func (*RollbackVisitor) VisitReplicationController added in v1.10.0

func (v *RollbackVisitor) VisitReplicationController(kind kapps.GroupKindElement)

func (*RollbackVisitor) VisitStatefulSet added in v1.10.0

func (v *RollbackVisitor) VisitStatefulSet(kind kapps.GroupKindElement)

type Rollbacker added in v1.2.0

type Rollbacker interface {
	Rollback(obj runtime.Object, updatedAnnotations map[string]string, toRevision int64, dryRun bool) (string, error)
}

Rollbacker provides an interface for resources that can be rolled back.

func RollbackerFor added in v1.2.0

func RollbackerFor(kind schema.GroupKind, c kubernetes.Interface) (Rollbacker, error)

RollbackerFor returns an implementation of Rollbacker interface for the given schema kind

type RollingUpdater added in v0.9.0

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

RollingUpdater provides methods for updating replicated pods in a predictable, fault-tolerant way.

func NewRollingUpdater added in v0.9.0

NewRollingUpdater creates a RollingUpdater from a client.

func (*RollingUpdater) Update added in v0.9.0

func (r *RollingUpdater) Update(config *RollingUpdaterConfig) error

Update all pods for a ReplicationController (oldRc) by creating a new controller (newRc) with 0 replicas, and synchronously scaling oldRc and newRc until oldRc has 0 replicas and newRc has the original # of desired replicas. Cleanup occurs based on a RollingUpdaterCleanupPolicy.

Each interval, the updater will attempt to make progress however it can without violating any availability constraints defined by the config. This means the amount scaled up or down each interval will vary based on the timeliness of readiness and the updater will always try to make progress, even slowly.

If an update from newRc to oldRc is already in progress, we attempt to drive it to completion. If an error occurs at any step of the update, the error will be returned.

A scaling event (either up or down) is considered progress; if no progress is made within the config.Timeout, an error is returned.

TODO: make this handle performing a rollback of a partially completed rollout.

type RollingUpdaterCleanupPolicy added in v0.16.0

type RollingUpdaterCleanupPolicy string

RollingUpdaterCleanupPolicy is a cleanup action to take after the deployment is complete.

const (
	// DeleteRollingUpdateCleanupPolicy means delete the old controller.
	DeleteRollingUpdateCleanupPolicy RollingUpdaterCleanupPolicy = "Delete"
	// PreserveRollingUpdateCleanupPolicy means keep the old controller.
	PreserveRollingUpdateCleanupPolicy RollingUpdaterCleanupPolicy = "Preserve"
	// RenameRollingUpdateCleanupPolicy means delete the old controller, and rename
	// the new controller to the name of the old controller.
	RenameRollingUpdateCleanupPolicy RollingUpdaterCleanupPolicy = "Rename"
)

type RollingUpdaterConfig added in v0.16.0

type RollingUpdaterConfig struct {
	// Out is a writer for progress output.
	Out io.Writer
	// OldRC is an existing controller to be replaced.
	OldRc *corev1.ReplicationController
	// NewRc is a controller that will take ownership of updated pods (will be
	// created if needed).
	NewRc *corev1.ReplicationController
	// UpdatePeriod is the time to wait between individual pod updates.
	UpdatePeriod time.Duration
	// Interval is the time to wait between polling controller status after
	// update.
	Interval time.Duration
	// Timeout is the time to wait for controller updates before giving up.
	Timeout time.Duration
	// MinReadySeconds is the number of seconds to wait after the pods are ready
	MinReadySeconds int32
	// CleanupPolicy defines the cleanup action to take after the deployment is
	// complete.
	CleanupPolicy RollingUpdaterCleanupPolicy
	// MaxUnavailable is the maximum number of pods that can be unavailable during the update.
	// Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
	// Absolute number is calculated from percentage by rounding up.
	// This can not be 0 if MaxSurge is 0.
	// By default, a fixed value of 1 is used.
	// Example: when this is set to 30%, the old RC can be scaled down to 70% of desired pods
	// immediately when the rolling update starts. Once new pods are ready, old RC
	// can be scaled down further, followed by scaling up the new RC, ensuring
	// that the total number of pods available at all times during the update is at
	// least 70% of desired pods.
	MaxUnavailable intstr.IntOrString
	// MaxSurge is the maximum number of pods that can be scheduled above the desired number of pods.
	// Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
	// This can not be 0 if MaxUnavailable is 0.
	// Absolute number is calculated from percentage by rounding up.
	// By default, a value of 1 is used.
	// Example: when this is set to 30%, the new RC can be scaled up immediately
	// when the rolling update starts, such that the total number of old and new pods do not exceed
	// 130% of desired pods. Once old pods have been killed, new RC can be scaled up
	// further, ensuring that total number of pods running at any time during
	// the update is atmost 130% of desired pods.
	MaxSurge intstr.IntOrString
	// OnProgress is invoked if set during each scale cycle, to allow the caller to perform additional logic or
	// abort the scale. If an error is returned the cleanup method will not be invoked. The percentage value
	// is a synthetic "progress" calculation that represents the approximate percentage completion.
	OnProgress func(oldRc, newRc *corev1.ReplicationController, percentage int) error
}

RollingUpdaterConfig is the configuration for a rolling deployment process.

type RuntimeSort added in v1.1.0

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

RuntimeSort is an implementation of the golang sort interface that knows how to sort lists of runtime.Object

func NewRuntimeSort added in v1.2.0

func NewRuntimeSort(field string, objs []runtime.Object) *RuntimeSort

func SortObjects added in v1.2.0

func SortObjects(decoder runtime.Decoder, objs []runtime.Object, fieldInput string) (*RuntimeSort, error)

func (*RuntimeSort) Len added in v1.1.0

func (r *RuntimeSort) Len() int

func (*RuntimeSort) Less added in v1.1.0

func (r *RuntimeSort) Less(i, j int) bool

func (*RuntimeSort) OriginalPosition added in v1.2.0

func (r *RuntimeSort) OriginalPosition(ix int) int

Returns the starting (original) position of a particular index. e.g. If OriginalPosition(0) returns 5 than the the item currently at position 0 was at position 5 in the original unsorted array.

func (*RuntimeSort) Swap added in v1.1.0

func (r *RuntimeSort) Swap(i, j int)

type ScalePrecondition added in v0.18.0

type ScalePrecondition struct {
	Size            int
	ResourceVersion string
}

ScalePrecondition describes a condition that must be true for the scale to take place If CurrentSize == -1, it is ignored. If CurrentResourceVersion is the empty string, it is ignored. Otherwise they must equal the values in the resource for it to be valid.

type Scaler added in v0.18.0

type Scaler interface {
	// Scale scales the named resource after checking preconditions. It optionally
	// retries in the event of resource version mismatch (if retry is not nil),
	// and optionally waits until the status of the resource matches newSize (if wait is not nil)
	// TODO: Make the implementation of this watch-based (#56075) once #31345 is fixed.
	Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, wait *RetryParams, gr schema.GroupResource) error
	// ScaleSimple does a simple one-shot attempt at scaling - not useful on its own, but
	// a necessary building block for Scale
	ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint, gr schema.GroupResource) (updatedResourceVersion string, err error)
}

Scaler provides an interface for resources that can be scaled.

func NewScaler added in v1.11.0

func NewScaler(scalesGetter scaleclient.ScalesGetter) Scaler

NewScaler get a scaler for a given resource

type SecretForDockerRegistryGeneratorV1 added in v1.2.0

type SecretForDockerRegistryGeneratorV1 struct {
	// Name of secret (required)
	Name string
	// FileSources to derive the secret from (optional)
	FileSources []string
	// Username for registry (required)
	Username string
	// Email for registry (optional)
	Email string
	// Password for registry (required)
	Password string
	// Server for registry (required)
	Server string
	// AppendHash; if true, derive a hash from the Secret and append it to the name
	AppendHash bool
}

SecretForDockerRegistryGeneratorV1 supports stable generation of a docker registry secret

func (SecretForDockerRegistryGeneratorV1) Generate added in v1.2.0

func (s SecretForDockerRegistryGeneratorV1) Generate(genericParams map[string]interface{}) (runtime.Object, error)

Generate returns a secret using the specified parameters

func (SecretForDockerRegistryGeneratorV1) ParamNames added in v1.2.0

ParamNames returns the set of supported input parameters when using the parameter injection generator pattern

func (SecretForDockerRegistryGeneratorV1) StructuredGenerate added in v1.2.0

func (s SecretForDockerRegistryGeneratorV1) StructuredGenerate() (runtime.Object, error)

StructuredGenerate outputs a secret object using the configured fields

type SecretForTLSGeneratorV1 added in v1.3.0

type SecretForTLSGeneratorV1 struct {
	// Name is the name of this TLS secret.
	Name string
	// Key is the path to the user's private key.
	Key string
	// Cert is the path to the user's public key certificate.
	Cert string
	// AppendHash; if true, derive a hash from the Secret and append it to the name
	AppendHash bool
}

SecretForTLSGeneratorV1 supports stable generation of a TLS secret.

func (SecretForTLSGeneratorV1) Generate added in v1.3.0

func (s SecretForTLSGeneratorV1) Generate(genericParams map[string]interface{}) (runtime.Object, error)

Generate returns a secret using the specified parameters

func (SecretForTLSGeneratorV1) ParamNames added in v1.3.0

func (s SecretForTLSGeneratorV1) ParamNames() []GeneratorParam

ParamNames returns the set of supported input parameters when using the parameter injection generator pattern

func (SecretForTLSGeneratorV1) StructuredGenerate added in v1.3.0

func (s SecretForTLSGeneratorV1) StructuredGenerate() (runtime.Object, error)

StructuredGenerate outputs a secret object using the configured fields

type SecretGeneratorV1 added in v1.2.0

type SecretGeneratorV1 struct {
	// Name of secret (required)
	Name string
	// Type of secret (optional)
	Type string
	// FileSources to derive the secret from (optional)
	FileSources []string
	// LiteralSources to derive the secret from (optional)
	LiteralSources []string
	// EnvFileSource to derive the secret from (optional)
	EnvFileSource string
	// AppendHash; if true, derive a hash from the Secret data and type and append it to the name
	AppendHash bool
}

SecretGeneratorV1 supports stable generation of an opaque secret

func (SecretGeneratorV1) Generate added in v1.2.0

func (s SecretGeneratorV1) Generate(genericParams map[string]interface{}) (runtime.Object, error)

Generate returns a secret using the specified parameters

func (SecretGeneratorV1) ParamNames added in v1.2.0

func (s SecretGeneratorV1) ParamNames() []GeneratorParam

ParamNames returns the set of supported input parameters when using the parameter injection generator pattern

func (SecretGeneratorV1) StructuredGenerate added in v1.2.0

func (s SecretGeneratorV1) StructuredGenerate() (runtime.Object, error)

StructuredGenerate outputs a secret object using the configured fields

type ServiceAccountGeneratorV1 added in v1.2.0

type ServiceAccountGeneratorV1 struct {
	// Name of service account
	Name string
}

ServiceAccountGeneratorV1 supports stable generation of a service account

func (*ServiceAccountGeneratorV1) StructuredGenerate added in v1.2.0

func (g *ServiceAccountGeneratorV1) StructuredGenerate() (runtime.Object, error)

StructuredGenerate outputs a service account object using the configured fields

type ServiceClusterIPGeneratorV1 added in v1.4.0

type ServiceClusterIPGeneratorV1 struct {
	ServiceCommonGeneratorV1
}

func (ServiceClusterIPGeneratorV1) Generate added in v1.4.0

func (s ServiceClusterIPGeneratorV1) Generate(params map[string]interface{}) (runtime.Object, error)

func (ServiceClusterIPGeneratorV1) ParamNames added in v1.4.0

type ServiceCommonGeneratorV1 added in v1.4.0

type ServiceCommonGeneratorV1 struct {
	Name         string
	TCP          []string
	Type         v1.ServiceType
	ClusterIP    string
	NodePort     int
	ExternalName string
}

func (ServiceCommonGeneratorV1) GenerateCommon added in v1.4.0

func (s ServiceCommonGeneratorV1) GenerateCommon(params map[string]interface{}) error

func (ServiceCommonGeneratorV1) StructuredGenerate added in v1.4.0

func (s ServiceCommonGeneratorV1) StructuredGenerate() (runtime.Object, error)

type ServiceExternalNameGeneratorV1 added in v1.6.0

type ServiceExternalNameGeneratorV1 struct {
	ServiceCommonGeneratorV1
}

TODO: is this really necessary?

func (ServiceExternalNameGeneratorV1) Generate added in v1.6.0

func (s ServiceExternalNameGeneratorV1) Generate(params map[string]interface{}) (runtime.Object, error)

func (ServiceExternalNameGeneratorV1) ParamNames added in v1.6.0

type ServiceGeneratorV1 added in v1.0.1

type ServiceGeneratorV1 struct{}

The only difference between ServiceGeneratorV1 and V2 is that the service port is named "default" in V1, while it is left unnamed in V2.

func (ServiceGeneratorV1) Generate added in v1.0.1

func (ServiceGeneratorV1) Generate(params map[string]interface{}) (runtime.Object, error)

func (ServiceGeneratorV1) ParamNames added in v1.0.1

func (ServiceGeneratorV1) ParamNames() []GeneratorParam

type ServiceGeneratorV2 added in v1.0.1

type ServiceGeneratorV2 struct{}

func (ServiceGeneratorV2) Generate added in v1.0.1

func (ServiceGeneratorV2) Generate(params map[string]interface{}) (runtime.Object, error)

func (ServiceGeneratorV2) ParamNames added in v1.0.1

func (ServiceGeneratorV2) ParamNames() []GeneratorParam

type ServiceLoadBalancerGeneratorV1 added in v1.4.0

type ServiceLoadBalancerGeneratorV1 struct {
	ServiceCommonGeneratorV1
}

func (ServiceLoadBalancerGeneratorV1) Generate added in v1.4.0

func (s ServiceLoadBalancerGeneratorV1) Generate(params map[string]interface{}) (runtime.Object, error)

func (ServiceLoadBalancerGeneratorV1) ParamNames added in v1.4.0

type ServiceNodePortGeneratorV1 added in v1.4.0

type ServiceNodePortGeneratorV1 struct {
	ServiceCommonGeneratorV1
}

func (ServiceNodePortGeneratorV1) Generate added in v1.4.0

func (s ServiceNodePortGeneratorV1) Generate(params map[string]interface{}) (runtime.Object, error)

func (ServiceNodePortGeneratorV1) ParamNames added in v1.4.0

type SortingPrinter added in v1.1.0

type SortingPrinter struct {
	SortField string
	Delegate  printers.ResourcePrinter
	Decoder   runtime.Decoder
}

Sorting printer sorts list types before delegating to another printer. Non-list types are simply passed through

func (*SortingPrinter) PrintObj added in v1.1.0

func (s *SortingPrinter) PrintObj(obj runtime.Object, out io.Writer) error

type StatefulSetHistoryViewer added in v1.7.0

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

func (*StatefulSetHistoryViewer) ViewHistory added in v1.7.0

func (h *StatefulSetHistoryViewer) ViewHistory(namespace, name string, revision int64) (string, error)

ViewHistory returns a list of the revision history of a statefulset TODO: this should be a describer TODO: needs to implement detailed revision view

type StatefulSetRollbacker added in v1.8.0

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

func (*StatefulSetRollbacker) Rollback added in v1.8.0

func (r *StatefulSetRollbacker) Rollback(obj runtime.Object, updatedAnnotations map[string]string, toRevision int64, dryRun bool) (string, error)

toRevision is a non-negative integer, with 0 being reserved to indicate rolling back to previous configuration

type StatefulSetStatusViewer added in v1.7.0

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

StatefulSetStatusViewer implements the StatusViewer interface.

func (*StatefulSetStatusViewer) Status added in v1.7.0

func (s *StatefulSetStatusViewer) Status(obj runtime.Unstructured, revision int64) (string, bool, error)

Status returns a message describing statefulset status, and a bool value indicating if the status is considered done.

type StatusViewer added in v1.3.0

type StatusViewer interface {
	Status(obj runtime.Unstructured, revision int64) (string, bool, error)
}

StatusViewer provides an interface for resources that have rollout status.

func StatusViewerFor added in v1.3.0

func StatusViewerFor(kind schema.GroupKind, c kubernetes.Interface) (StatusViewer, error)

StatusViewerFor returns a StatusViewer for the resource specified by kind.

type StructuredGenerator added in v1.2.0

type StructuredGenerator interface {
	// StructuredGenerator creates an API object using pre-configured parameters
	StructuredGenerate() (runtime.Object, error)
}

StructuredGenerator is an interface for things that can generate API objects not using parameter injection

type TableSorter added in v1.12.0

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

func NewTableSorter added in v1.12.0

func NewTableSorter(table *metav1beta1.Table, field string) *TableSorter

func (*TableSorter) Len added in v1.12.0

func (t *TableSorter) Len() int

func (*TableSorter) Less added in v1.12.0

func (t *TableSorter) Less(i, j int) bool

func (*TableSorter) Sort added in v1.12.0

func (t *TableSorter) Sort() error

func (*TableSorter) Swap added in v1.12.0

func (t *TableSorter) Swap(i, j int)

Directories

Path Synopsis
cmd
get
scalejob
Package scalejob is deprecated This package contains deprecated functions used to "scale" jobs in a way inconsistent with normal scaling rules
Package scalejob is deprecated This package contains deprecated functions used to "scale" jobs in a way inconsistent with normal scaling rules
set
set/env
Package env provides functions to incorporate environment variables into set env.
Package env provides functions to incorporate environment variables into set env.
util/openapi
Package openapi is a collection of libraries for fetching the openapi spec from a Kubernetes server and then indexing the type definitions.
Package openapi is a collection of libraries for fetching the openapi spec from a Kubernetes server and then indexing the type definitions.

Jump to

Keyboard shortcuts

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