Skip to content

[Feature] Garbage Collection #38

@auguwu

Description

@auguwu

As you use charted-server as your primary Helm Chart registry, there might be repositories, users, or organizations that are inactive and want to be pruned by some constraints (i.e, delete all users that have been last signed in (via POST /users/login) 30 days ago).

As there is no real query language that is extendable, charted-server will rely on a custom SQL-like language called Isuki, or IQL for short.

Isuki (IQL) is Noelware's SQL querying language that is also being built with Noelware Analytics to provide a human and SQL-like language, so:

  • LastPublished >= 30d - Queries the Isuki object with the property LastPublished that is greater or equal than 30 days.

This will be configured with the GarbageCollectionConfig DSL class, which an example in YAML:

gc:
  inactive-repos:
     $object: Repository
     constraint: last_published >= 30d
     actions: [delete]
  inactive-users:
    $object: User
    constraint: last_logged_in >= 30d
    actions:
    - deactivate
    - email:deactivation
  registry-layers:
    $object: Features/DockerRegistry
    constraint: image_size >= 1.5gb
    actions: [delete]
    schedule:
      cron: "* 0 0 * *"

Kotlin Script:

gc {
  action<Repo>("inactive-repos") {
     constraint {
        lastPublished >= "30d".toTimeSpan()
     }

     actions = listOf(GCActions.Delete)
  }

  action<User>("inactive-users") {
    constraint {
      lastLoggedIn >= "30d".toTimeSpan()
    }

    actions = listOf(GCActions.Deactivate, GCActions.Email("deactivate"))
  }

  action<DockerRegistry>("registry-layers") {
    constraint { imageSize >= "1.5gb".toByteSizeValue() }
    actions = listOf(GCActions.Delete)
    schedule {
      cron("* 0 0 * *")
    }
  }
}

The feature is only enabled if gc is not null, so if it is not present or if gc: null was specified, then it will not be enabled.

Note: This feature won't be added until Isuki has been developed and we have a refine structure that most people are happy with.

Roadmap

  • Wait until JNI bindings for Isuki are created
  • Implement garbage-collector module

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions