cloudwash


Namecloudwash JSON
Version 1.3.1 PyPI version JSON
download
home_pagehttps://github.com/RedHatQE/cloudwash
SummaryThe cloud resources cleanup utility
upload_time2023-12-18 14:13:01
maintainer
docs_urlNone
authorJitendra Yejare
requires_python
licenseApache license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Cloudwash

## Introduction

`cloudwash` is a library written in python that can be used to monitor and remove the unused cloud resources in public and private cloud providers.

Most importantly, `cloudwash` provides the CLI utility called '`swach`' that can be used to fire commands to cleanup the resources on cloud.

cloudwash supports following cloud providers:

| Cloud Providers  | vms    | nics    | discs     | images   | pips    | stacks   |
|------------------|--------|---------|-----------|----------|---------|----------|
| Amazon EC2       | ✓| ✓ | ✓   |  ✓ |  ✓|  ✓ |
| Microsoft Azure  | ✓| ✓ | ✓   |  ✓ |  ✓|  **NA**  |
| Google Cloud     | ✓| ✓ | ✓   |  ✗ |  ✗|  **NA**  |
| VMWare           | ✓| ✓ | ✓   |  ✗ |  **NA** |  **NA**  |

* RedHat Enterprize Virtualization Manager - RHEV (_Support yet To be added_)
* RedHat Openstack (_Support yet To be added_)
* VMWare vCenter (_Support yet To be added_)
* OCP Clusters deplyed on Public clouds (_Support yet To be added_)

NOTE: You can use `--all` flag with all the cloud providers to clean all supported resources.

The list of resource types it helps to clean could be found under settings.yaml.template](https://github.com/RedHatQE/cloudwash/blob/master/settings.yaml.template) file for individual cloud providers along with cleanup criteria.

## Installation

User can run `cloudwash` multiple ways:
- [PiP Package Installation](#pip-package-installation)
- [Docker Image Installation](#docker-image-installation)
- [OC BuildConfig Installation](#oc-buildconfig-installation)

### PiP Package Installation

For Linux Users, Depending on the distribution you are using, you may need to install following packages
(or similar for your distribution of linux):

* libcurl-devel
* openssl-devel
* libxml2-devel
* libxml2-static
* gcc

Pycurl is a one of the dependent package of `cloudwash` that wants you to install above dependencies.
Read more about it http://pycurl.io/docs/latest/install.html

Installation:

```
$ mkdir ~/cloudwash && cd ~/cloudwash
$ pip install cloudwash
```

### Docker Image Installation

#### From Container image registry
The [container image](https://quay.io/repository/redhatqe/cloudwash) for cloudwash is available in quay. This image provides the cloudwash installed from released python package with release version tags. Latest tag always points to the latest released version tag.

#### Build from local DockerFile
This github repo contains a DockerFile, use any container building service to build from the dockerfile:

Build container from `Dockerfile.dev` that should build a container from the cloudwash github master branch giving the access to pre-released features.


### OC BuildConfig Installation
This github repo provides the ready to use BuildConfig on OCP / Kubernetes. The build config should create buildconfig to build master branch based container image. Use the image to build cloudwash pod.


## Configuration

The `cloudwash` uses the `DynaConf` configuration python module to access the data in `settings.yaml` or conf directory settings, it also allows an unique way of declaring secrets via Environment variables instead of putting in plain `settings.yaml`.

e.g: The Azure password field can be set via environment variable by exporting the environment variable

```
# export CLEANUP_PROVIDERS__AZURE__PASSWORD = myPa$$worb"
```

#### Configuration with PyPi package:

Copy/Download `settings.yaml.template` to local `~/cloudwash` directory as `settings.yaml`, update it with the cloud provider credentials and other configuration details for successful resource reporting and cleanup.


#### Configuration with cloudwash container images:

_Either_ - The docker images have `settings.yaml` added from Dockerfile. Build the container from the image, access the container and update the `settings.yaml` with real values and commit the changes to the image. Use the commited image for cleanup activity.

_Or_ - Export/Set the environment variables for all or only sensitive credentials as shown above. The dynaconf in cloudwash container should read these credentials from environment variable.


## Usage Examples


* Cleanup Help:

```
# swach --help

Usage: swach [OPTIONS] COMMAND [ARGS]...

A Cleanup Utility to remove cloud resources from cloud Providers!

Options:
-d, --dry Only show what will be removed from Providers!
--help Show this message and exit.

Commands:
azure		Cleanup Azure provider
aws			Cleanup Amazon provider
gce			Cleanup GCE provider
openstack	Cleanup OSP provider
rhev 		Cleanup RHEV provider
vmware 		Cleanup VMWare provider
```

* Cleanup Cloud Provider help:

```
# swach azure --help

Usage: swach azure [OPTIONS]

  Cleanup Azure provider

Options:
  --all             Remove all unused Resources from the provider
  --all_rg          Remove resource group only if all resources are older than SLA
  --nics            Remove only unused NICs from the provider
  --discs           Remove only unused DISCs from the provider
  --vms             Remove only unused VMs from the provider
  --pips            Remove only PiPs from the provider
  --help            Show this message and exit.

```

* Cleanup Dry Run (Monitor only mode using option `-d`):

```
# swach -d azure --all

<<<<<<< Running the cleanup script in DRY RUN mode >>>>>>>
The AZURE providers settings are initialized and validated !

=========== DRY SUMMARY ============

VMs:
	Deletable: ['test-bvhoduliam']
	Stoppable: ['foremanqe-nightly2']
DISCs:
	Deletable: ['test-bvhoduliam-osdisk']
NICs:
	Deletable: ['test-axodawttrw-nic0']
PIPs:
	Deletable: ['test-axodawttrw-pip0']
====================================
```

* Actual Cleanup Run:

```
# swach azure --all

<<<<<<< Running the cleanup script in ACTION mode >>>>>>>
The AZURE providers settings are initialized and validated !

Stopped [] and removed ['test-bvhoduliam'] VMs from Azure Cloud.
Removed following and all unused nics from Azure Cloud.
['test-axodawttrw-nic0']
Removed following and all unused discs from Azure Cloud.
['test-bvhoduliam-osdisk']
Removed following and all unused pips from Azure Cloud.
['test-axodawttrw-pip0']
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/RedHatQE/cloudwash",
    "name": "cloudwash",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Jitendra Yejare",
    "author_email": "jyejare@redhat.com",
    "download_url": "https://files.pythonhosted.org/packages/26/77/5a1dbeba792d6b03b902a036e26ff98c554046de5e76865f40dbc6bb97ea/cloudwash-1.3.1.tar.gz",
    "platform": null,
    "description": "# Cloudwash\n\n## Introduction\n\n`cloudwash` is a library written in python that can be used to monitor and remove the unused cloud resources in public and private cloud providers.\n\nMost importantly, `cloudwash` provides the CLI utility called '`swach`' that can be used to fire commands to cleanup the resources on cloud.\n\ncloudwash supports following cloud providers:\n\n| Cloud Providers  | vms    | nics    | discs     | images   | pips    | stacks   |\n|------------------|--------|---------|-----------|----------|---------|----------|\n| Amazon EC2       | &check;| &check; | &check;   |  &check; |  &check;|  &check; |\n| Microsoft Azure  | &check;| &check; | &check;   |  &check; |  &check;|  **NA**  |\n| Google Cloud     | &check;| &check; | &check;   |  &cross; |  &cross;|  **NA**  |\n| VMWare           | &check;| &check; | &check;   |  &cross; |  **NA** |  **NA**  |\n\n* RedHat Enterprize Virtualization Manager - RHEV (_Support yet To be added_)\n* RedHat Openstack (_Support yet To be added_)\n* VMWare vCenter (_Support yet To be added_)\n* OCP Clusters deplyed on Public clouds (_Support yet To be added_)\n\nNOTE: You can use `--all` flag with all the cloud providers to clean all supported resources.\n\nThe list of resource types it helps to clean could be found under settings.yaml.template](https://github.com/RedHatQE/cloudwash/blob/master/settings.yaml.template) file for individual cloud providers along with cleanup criteria.\n\n## Installation\n\nUser can run `cloudwash` multiple ways:\n- [PiP Package Installation](#pip-package-installation)\n- [Docker Image Installation](#docker-image-installation)\n- [OC BuildConfig Installation](#oc-buildconfig-installation)\n\n### PiP Package Installation\n\nFor Linux Users, Depending on the distribution you are using, you may need to install following packages\n(or similar for your distribution of linux):\n\n* libcurl-devel\n* openssl-devel\n* libxml2-devel\n* libxml2-static\n* gcc\n\nPycurl is a one of the dependent package of `cloudwash` that wants you to install above dependencies.\nRead more about it http://pycurl.io/docs/latest/install.html\n\nInstallation:\n\n```\n$ mkdir ~/cloudwash && cd ~/cloudwash\n$ pip install cloudwash\n```\n\n### Docker Image Installation\n\n#### From Container image registry\nThe [container image](https://quay.io/repository/redhatqe/cloudwash) for cloudwash is available in quay. This image provides the cloudwash installed from released python package with release version tags. Latest tag always points to the latest released version tag.\n\n#### Build from local DockerFile\nThis github repo contains a DockerFile, use any container building service to build from the dockerfile:\n\nBuild container from `Dockerfile.dev` that should build a container from the cloudwash github master branch giving the access to pre-released features.\n\n\n### OC BuildConfig Installation\nThis github repo provides the ready to use BuildConfig on OCP / Kubernetes. The build config should create buildconfig to build master branch based container image. Use the image to build cloudwash pod.\n\n\n## Configuration\n\nThe `cloudwash` uses the `DynaConf` configuration python module to access the data in `settings.yaml` or conf directory settings, it also allows an unique way of declaring secrets via Environment variables instead of putting in plain `settings.yaml`.\n\ne.g: The Azure password field can be set via environment variable by exporting the environment variable\n\n```\n# export CLEANUP_PROVIDERS__AZURE__PASSWORD = myPa$$worb\"\n```\n\n#### Configuration with PyPi package:\n\nCopy/Download `settings.yaml.template` to local `~/cloudwash` directory as `settings.yaml`, update it with the cloud provider credentials and other configuration details for successful resource reporting and cleanup.\n\n\n#### Configuration with cloudwash container images:\n\n_Either_ - The docker images have `settings.yaml` added from Dockerfile. Build the container from the image, access the container and update the `settings.yaml` with real values and commit the changes to the image. Use the commited image for cleanup activity.\n\n_Or_ - Export/Set the environment variables for all or only sensitive credentials as shown above. The dynaconf in cloudwash container should read these credentials from environment variable.\n\n\n## Usage Examples\n\n\n* Cleanup Help:\n\n```\n# swach --help\n\nUsage: swach [OPTIONS] COMMAND [ARGS]...\n\nA Cleanup Utility to remove cloud resources from cloud Providers!\n\nOptions:\n-d, --dry Only show what will be removed from Providers!\n--help Show this message and exit.\n\nCommands:\nazure\t\tCleanup Azure provider\naws\t\t\tCleanup Amazon provider\ngce\t\t\tCleanup GCE provider\nopenstack\tCleanup OSP provider\nrhev \t\tCleanup RHEV provider\nvmware \t\tCleanup VMWare provider\n```\n\n* Cleanup Cloud Provider help:\n\n```\n# swach azure --help\n\nUsage: swach azure [OPTIONS]\n\n  Cleanup Azure provider\n\nOptions:\n  --all             Remove all unused Resources from the provider\n  --all_rg          Remove resource group only if all resources are older than SLA\n  --nics            Remove only unused NICs from the provider\n  --discs           Remove only unused DISCs from the provider\n  --vms             Remove only unused VMs from the provider\n  --pips            Remove only PiPs from the provider\n  --help            Show this message and exit.\n\n```\n\n* Cleanup Dry Run (Monitor only mode using option `-d`):\n\n```\n# swach -d azure --all\n\n<<<<<<< Running the cleanup script in DRY RUN mode >>>>>>>\nThe AZURE providers settings are initialized and validated !\n\n=========== DRY SUMMARY ============\n\nVMs:\n\tDeletable: ['test-bvhoduliam']\n\tStoppable: ['foremanqe-nightly2']\nDISCs:\n\tDeletable: ['test-bvhoduliam-osdisk']\nNICs:\n\tDeletable: ['test-axodawttrw-nic0']\nPIPs:\n\tDeletable: ['test-axodawttrw-pip0']\n====================================\n```\n\n* Actual Cleanup Run:\n\n```\n# swach azure --all\n\n<<<<<<< Running the cleanup script in ACTION mode >>>>>>>\nThe AZURE providers settings are initialized and validated !\n\nStopped [] and removed ['test-bvhoduliam'] VMs from Azure Cloud.\nRemoved following and all unused nics from Azure Cloud.\n['test-axodawttrw-nic0']\nRemoved following and all unused discs from Azure Cloud.\n['test-bvhoduliam-osdisk']\nRemoved following and all unused pips from Azure Cloud.\n['test-axodawttrw-pip0']\n```\n",
    "bugtrack_url": null,
    "license": "Apache license",
    "summary": "The cloud resources cleanup utility",
    "version": "1.3.1",
    "project_urls": {
        "Homepage": "https://github.com/RedHatQE/cloudwash"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aac8198566a137ab4442d8663805c08b22f8e8ba44649bb2684029cff5bff376",
                "md5": "470c1934c45fd34db5230a84790cc248",
                "sha256": "bb0c7211257874d7cbff422c7404b8b2346eb1d2e6a4664f7b7167aa6a0236de"
            },
            "downloads": -1,
            "filename": "cloudwash-1.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "470c1934c45fd34db5230a84790cc248",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 18182,
            "upload_time": "2023-12-18T14:13:00",
            "upload_time_iso_8601": "2023-12-18T14:13:00.046426Z",
            "url": "https://files.pythonhosted.org/packages/aa/c8/198566a137ab4442d8663805c08b22f8e8ba44649bb2684029cff5bff376/cloudwash-1.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "26775a1dbeba792d6b03b902a036e26ff98c554046de5e76865f40dbc6bb97ea",
                "md5": "fc2dc006f35b4b7f5a2c2678848ed3f5",
                "sha256": "95204c432021c7097d13747a78c748fb40a6679b6f1f48fbe3e024892bcf7d5c"
            },
            "downloads": -1,
            "filename": "cloudwash-1.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "fc2dc006f35b4b7f5a2c2678848ed3f5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 22183,
            "upload_time": "2023-12-18T14:13:01",
            "upload_time_iso_8601": "2023-12-18T14:13:01.996548Z",
            "url": "https://files.pythonhosted.org/packages/26/77/5a1dbeba792d6b03b902a036e26ff98c554046de5e76865f40dbc6bb97ea/cloudwash-1.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-18 14:13:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "RedHatQE",
    "github_project": "cloudwash",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "cloudwash"
}
        
Elapsed time: 0.16377s