Coder Social home page Coder Social logo

swabbie's Introduction

Swabbie

IMPORTANT: This service is currently under development, and is actively being used at Netflix for deleting images, ebs snapshots and auto scaling groups.

Swabbie automates the cleanup of unused resources such as EBS Volumes and Images. As a Janitor Monkey replacement, it can also be extended to clean up a variety of resource types. Swabbie applies a set of rules to mark cleanup candidates. Once marked, a resource is scheduled for deletion, and an owner is notified. Before being deleted the resource is checked again to make sure it still qualifies for deletion. If so, it is deleted.

Deep Dive

For a more detailed understanding of how Swabbie works, visit the internals doc.

How it works

Configuration

During initialization swabbie schedules work to routinely mark, notify and delete resources. The application configuration is flattened into work items that are placed on the work queue for processing:

YAML config -> Work Items -> Work Queue

Work Diagram

Each visited resource is evaluated against the rules engine in order to determine if it should be deleted.

Rules in the rules engine are configurable and can be composed similar to an if/else branch. They can be defined with an AND (&&), or OR (||) operator:

  • AND: A branch applies if all contained rules apply to the resource being evaluated.
  • OR: A branch applies if any rule contained inside the branch applies.
resourceTypes:
- name: serverGroup
  enabled: true
  enabledRules:
  - operator: AND # branch(1)
    description: Empty Server Groups that have been disabled for more than than 45 days.
    rules:
      - name: ZeroInstanceRule
      - name: DisabledLoadBalancerRule
        parameters:
          moreThanDays: 45
  - operator: OR #branch(2)
    description: Expired Server Groups.
    rules:
      - name: ExpiredResourceRule

The above configuration translates to the following:

For every resource r of type serverGroup,

  • r.marked == true => (branch(1) || branch(2)) == true

Or more generally:

  • r.marked == true => (branch(1) || branch(2) || ... branch(n-1) || branch(n)) == true

As illustrated using defined rules:

if (((ZeroInstanceRule && DisabledLoadBalancerRule) || ExpiredResourceRule) == true)

Resource States:
  • Marked:

Mark Flow

During the marking process, previously marked resources that no longer qualify for deletion are Unmarked.

  • Notified: Once marked, the resource owner is resolved and notified about the upcoming deletion.

  • Opted-Out: A resource can be explicitly opted out of deletion via API or exclusion policies. Opted out resources are exempt from swabbie actions.

  • Deleted:

Delete Flow

Resources are re-evaluated before deletion to ensure they can be safely deleted.

What's supported today

  • Cloud Provider: AWS
    • Netflix uses Edda
    • Vanilla AWS is also supported
  • Resource Types:
    • AMIs
    • Server Groups
    • Launch Configurations
    • Launch Templates
    • EBS Snapshots
    • ELBs
  • Halyard: Not supported yet (PRs are welcome!)

Contributing

If you're interested in contributing support for other providers or resource types, open an issue or join the Spinnaker Team slack and post in #swabbie.

Areas:

  • Testing
  • Documentation
  • Other cloud provider
  • Extensibility
  • Plugin support

Running swabbie

Requirements:

./gradlew run -Dspring.config.location=/absolute/path/to/swabbie.yml

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.