haveachin / infrared

An ultra lightweight minecraft reverse proxy and idle placeholder
https://infrared.dev
GNU Affero General Public License v3.0
719 stars 60 forks source link

Kubernetes Autoscaling #191

Open 6ixfalls opened 9 months ago

6ixfalls commented 9 months ago

Is your feature request related to a problem? Please describe. There's no way to automatically scale up and down Kubernetes workloads, like in the Docker provider.

Describe the solution you'd like Similar implementation to the Docker provider, like in mc-router, there should be a configuration option to automatically scale up and down depending on the connections to the server. There should also be an option not to start the server on pings, and only on player connections. The provider should automatically scale up and down StatefulSets or Deployments (or have the option to pick which), similar to the mc-router implementation which uses annotations on the Service to configure, and then searches for the correct deployment to scale.

Describe alternatives you've considered mc-router fulfills this Kubernetes capability, but it's designed as a barebones connection router rather than a proxy like Infrared, which has features I need.

6ixfalls commented 9 months ago

For this to happen, it looks like the k8s provider needs to be updated to actually be useful (Automatically determine proxyTo based off of the service, etc). Currently the k8s provider just reads config values, which has little to no use/wasn't thought through.

I've written a POC (that works) here: https://github.com/6ixfalls/infrared-scaler Some of the implementation can likely be reused in infrared, my implementation scans for an annotation for the domainName and determines the rest automagically.