Documentation

Overview

Package kubectl is a set of libraries that are used by the kubectl command line tool. They are separated out into a library to support unit testing. Most functionality should be included in this package, and the main kubectl should really just be an entry point.

A set of common functions needed by cmd/kubectl and pkg/kubectl packages.

Index

Constants

View Source
const (
	ServiceAccountNameAnnotation = "federation.kubernetes.io/servive-account-name"
	ClusterRoleNameAnnotation    = "federation.kubernetes.io/cluster-role-name"
)
View Source
const (
	DefaultHostAcceptRE   = "^localhost$,^127\\.0\\.0\\.1$,^\\[::1\\]$"
	DefaultPathAcceptRE   = "^.*"
	DefaultPathRejectRE   = "^/api/.*/pods/.*/exec,^/api/.*/pods/.*/attach"
	DefaultMethodRejectRE = "^$"
)
View Source
const (
	Interval = time.Second * 1
	Timeout  = time.Minute * 5
)
View Source
const (
	ChangeCauseAnnotation = "kubernetes.io/change-cause"
)

Variables

View Source
var ResourcesShortcutStatic = []ResourceShortcuts{

	{
		ShortForm: schema.GroupResource{Resource: "cm"},
		LongForm:  schema.GroupResource{Resource: "configmaps"},
	},
	{
		ShortForm: schema.GroupResource{Resource: "cs"},
		LongForm:  schema.GroupResource{Resource: "componentstatuses"},
	},
	{
		ShortForm: schema.GroupResource{Resource: "ep"},
		LongForm:  schema.GroupResource{Resource: "endpoints"},
	},
	{
		ShortForm: schema.GroupResource{Resource: "ev"},
		LongForm:  schema.GroupResource{Resource: "events"},
	},
	{
		ShortForm: schema.GroupResource{Resource: "limits"},
		LongForm:  schema.GroupResource{Resource: "limitranges"},
	},
	{
		ShortForm: schema.GroupResource{Resource: "no"},
		LongForm:  schema.GroupResource{Resource: "nodes"},
	},
	{
		ShortForm: schema.GroupResource{Resource: "ns"},
		LongForm:  schema.GroupResource{Resource: "namespaces"},
	},
	{
		ShortForm: schema.GroupResource{Resource: "po"},
		LongForm:  schema.GroupResource{Resource: "pods"},
	},
	{
		ShortForm: schema.GroupResource{Resource: "pvc"},
		LongForm:  schema.GroupResource{Resource: "persistentvolumeclaims"},
	},
	{
		ShortForm: schema.GroupResource{Resource: "pv"},
		LongForm:  schema.GroupResource{Resource: "persistentvolumes"},
	},
	{
		ShortForm: schema.GroupResource{Resource: "quota"},
		LongForm:  schema.GroupResource{Resource: "resourcequotas"},
	},
	{
		ShortForm: schema.GroupResource{Resource: "rc"},
		LongForm:  schema.GroupResource{Resource: "replicationcontrollers"},
	},
	{
		ShortForm: schema.GroupResource{Resource: "rs"},
		LongForm:  schema.GroupResource{Resource: "replicasets"},
	},
	{
		ShortForm: schema.GroupResource{Resource: "sa"},
		LongForm:  schema.GroupResource{Resource: "serviceaccounts"},
	},
	{
		ShortForm: schema.GroupResource{Resource: "svc"},
		LongForm:  schema.GroupResource{Resource: "services"},
	},
	{
		ShortForm: schema.GroupResource{Group: "autoscaling", Resource: "hpa"},
		LongForm:  schema.GroupResource{Group: "autoscaling", Resource: "horizontalpodautoscalers"},
	},
	{
		ShortForm: schema.GroupResource{Group: "certificates.k8s.io", Resource: "csr"},
		LongForm:  schema.GroupResource{Group: "certificates.k8s.io", Resource: "certificatesigningrequests"},
	},
	{
		ShortForm: schema.GroupResource{Group: "policy", Resource: "pdb"},
		LongForm:  schema.GroupResource{Group: "policy", Resource: "poddisruptionbudgets"},
	},
	{
		ShortForm: schema.GroupResource{Group: "extensions", Resource: "deploy"},
		LongForm:  schema.GroupResource{Group: "extensions", Resource: "deployments"},
	},
	{
		ShortForm: schema.GroupResource{Group: "extensions", Resource: "ds"},
		LongForm:  schema.GroupResource{Group: "extensions", Resource: "daemonsets"},
	},
	{
		ShortForm: schema.GroupResource{Group: "extensions", Resource: "hpa"},
		LongForm:  schema.GroupResource{Group: "extensions", Resource: "horizontalpodautoscalers"},
	},
	{
		ShortForm: schema.GroupResource{Group: "extensions", Resource: "ing"},
		LongForm:  schema.GroupResource{Group: "extensions", Resource: "ingresses"},
	},
	{
		ShortForm: schema.GroupResource{Group: "extensions", Resource: "netpol"},
		LongForm:  schema.GroupResource{Group: "extensions", Resource: "networkpolicies"},
	},
	{
		ShortForm: schema.GroupResource{Group: "extensions", Resource: "psp"},
		LongForm:  schema.GroupResource{Group: "extensions", Resource: "podSecurityPolicies"},
	},
}

ResourcesShortcutStatic is the list of short names to their expanded names. Note that the list is ordered by group.

View Source
var (
	// The reverse proxy will periodically flush the io writer at this frequency.
	// Only matters for long poll connections like the one used to watch. With an
	// interval of 0 the reverse proxy will buffer content sent on any connection
	// with transfer-encoding=chunked.
	// TODO: Flush after each chunk so the client doesn't suffer a 100ms latency per
	// watch event.
	ReverseProxyFlushInterval = 100 * time.Millisecond
)

Functions

func AbortRollingUpdate

func AbortRollingUpdate(c *RollingUpdaterConfig) error

func AddDeploymentKeyToReplicationController

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

func AddJsonFilenameFlag

func AddJsonFilenameFlag(cmd *cobra.Command, value *[]string, usage string)

func AnnotateFlags

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

AnnotateFlags annotates all flags that are used by generators.

func CreateApplyAnnotation

func CreateApplyAnnotation(info *resource.Info, 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 CreateOrUpdateAnnotation

func CreateOrUpdateAnnotation(createAnnotation bool, info *resource.Info, 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 DecodeUnknownObject

func DecodeUnknownObject(obj runtime.Object) (runtime.Object, error)

check if the object is unstructured. If so, let's attempt to convert it to a type we can understand.

func EnsureFlagsValid

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 GetBool

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

func GetModifiedConfiguration

func GetModifiedConfiguration(info *resource.Info, 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

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

func GetOriginalConfiguration

func GetOriginalConfiguration(mapping *meta.RESTMapping, obj runtime.Object) ([]byte, error)

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

func HandleResourceRequirements

func HandleResourceRequirements(params map[string]string) (api.ResourceRequirements, error)

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

func HandleResourceRequirementsV1

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

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

func IsNoSuchReaperError

func IsNoSuchReaperError(err error) bool

func IsZero

func IsZero(i interface{}) bool

func LoadExistingNextReplicationController

func LoadExistingNextReplicationController(c coreclient.ReplicationControllersGetter, namespace, newName string) (*api.ReplicationController, error)

func MakeLabels

func MakeLabels(labels map[string]string) string

func MakeParams

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

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

func MakeProtocols

func MakeProtocols(protocols map[string]string) string

func MakeRegexpArray

func MakeRegexpArray(str string) ([]*regexp.Regexp, error)

Splits a comma separated list of regexps into an array of Regexp objects.

func MakeRegexpArrayOrDie

func MakeRegexpArrayOrDie(str string) []*regexp.Regexp

func ParseLabels

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

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

func ParseProtocols

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

func PrintModelDescription

func PrintModelDescription(inModel string, fieldsPath []string, w io.Writer, swaggerSchema *swagger.ApiDeclaration, r bool) error

PrintModelDescription prints the description of a specific model or dot path

func ResourceAliases

func ResourceAliases(rs []string) []string

ResourceAliases returns the resource shortcuts and plural forms for the given resources.

func ResourceShortFormFor

func ResourceShortFormFor(resource string) (string, bool)

ResourceShortFormFor looks up for a short form of resource names. TODO: Change the signature of this function so that it can make use of ResourceShortcuts.

func ScaleCondition

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

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

func SetNextControllerAnnotation

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

func SetOriginalConfiguration

func SetOriginalConfiguration(info *resource.Info, original []byte) error

SetOriginalConfiguration sets the original configuration of the object as the annotation on the object for later use in computing a three way patch.

func SplitAndParseResourceRequest

func SplitAndParseResourceRequest(inResource string, mapper meta.RESTMapper) (string, []string, error)

SplitAndParseResourceRequest separates the users input into a model and fields

func UpdateApplyAnnotation

func UpdateApplyAnnotation(info *resource.Info, codec runtime.Encoder) error

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

func UpdateExistingReplicationController

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

func ValidateParams

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

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

Types

type BasicPod

type BasicPod struct{}

func (BasicPod) Generate

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

func (BasicPod) ParamNames

func (BasicPod) ParamNames() []GeneratorParam

type BasicReplicationController

type BasicReplicationController struct{}

func (BasicReplicationController) Generate

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

func (BasicReplicationController) ParamNames

type ClusterGeneratorV1Beta1

type ClusterGeneratorV1Beta1 struct {
	// Name of the cluster context (required)
	Name string
	// ClientCIDR is the CIDR range in which the Kubernetes APIServer
	// is available for the client (optional)
	ClientCIDR string
	// ServerAddress is the APIServer address of the Kubernetes cluster
	// that is being registered (required)
	ServerAddress string
	// SecretName is the name of the secret that stores the credentials
	// for the Kubernetes cluster that is being registered (optional)
	SecretName string
	// ServiceAccountName is the name of the service account that is
	// created in the cluster being registered. If this is provided,
	// then ClusterRoleName must also be provided (optional)
	ServiceAccountName string
	// ClusterRoleName is the name of the cluster role and cluster role
	// binding that are created in the cluster being registered. If this
	// is provided, then ServiceAccountName must also be provided
	// (optional)
	ClusterRoleName string
}

ClusterGeneratorV1Beta1 supports stable generation of a federation/cluster resource.

func (ClusterGeneratorV1Beta1) Generate

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

Generate returns a cluster resource using the specified parameters.

func (ClusterGeneratorV1Beta1) ParamNames

func (s ClusterGeneratorV1Beta1) ParamNames() []GeneratorParam

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

func (ClusterGeneratorV1Beta1) StructuredGenerate

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

StructuredGenerate outputs a federation cluster resource object using the configured fields.

type ClusterRoleBindingGeneratorV1

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

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

Generate returns a clusterRoleBinding using the specified parameters.

func (ClusterRoleBindingGeneratorV1) ParamNames

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

func (ClusterRoleBindingGeneratorV1) StructuredGenerate

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

StructuredGenerate outputs a clusterRoleBinding object using the configured fields.

type ConfigMapGeneratorV1

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
}

ConfigMapGeneratorV1 supports stable generation of a configMap.

func (ConfigMapGeneratorV1) Generate

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

Generate returns a configMap using the specified parameters.

func (ConfigMapGeneratorV1) ParamNames

func (s ConfigMapGeneratorV1) ParamNames() []GeneratorParam

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

func (ConfigMapGeneratorV1) StructuredGenerate

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

StructuredGenerate outputs a configMap object using the configured fields.

type CronJobV2Alpha1

type CronJobV2Alpha1 struct{}

func (CronJobV2Alpha1) Generate

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

func (CronJobV2Alpha1) ParamNames

func (CronJobV2Alpha1) ParamNames() []GeneratorParam

type DaemonSetHistoryViewer

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

func (*DaemonSetHistoryViewer) ViewHistory

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 DaemonSetReaper

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

func (*DaemonSetReaper) Stop

func (reaper *DaemonSetReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *metav1.DeleteOptions) error

type DaemonSetRollbacker

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

func (*DaemonSetRollbacker) Rollback

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

type DaemonSetStatusViewer

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

func (*DaemonSetStatusViewer) Status

func (s *DaemonSetStatusViewer) Status(namespace, name string, 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

type DeploymentAppsV1Beta1 struct{}

func (DeploymentAppsV1Beta1) Generate

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

func (DeploymentAppsV1Beta1) ParamNames

func (DeploymentAppsV1Beta1) ParamNames() []GeneratorParam

type DeploymentBasicAppsGeneratorV1

type DeploymentBasicAppsGeneratorV1 struct {
	Name   string
	Images []string
}

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

func (DeploymentBasicAppsGeneratorV1) Generate

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

func (DeploymentBasicAppsGeneratorV1) ParamNames

func (*DeploymentBasicAppsGeneratorV1) StructuredGenerate

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

StructuredGenerate outputs a deployment object using the configured fields

type DeploymentBasicGeneratorV1

type DeploymentBasicGeneratorV1 struct {
	Name   string
	Images []string
}

DeploymentBasicGeneratorV1 supports stable generation of a deployment

func (DeploymentBasicGeneratorV1) Generate

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

func (DeploymentBasicGeneratorV1) ParamNames

func (*DeploymentBasicGeneratorV1) StructuredGenerate

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

StructuredGenerate outputs a deployment object using the configured fields

type DeploymentHistoryViewer

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

func (*DeploymentHistoryViewer) ViewHistory

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 DeploymentReaper

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

func (*DeploymentReaper) Stop

func (reaper *DeploymentReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *metav1.DeleteOptions) error

type DeploymentRollbacker

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

func (*DeploymentRollbacker) Rollback

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

type DeploymentScaler

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

func (*DeploymentScaler) Scale

func (scaler *DeploymentScaler) Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, waitForReplicas *RetryParams) error

Scale updates a deployment to a new size, with optional precondition check (if preconditions is not nil), optional retries (if retry is not nil), and then optionally waits for the status to reach desired count.

func (*DeploymentScaler) ScaleSimple

func (scaler *DeploymentScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) (string, error)

ScaleSimple is responsible for updating a deployment's desired replicas count. It returns the resourceVersion of the deployment if the update is successful.

type DeploymentStatusViewer

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

func (*DeploymentStatusViewer) Status

func (s *DeploymentStatusViewer) Status(namespace, name string, 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

type DeploymentV1Beta1 struct{}

func (DeploymentV1Beta1) Generate

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

func (DeploymentV1Beta1) ParamNames

func (DeploymentV1Beta1) ParamNames() []GeneratorParam

type FilterFunc

type FilterFunc func(runtime.Object, printers.PrintOptions) bool

FilterFunc is a function that knows how to filter a specific resource kind. It receives a generic runtime.Object which must be type-checked by the function. Returns a boolean value true if a resource is filtered, or false otherwise.

type FilterServer

type FilterServer struct {
	// Only paths that match this regexp will be accepted
	AcceptPaths []*regexp.Regexp
	// Paths that match this regexp will be rejected, even if they match the above
	RejectPaths []*regexp.Regexp
	// Hosts are required to match this list of regexp
	AcceptHosts []*regexp.Regexp
	// Methods that match this regexp are rejected
	RejectMethods []*regexp.Regexp
	// contains filtered or unexported fields
}

FilterServer rejects requests which don't match one of the specified regular expressions

func (*FilterServer) HandlerFor

func (f *FilterServer) HandlerFor(delegate http.Handler) *FilterServer

Make a copy of f which passes requests along to the new delegate.

func (*FilterServer) ServeHTTP

func (f *FilterServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type Filters

type Filters []FilterFunc

Filters is a collection of filter funcs

func NewResourceFilter

func NewResourceFilter() Filters

func (Filters) Filter

func (f Filters) Filter(obj runtime.Object, opts *printers.PrintOptions) (bool, error)

Filter loops through a collection of FilterFuncs until it finds one that can filter the given resource

type Generator

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.

type GeneratorParam

type GeneratorParam struct {
	Name     string
	Required bool
}

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

type HistoryViewer

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

HistoryViewer provides an interface for resources have historical information.

func HistoryViewerFor

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

type HorizontalPodAutoscalerV1

type HorizontalPodAutoscalerV1 struct{}

func (HorizontalPodAutoscalerV1) Generate

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

func (HorizontalPodAutoscalerV1) ParamNames

type JobReaper

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

func (*JobReaper) Stop

func (reaper *JobReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *metav1.DeleteOptions) error

type JobScaler

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

func (*JobScaler) Scale

func (scaler *JobScaler) Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, waitForReplicas *RetryParams) error

Scale updates a Job to a new size, with optional precondition check (if preconditions is not nil), optional retries (if retry is not nil), and then optionally waits for parallelism to reach desired number, which can be less than requested based on job's current progress.

func (*JobScaler) ScaleSimple

func (scaler *JobScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) (string, error)

ScaleSimple is responsible for updating job's parallelism. It returns the resourceVersion of the job if the update is successful.

type JobV1

type JobV1 struct{}

func (JobV1) Generate

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

func (JobV1) ParamNames

func (JobV1) ParamNames() []GeneratorParam

type NamespaceGeneratorV1

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

NamespaceGeneratorV1 supports stable generation of a namespace

func (NamespaceGeneratorV1) Generate

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

Generate returns a namespace using the specified parameters

func (NamespaceGeneratorV1) ParamNames

func (g NamespaceGeneratorV1) ParamNames() []GeneratorParam

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

func (*NamespaceGeneratorV1) StructuredGenerate

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

StructuredGenerate outputs a namespace object using the configured fields

type NamespaceInfo

type NamespaceInfo struct {
	Namespace string
}

type NewControllerConfig

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

type NoSuchReaperError

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

func (*NoSuchReaperError) Error

func (n *NoSuchReaperError) Error() string

type PodDisruptionBudgetV1Generator

type PodDisruptionBudgetV1Generator struct {
	Name         string
	MinAvailable string
	Selector     string
}

PodDisruptionBudgetV1Generator supports stable generation of a pod disruption budget.

func (PodDisruptionBudgetV1Generator) Generate

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

func (PodDisruptionBudgetV1Generator) ParamNames

func (*PodDisruptionBudgetV1Generator) StructuredGenerate

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

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

type PodDisruptionBudgetV2Generator

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

PodDisruptionBudgetV2Generator supports stable generation of a pod disruption budget.

func (PodDisruptionBudgetV2Generator) Generate

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

func (PodDisruptionBudgetV2Generator) ParamNames

func (*PodDisruptionBudgetV2Generator) StructuredGenerate

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

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

type PodReaper

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

func (*PodReaper) Stop

func (reaper *PodReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *metav1.DeleteOptions) error

type PreconditionError

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

func (pe PreconditionError) Error() string

type ProxyServer

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

ProxyServer is a http.Handler which proxies Kubernetes APIs to remote API server.

func NewProxyServer

func NewProxyServer(filebase string, apiProxyPrefix string, staticPrefix string, filter *FilterServer, cfg *restclient.Config) (*ProxyServer, error)

NewProxyServer creates and installs a new ProxyServer. It automatically registers the created ProxyServer to http.DefaultServeMux. 'filter', if non-nil, protects requests to the api only.

func (*ProxyServer) Listen

func (s *ProxyServer) Listen(address string, port int) (net.Listener, error)

Listen is a simple wrapper around net.Listen.

func (*ProxyServer) ListenUnix

func (s *ProxyServer) ListenUnix(path string) (net.Listener, error)

ListenUnix does net.Listen for a unix socket

func (*ProxyServer) ServeOnListener

func (s *ProxyServer) ServeOnListener(l net.Listener) error

Serve starts the server using given listener, loops forever.

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 Reaper

type Reaper interface {
	Stop(namespace, name string, timeout time.Duration, gracePeriod *metav1.DeleteOptions) error
}

A Reaper handles terminating an object as gracefully as possible. timeout is how long we'll wait for the termination to be successful gracePeriod is time given to an API object for it to delete itself cleanly, e.g., pod shutdown. It may or may not be supported by the API object.

func ReaperForReplicationController

func ReaperForReplicationController(rcClient coreclient.ReplicationControllersGetter, timeout time.Duration) (Reaper, error)

type ReplicaSetReaper

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

func (*ReplicaSetReaper) Stop

func (reaper *ReplicaSetReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *metav1.DeleteOptions) error

type ReplicaSetScaler

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

func (*ReplicaSetScaler) Scale

func (scaler *ReplicaSetScaler) Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, waitForReplicas *RetryParams) error

Scale updates a ReplicaSet to a new size, with optional precondition check (if preconditions is not nil), optional retries (if retry is not nil), and then optionally waits for it's replica count to reach the new value (if wait is not nil).

func (*ReplicaSetScaler) ScaleSimple

func (scaler *ReplicaSetScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) (string, error)

ScaleSimple does a simple one-shot attempt at scaling. It returns the resourceVersion of the replicaset if the update is successful.

type ReplicationControllerReaper

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

func (*ReplicationControllerReaper) Stop

func (reaper *ReplicationControllerReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *metav1.DeleteOptions) error

type ReplicationControllerScaler

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

func (*ReplicationControllerScaler) Scale

func (scaler *ReplicationControllerScaler) Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, waitForReplicas *RetryParams) error

Scale updates a ReplicationController to a new size, with optional precondition check (if preconditions is not nil), optional retries (if retry is not nil), and then optionally waits for it's replica count to reach the new value (if wait is not nil).

func (*ReplicationControllerScaler) ScaleSimple

func (scaler *ReplicationControllerScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) (string, error)

ScaleSimple does a simple one-shot attempt at scaling. It returns the resourceVersion of the replication controller if the update is successful.

type ResourceQuotaGeneratorV1

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

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

func (ResourceQuotaGeneratorV1) ParamNames

func (g ResourceQuotaGeneratorV1) ParamNames() []GeneratorParam

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

func (*ResourceQuotaGeneratorV1) StructuredGenerate

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

StructuredGenerate outputs a ResourceQuota object using the configured fields

type ResourceShortcuts

type ResourceShortcuts struct {
	ShortForm schema.GroupResource
	LongForm  schema.GroupResource
}

ResourceShortcuts represents a structure that holds the information how to transition from resource's shortcut to its full name.

type RetryParams

type RetryParams struct {
	Interval, Timeout time.Duration
}

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

func NewRetryParams

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

type RoleBindingGeneratorV1

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

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

Generate returns a roleBinding using the specified parameters.

func (RoleBindingGeneratorV1) ParamNames

func (s RoleBindingGeneratorV1) ParamNames() []GeneratorParam

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

func (RoleBindingGeneratorV1) StructuredGenerate

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

StructuredGenerate outputs a roleBinding object using the configured fields.

type Rollbacker

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

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

type RollingUpdater

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

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

func NewRollingUpdater

func NewRollingUpdater(namespace string, rcClient coreclient.ReplicationControllersGetter, podClient coreclient.PodsGetter) *RollingUpdater

NewRollingUpdater creates a RollingUpdater from a client.

func (*RollingUpdater) Update

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

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

type RollingUpdaterConfig struct {
	// Out is a writer for progress output.
	Out io.Writer
	// OldRC is an existing controller to be replaced.
	OldRc *api.ReplicationController
	// NewRc is a controller that will take ownership of updated pods (will be
	// created if needed).
	NewRc *api.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 *api.ReplicationController, percentage int) error
}

RollingUpdaterConfig is the configuration for a rolling deployment process.

type RuntimeSort

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

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

func SortObjects

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

func (*RuntimeSort) Len

func (r *RuntimeSort) Len() int

func (*RuntimeSort) Less

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

func (*RuntimeSort) OriginalPosition

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

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

type ScaleError

type ScaleError struct {
	FailureType     ScaleErrorType
	ResourceVersion string
	ActualError     error
}

A ScaleError is returned when a scale request passes preconditions but fails to actually scale the controller.

func (ScaleError) Error

func (c ScaleError) Error() string

type ScaleErrorType

type ScaleErrorType int
const (
	ScaleGetFailure ScaleErrorType = iota
	ScaleUpdateFailure
	ScaleUpdateConflictFailure
)

type ScalePrecondition

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.

func (*ScalePrecondition) ValidateDeployment

func (precondition *ScalePrecondition) ValidateDeployment(deployment *extensions.Deployment) error

ValidateDeployment ensures that the preconditions match. Returns nil if they are valid, an error otherwise.

func (*ScalePrecondition) ValidateJob

func (precondition *ScalePrecondition) ValidateJob(job *batch.Job) error

ValidateJob ensures that the preconditions match. Returns nil if they are valid, an error otherwise.

func (*ScalePrecondition) ValidateReplicaSet

func (precondition *ScalePrecondition) ValidateReplicaSet(replicaSet *extensions.ReplicaSet) error

ValidateReplicaSet ensures that the preconditions match. Returns nil if they are valid, an error otherwise

func (*ScalePrecondition) ValidateReplicationController

func (precondition *ScalePrecondition) ValidateReplicationController(controller *api.ReplicationController) error

ValidateReplicationController ensures that the preconditions match. Returns nil if they are valid, an error otherwise

func (*ScalePrecondition) ValidateStatefulSet

func (precondition *ScalePrecondition) ValidateStatefulSet(ps *apps.StatefulSet) error

ValidateStatefulSet ensures that the preconditions match. Returns nil if they are valid, an error otherwise.

type Scaler

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)
	Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, wait *RetryParams) 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) (updatedResourceVersion string, err error)
}

Scaler provides an interface for resources that can be scaled.

type SecretForDockerRegistryGeneratorV1

type SecretForDockerRegistryGeneratorV1 struct {
	// Name of secret (required)
	Name 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
}

SecretForDockerRegistryGeneratorV1 supports stable generation of a docker registry secret

func (SecretForDockerRegistryGeneratorV1) Generate

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

Generate returns a secret using the specified parameters

func (SecretForDockerRegistryGeneratorV1) ParamNames

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

func (SecretForDockerRegistryGeneratorV1) StructuredGenerate

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

StructuredGenerate outputs a secret object using the configured fields

type SecretForTLSGeneratorV1

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
}

SecretForTLSGeneratorV1 supports stable generation of a TLS secret.

func (SecretForTLSGeneratorV1) Generate

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

Generate returns a secret using the specified parameters

func (SecretForTLSGeneratorV1) ParamNames

func (s SecretForTLSGeneratorV1) ParamNames() []GeneratorParam

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

func (SecretForTLSGeneratorV1) StructuredGenerate

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

StructuredGenerate outputs a secret object using the configured fields

type SecretGeneratorV1

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
}

SecretGeneratorV1 supports stable generation of an opaque secret

func (SecretGeneratorV1) Generate

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

Generate returns a secret using the specified parameters

func (SecretGeneratorV1) ParamNames

func (s SecretGeneratorV1) ParamNames() []GeneratorParam

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

func (SecretGeneratorV1) StructuredGenerate

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

StructuredGenerate outputs a secret object using the configured fields

type ServiceAccountGeneratorV1

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

ServiceAccountGeneratorV1 supports stable generation of a service account

func (*ServiceAccountGeneratorV1) StructuredGenerate

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

StructuredGenerate outputs a service account object using the configured fields

type ServiceClusterIPGeneratorV1

type ServiceClusterIPGeneratorV1 struct {
	ServiceCommonGeneratorV1
}

func (ServiceClusterIPGeneratorV1) Generate

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

func (ServiceClusterIPGeneratorV1) ParamNames

type ServiceCommonGeneratorV1

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

func (ServiceCommonGeneratorV1) GenerateCommon

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

func (ServiceCommonGeneratorV1) StructuredGenerate

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

type ServiceExternalNameGeneratorV1

type ServiceExternalNameGeneratorV1 struct {
	ServiceCommonGeneratorV1
}

TODO: is this really necessary?

func (ServiceExternalNameGeneratorV1) Generate

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

func (ServiceExternalNameGeneratorV1) ParamNames

type ServiceGeneratorV1

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

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

func (ServiceGeneratorV1) ParamNames

func (ServiceGeneratorV1) ParamNames() []GeneratorParam

type ServiceGeneratorV2

type ServiceGeneratorV2 struct{}

func (ServiceGeneratorV2) Generate

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

func (ServiceGeneratorV2) ParamNames

func (ServiceGeneratorV2) ParamNames() []GeneratorParam

type ServiceLoadBalancerGeneratorV1

type ServiceLoadBalancerGeneratorV1 struct {
	ServiceCommonGeneratorV1
}

func (ServiceLoadBalancerGeneratorV1) Generate

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

func (ServiceLoadBalancerGeneratorV1) ParamNames

type ServiceNodePortGeneratorV1

type ServiceNodePortGeneratorV1 struct {
	ServiceCommonGeneratorV1
}

func (ServiceNodePortGeneratorV1) Generate

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

func (ServiceNodePortGeneratorV1) ParamNames

type ServiceReaper

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

func (*ServiceReaper) Stop

func (reaper *ServiceReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *metav1.DeleteOptions) error

type SortingPrinter

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) AfterPrint

func (s *SortingPrinter) AfterPrint(w io.Writer, res string) error

func (*SortingPrinter) HandledResources

func (s *SortingPrinter) HandledResources() []string

TODO: implement HandledResources()

func (*SortingPrinter) IsGeneric

func (s *SortingPrinter) IsGeneric() bool

func (*SortingPrinter) PrintObj

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

type StatefulSetHistoryViewer

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

func (*StatefulSetHistoryViewer) ViewHistory

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 StatefulSetReaper

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

func (*StatefulSetReaper) Stop

func (reaper *StatefulSetReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *metav1.DeleteOptions) error

type StatefulSetScaler

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

func (*StatefulSetScaler) Scale

func (scaler *StatefulSetScaler) Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, waitForReplicas *RetryParams) error

func (*StatefulSetScaler) ScaleSimple

func (scaler *StatefulSetScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) (string, error)

ScaleSimple does a simple one-shot attempt at scaling. It returns the resourceVersion of the statefulset if the update is successful.

type StatefulSetStatusViewer

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

func (*StatefulSetStatusViewer) Status

func (s *StatefulSetStatusViewer) Status(namespace, name string, 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

type StatusViewer interface {
	Status(namespace, name string, revision int64) (string, bool, error)
}

StatusViewer provides an interface for resources that have rollout status.

type StructuredGenerator

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

Directories

Path Synopsis
cmd
cmd/auth
cmd/config
cmd/rollout
cmd/set
cmd/templates
cmd/testing
cmd/util
cmd/util/editor
cmd/util/jsonmerge
cmd/util/openapi Package openapi is a collection of libraries for fetching the openapi spec from a Kubernetes server and then indexing the type definitions.
cmd/util/sanity
metricsutil
plugins
resource Package resource assists clients in dealing with RESTful objects that match the Kubernetes API conventions.
testing
util