{"modulePath":"github.com/2lambda123/openshift-origin","version":"v4.1.0+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package deployments\n\n## Constants\n\n```go\nconst PruneDeploymentsRecommendedName = \"deployments\"\n```\n\n## Functions\n\n```go\nfunc DeploymentByDeploymentConfigIndexFunc(obj interface{}) ([]string, error)\n```\nDeploymentByDeploymentConfigIndexFunc indexes Deployment items by their associated DeploymentConfig, if none, index with key \"orphan\"\n\n```go\nfunc FilterDeploymentsPredicate(item *corev1.ReplicationController) bool\n```\nFilterDeploymentsPredicate is a function that returns true if the replication controller is associated with a DeploymentConfig\n\n```go\nfunc FilterZeroReplicaSize(item *corev1.ReplicationController) bool\n```\nFilterZeroReplicaSize is a function that returns true if the replication controller size is 0\n\n```go\nfunc NewCmdPruneDeployments(f kcmdutil.Factory, parentName, name string, streams genericclioptions.IOStreams) *cobra.Command\n```\nNewCmdPruneDeployments implements the OpenShift cli prune deployments command.\n\n## Types\n\n```go\ntype ByMostRecent []*corev1.ReplicationController\n```\nByMostRecent sorts deployments by most recently created.\n\n```go\nfunc (s ByMostRecent) Len() int\n```\n\n```go\nfunc (s ByMostRecent) Less(i, j int) bool\n```\n\n```go\nfunc (s ByMostRecent) Swap(i, j int)\n```\n\n```go\ntype DataSet interface {\n\tGetDeploymentConfig(deployment *corev1.ReplicationController) (*appsv1.DeploymentConfig, bool, error)\n\tListDeploymentConfigs() ([]*appsv1.DeploymentConfig, error)\n\tListDeployments() ([]*corev1.ReplicationController, error)\n\tListDeploymentsByDeploymentConfig(config *appsv1.DeploymentConfig) ([]*corev1.ReplicationController, error)\n}\n```\nDataSet provides functions for working with deployment data\n\n```go\nfunc NewDataSet(deploymentConfigs []*appsv1.DeploymentConfig, deployments []*corev1.ReplicationController) DataSet\n```\nNewDataSet returns a DataSet over the specified items\n\n```go\ntype DeploymentDeleter interface {\n\t// DeleteDeployment removes the deployment from OpenShift's storage.\n\tDeleteDeployment(deployment *corev1.ReplicationController) error\n}\n```\nDeploymentDeleter knows how to delete deployments from OpenShift.\n\n```go\nfunc NewDeploymentDeleter(deployments corev1client.ReplicationControllersGetter) DeploymentDeleter\n```\nNewDeploymentDeleter creates a new deploymentDeleter.\n\n```go\ntype Filter interface {\n\tFilter(items []*corev1.ReplicationController) []*corev1.ReplicationController\n}\n```\nFilter filters the set of objects\n\n```go\ntype FilterPredicate func(item *corev1.ReplicationController) bool\n```\nFilterPredicate is a function that returns true if the object should be included in the filtered set\n\n```go\nfunc NewFilterBeforePredicate(d time.Duration) FilterPredicate\n```\nNewFilterBeforePredicate is a function that returns true if the build was created before the current time minus specified duration\n\n```go\ntype PruneDeploymentsOptions struct {\n\tConfirm         bool\n\tOrphans         bool\n\tKeepYoungerThan time.Duration\n\tKeepComplete    int\n\tKeepFailed      int\n\tNamespace       string\n\n\tAppsClient appsv1client.DeploymentConfigsGetter\n\tKubeClient corev1client.CoreV1Interface\n\n\tgenericclioptions.IOStreams\n}\n```\nPruneDeploymentsOptions holds all the required options for pruning deployments.\n\n```go\nfunc NewPruneDeploymentsOptions(streams genericclioptions.IOStreams) *PruneDeploymentsOptions\n```\n\n```go\nfunc (o *PruneDeploymentsOptions) Complete(f kcmdutil.Factory, cmd *cobra.Command, args []string) error\n```\nComplete turns a partially defined PruneDeploymentsOptions into a solvent structure which can be validated and used for pruning deployments.\n\n```go\nfunc (o PruneDeploymentsOptions) Run() error\n```\nRun contains all the necessary functionality for the OpenShift cli prune deployments command.\n\n```go\nfunc (o PruneDeploymentsOptions) Validate() error\n```\nValidate ensures that a PruneDeploymentsOptions is valid and can be used to execute pruning.\n\n```go\ntype Pruner interface {\n\t// Prune is responsible for actual removal of deployments identified as candidates\n\t// for pruning based on pruning algorithm.\n\tPrune(deleter DeploymentDeleter) error\n}\n```\n\n```go\nfunc NewPruner(options PrunerOptions) Pruner\n```\nNewPruner returns a Pruner over specified data using specified options. deploymentConfigs, deployments, opts.KeepYoungerThan, opts.Orphans, opts.KeepComplete, opts.KeepFailed, deploymentPruneFunc\n\n```go\ntype PrunerOptions struct {\n\t// KeepYoungerThan will filter out all objects from prune data set that are younger than the specified time duration.\n\tKeepYoungerThan time.Duration\n\t// Orphans if true will include inactive orphan deployments in candidate prune set.\n\tOrphans bool\n\t// KeepComplete is per DeploymentConfig how many of the most recent deployments should be preserved.\n\tKeepComplete int\n\t// KeepFailed is per DeploymentConfig how many of the most recent failed deployments should be preserved.\n\tKeepFailed int\n\t// DeploymentConfigs is the entire list of deploymentconfigs across all namespaces in the cluster.\n\tDeploymentConfigs []*appsv1.DeploymentConfig\n\t// Deployments is the entire list of deployments across all namespaces in the cluster.\n\tDeployments []*corev1.ReplicationController\n}\n```\nPrunerOptions contains the fields used to initialize a new Pruner.\n\n```go\ntype Resolver interface {\n\tResolve() ([]*corev1.ReplicationController, error)\n}\n```\nResolver knows how to resolve the set of candidate objects to prune\n\n```go\nfunc NewOrphanDeploymentResolver(dataSet DataSet, deploymentStatusFilter []appsv1.DeploymentStatus) Resolver\n```\nNewOrphanDeploymentResolver returns a Resolver that matches objects with no associated DeploymentConfig and has a DeploymentStatus in filter\n\n```go\nfunc NewPerDeploymentConfigResolver(dataSet DataSet, keepComplete int, keepFailed int) Resolver\n```\nNewPerDeploymentConfigResolver returns a Resolver that selects items to prune per config\n\n","path":"github.com/2lambda123/openshift-origin/pkg/oc/cli/admin/prune/deployments","name":"deployments","synopsis":"","isRedistributable":true}
