deployments

package
v3.11.0-0.6.0+incompat... Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const PruneDeploymentsRecommendedName = "deployments"

Variables

This section is empty.

Functions

func DeploymentByDeploymentConfigIndexFunc

func DeploymentByDeploymentConfigIndexFunc(obj interface{}) ([]string, error)

DeploymentByDeploymentConfigIndexFunc indexes Deployment items by their associated DeploymentConfig, if none, index with key "orphan"

func FilterDeploymentsPredicate

func FilterDeploymentsPredicate(item *kapi.ReplicationController) bool

FilterDeploymentsPredicate is a function that returns true if the replication controller is associated with a DeploymentConfig

func FilterZeroReplicaSize

func FilterZeroReplicaSize(item *kapi.ReplicationController) bool

FilterZeroReplicaSize is a function that returns true if the replication controller size is 0

func NewCmdPruneDeployments

func NewCmdPruneDeployments(f kcmdutil.Factory, parentName, name string, streams genericclioptions.IOStreams) *cobra.Command

NewCmdPruneDeployments implements the OpenShift cli prune deployments command.

Types

type DataSet

type DataSet interface {
	GetDeploymentConfig(deployment *kapi.ReplicationController) (*appsapi.DeploymentConfig, bool, error)
	ListDeploymentConfigs() ([]*appsapi.DeploymentConfig, error)
	ListDeployments() ([]*kapi.ReplicationController, error)
	ListDeploymentsByDeploymentConfig(config *appsapi.DeploymentConfig) ([]*kapi.ReplicationController, error)
}

DataSet provides functions for working with deployment data

func NewDataSet

func NewDataSet(deploymentConfigs []*appsapi.DeploymentConfig, deployments []*kapi.ReplicationController) DataSet

NewDataSet returns a DataSet over the specified items

type DeploymentDeleter

type DeploymentDeleter interface {
	// DeleteDeployment removes the deployment from OpenShift's storage.
	DeleteDeployment(deployment *kapi.ReplicationController) error
}

DeploymentDeleter knows how to delete deployments from OpenShift.

func NewDeploymentDeleter

NewDeploymentDeleter creates a new deploymentDeleter.

type Filter

type Filter interface {
	Filter(items []*kapi.ReplicationController) []*kapi.ReplicationController
}

Filter filters the set of objects

type FilterPredicate

type FilterPredicate func(item *kapi.ReplicationController) bool

FilterPredicate is a function that returns true if the object should be included in the filtered set

func NewFilterBeforePredicate

func NewFilterBeforePredicate(d time.Duration) FilterPredicate

NewFilterBeforePredicate is a function that returns true if the build was created before the current time minus specified duration

type PruneDeploymentsOptions

type PruneDeploymentsOptions struct {
	Confirm         bool
	Orphans         bool
	KeepYoungerThan time.Duration
	KeepComplete    int
	KeepFailed      int
	Namespace       string

	AppsClient appsclientinternal.DeploymentConfigsGetter
	KubeClient kclientset.Interface
	Out        io.Writer
}

PruneDeploymentsOptions holds all the required options for pruning deployments.

func (*PruneDeploymentsOptions) Complete

func (o *PruneDeploymentsOptions) Complete(f kcmdutil.Factory, cmd *cobra.Command, args []string, out io.Writer) error

Complete turns a partially defined PruneDeploymentsOptions into a solvent structure which can be validated and used for pruning deployments.

func (PruneDeploymentsOptions) Run

Run contains all the necessary functionality for the OpenShift cli prune deployments command.

func (PruneDeploymentsOptions) Validate

func (o PruneDeploymentsOptions) Validate() error

Validate ensures that a PruneDeploymentsOptions is valid and can be used to execute pruning.

type Pruner

type Pruner interface {
	// Prune is responsible for actual removal of deployments identified as candidates
	// for pruning based on pruning algorithm.
	Prune(deleter DeploymentDeleter) error
}

func NewPruner

func NewPruner(options PrunerOptions) Pruner

NewPruner returns a Pruner over specified data using specified options. deploymentConfigs, deployments, opts.KeepYoungerThan, opts.Orphans, opts.KeepComplete, opts.KeepFailed, deploymentPruneFunc

type PrunerOptions

type PrunerOptions struct {
	// KeepYoungerThan will filter out all objects from prune data set that are younger than the specified time duration.
	KeepYoungerThan time.Duration
	// Orphans if true will include inactive orphan deployments in candidate prune set.
	Orphans bool
	// KeepComplete is per DeploymentConfig how many of the most recent deployments should be preserved.
	KeepComplete int
	// KeepFailed is per DeploymentConfig how many of the most recent failed deployments should be preserved.
	KeepFailed int
	// DeploymentConfigs is the entire list of deploymentconfigs across all namespaces in the cluster.
	DeploymentConfigs []*appsapi.DeploymentConfig
	// Deployments is the entire list of deployments across all namespaces in the cluster.
	Deployments []*kapi.ReplicationController
}

PrunerOptions contains the fields used to initialize a new Pruner.

type Resolver

type Resolver interface {
	Resolve() ([]*kapi.ReplicationController, error)
}

Resolver knows how to resolve the set of candidate objects to prune

func NewOrphanDeploymentResolver

func NewOrphanDeploymentResolver(dataSet DataSet, deploymentStatusFilter []appsapi.DeploymentStatus) Resolver

NewOrphanDeploymentResolver returns a Resolver that matches objects with no associated DeploymentConfig and has a DeploymentStatus in filter

func NewPerDeploymentConfigResolver

func NewPerDeploymentConfigResolver(dataSet DataSet, keepComplete int, keepFailed int) Resolver

NewPerDeploymentConfigResolver returns a Resolver that selects items to prune per config

Jump to

Keyboard shortcuts

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