prune

package
v1.3.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

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

Types

type DataSet

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

DataSet provides functions for working with deployment data

func NewDataSet

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

NewDataSet returns a DataSet over the specified items

type DeploymentDeleter added in v1.3.0

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

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

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

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

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 []*deployapi.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 []deployapi.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