• Stars
    star
    370
  • Rank 115,405 (Top 3 %)
  • Language
    Kotlin
  • Created over 7 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Spinnaker's clean up service

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

More Repositories

1

spinnaker

Spinnaker is an open source, multi-cloud continuous delivery platform for releasing software changes with high velocity and confidence.
Shell
9,298
star
2

kayenta

Automated Canary Service
Java
1,287
star
3

clouddriver

read and write operations across cloud providers
Groovy
432
star
4

halyard

A tool for configuring, installing, and updating Spinnaker
Java
308
star
5

deck

Management UI for Spinnaker
TypeScript
303
star
6

orca

Orchestration engine
Groovy
245
star
7

igor

Integration with Jenkins and Git for Spinnaker
Groovy
145
star
8

spin

Spinnaker CLI
Go
128
star
9

gate

Spinnaker API Gateway
Groovy
127
star
10

keel

Spinnaker's declarative service
Kotlin
109
star
11

rosco

A bakery for deployable images
Groovy
88
star
12

spinnaker.github.io

spinnaker documentation site
HTML
79
star
13

dcd-spec

Declarative Pipeline specification for Spinnaker
78
star
14

echo

Spinnaker Eventing Service
Java
74
star
15

kleat

A lightweight tool for managing Spinnaker configuration
Go
69
star
16

fiat

Spinnaker auth service
Java
68
star
17

front50

Spinnaker Metadata Repository Service
Java
63
star
18

pipeline-templates

A public collection of Spinnaker declarative pipeline templates
54
star
19

governance

Community documentation for Spinnaker
Kotlin
46
star
20

roer

A thin Spinnaker CLI
Go
45
star
21

kork

Kork provides some basic service building blocks for Spinnaker.
Java
41
star
22

spinnaker-monitoring

Support for monitoring deployed Spinnaker microservices.
Python
39
star
23

workshops

CSS
25
star
24

sponnet

Jsonnet library specifically for Spinnaker
Jsonnet
24
star
25

spinnaker.io

spinnaker.io website content
HTML
20
star
26

spinnaker-gradle-project

Gradle project for spinnaker project conventions
Kotlin
20
star
27

keiko

Queuing library originally built for Orca
Kotlin
18
star
28

deck-kayenta

Spinnaker UI module for Kayenta
TypeScript
17
star
29

kustomization-base

Base kustomize config for deploying Spinnaker to kubernetes
17
star
30

spinnaker-dependencies

Common dependencies for Spinnaker
Shell
14
star
31

deck-customized

Spinnaker Deck with customizations
HTML
14
star
32

rush

Script Execution service
Groovy
12
star
33

moniker

naming for cloud resources
Groovy
11
star
34

spinnaker-config

Template repo for users to overlay the base kustomization with their config
11
star
35

try.spinnaker.io

Spinnaker Playground πŸŒŠπŸ„
Shell
9
star
36

styleguide

Style guide for Spinnaker UI
HTML
8
star
37

buildtool

Utilities and tools for setting up and execution Spinnaker integration tests
Python
6
star
38

scheduled-actions

As the name suggests ("scheduled actions")
Java
6
star
39

spinnakerbot

A GitHub bot for managing Spinnaker's repos.
Python
6
star
40

stats

Go
5
star
41

rotation-scheduler

A GitHub Action for generation a rotation schedule.
Go
5
star
42

bumpdeps

A GitHub Action to automatically bump Spinnaker dependencies
Kotlin
4
star
43

ops-tools

Unofficial community scripts and tools
4
star
44

dcdspike

quick spike of declarative CD templating
Java
4
star
45

managed.delivery

The microsite for managed.delivery
3
star
46

spinrel

A tool for working with Spinnaker releases.
Kotlin
3
star
47

clouddriver-cloudfoundry

Snapshot of cloud foundry code in clouddriver
Groovy
2
star
48

md-lib-go

Shared library code for Managed Delivery Go clients
Go
2
star
49

plugins

Spinnaker plugins repository
2
star
50

spinnaker-kustomize

Spinnaker installation via kustomize
Makefile
1
star
51

.github

Community Health files repo
1
star
52

spinnaker-dev.github.io

spinnaker.dev site
HTML
1
star
53

pipeline-builder

A Java library to build Spinnaker pipelines
Java
1
star