Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Garbage Collection #38

Open
2 tasks
auguwu opened this issue Aug 9, 2022 · 0 comments
Open
2 tasks

[Feature] Garbage Collection #38

auguwu opened this issue Aug 9, 2022 · 0 comments
Assignees

Comments

@auguwu
Copy link
Member

auguwu commented Aug 9, 2022

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
@auguwu auguwu self-assigned this Aug 9, 2022
@auguwu auguwu changed the title feat: add garbage collector [Feature] Garbage Collection Jan 31, 2023
@auguwu auguwu mentioned this issue Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant