0.0
No release in over a year
This is a scanning tool for unused block volumes in kubernetes clusters (AWS, GCP, OCI).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

Runtime

~> 0.3.0
~> 4.11
~> 2.8
~> 2.20
~> 1.498
~> 1.18
 Project Readme

Volume Sweeper

CI (tests) Gem Version Test Coverage Maintainability License: MIT

A tool to scan and clean cloud infrastruture for unattached block volumes without kubernetes clusters persistent volumes.

  • Supported Clouds
  • Supported Kubernetes
  • Prerequisits
  • Installation
  • Usage
  • Documentation
    • Design
    • Algorithm
    • Deployment
    • Code
    • Limitations
  • Contributing
  • License

Supported Clouds

  • OCI
  • AWS.
  • GCP.

Supported Kubernetes

Any distributions + v1.19.

Prerequisits

  1. Kubernetes: a service account with read/update access to the cluster is required, scoped to PV resources.
  2. Cloud: access is required for block volumes service (BV) with read and delete roles.

Installation

$ gem install volume_sweeper

Usage

To scan and generate a report:

volume_sweeper --account-id <ID> --cloud aws|oci --region <region>

To apply deletion for unattached block volumes:

volume_sweeper --mode delete

For all options:

volume_sweeper -h

Documentation

This tool tracks down unused block volumes in cloud accounts to clean once certain conditions met.

Design

Algorithm

FOR each_cluster IN oci|aws:
  A] Fetch PVs (name, volHandle)
  B] Fetch BLOCK VOL where (instance_attachment) = nil
  C] Compare A ^ B to Extract Bx NOT IN Ax
     THEN:
       DEL [C] result
END

Deployment

  • Models:
    • Can be run on demand as a CLI locally or remotely.
    • background processing [CronJob].
  • Has 2 modes: audit and delete.
  • Notifications for email and teams channels.

Code

  • The library is a ruby CLI-based application.

  • Cluster integration layer is unified, using Kubernetes REST API server.

  • The cloud integration layer is written in provider design pattern.

  • Functionality can be extended for different cloud providers per the interface contract.

    module VolumeSweeper
      module Providers
        class Base
          attr_reader :base_link
    
          def initialize **kwargs
            ...
          end
    
          def scan_volumes; end
          def delete_volumes ids_list; end
        end
      end
    end

Limitations

  • No support for multiple clusters in the accounts or compartment.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/abarrak/volume_sweeper.

License

MIT License.