ressu / kube-plex

Scalable Plex Media Server on Kubernetes -- dispatch transcode jobs as pods on your cluster!
Apache License 2.0
102 stars 24 forks source link

Introduce resource limits to kube-plex annotations #1

Closed ressu closed 3 years ago

ressu commented 3 years ago

Allow defining requests and limits for the kube-plex pod using annotations. This enables usage of things like GPUs for transcoding.

Define kubeplex resource limits in values to use. For example:

image:
  tag: latest
kubePlex:
  enabled: true
  image:
    repository: ghcr.io/ressu/kube-plex
  loglevel: verbose
  resources:
    limits:
      cpu: 1
ressu commented 3 years ago

The new image is built as ghcr.io/ressu/kube-plex:resourcelimits

brandon099 commented 3 years ago

This is great!

When testing this with my setup, what I ran into initially is the extraData volumes you can optionally provide to the chart are not attached to the transcoder job pods, so this is currently assuming all data available to Plex is only found within the data volume at /data and everything is found on one volume. I'm currently rebuilding my test setup to utilize the default data mount, so I can test this GPU functionality this PR introduces.

So not directly related to this feature introduction, but results in the elastic transcoder pods failing to find the media file to transcode. I'll report back once I've tested this GPU stuff more.

Thanks!

ressu commented 3 years ago

Oh right.. I forgot to update the template to support the new variation of extraData. The support is there, but looks a bit different from what it used to be.

ressu commented 3 years ago

There we go, you can define which mounts to carry over to the transcoding pod by doing something like:

image:
  tag: latest
kubePlex:
  enabled: true
  image:
    repository: ghcr.io/ressu/kube-plex
  loglevel: verbose
  mounts: /data,/transcode,/extramountpath
  resources:
    limits:
      cpu: 1

The reason why I'm doing this explicitly and not implicitly like it used to be, is that there are some mounts that I don't want to carry over and the only way to know for certain which ones should be carried over is to define them as a list.

brandon099 commented 3 years ago

This functionality seems to be working after much testing over the last couple days, so thank you!

The only bug (albeit unrelated) I have been able to reproduce is with EAE Audio. It looks like the fix to bypass kube-plex you have here is only looking for eac3_eae, and I ran into failure in the same way with TrueHD audio transcodes using truehd_eae.

Taking a look at the Plex FFmpeg source code used by the Plex transcoder, it looks like the following are possible options to include in the bypass function, or possibly come up with another solution to address:

Thanks again for your work and time spent on this -- it's amazing!

ressu commented 3 years ago

Yeah, EAE is a real pain. The reason why EAE is causing pain is that it's explicitly trying to write to use local /tmp as a storage. Plex process writes parts of the data there and Transcoder does the other half.

I'll add those to the override, I was only using one of those in the exclude. Hopefully this helps remedy the situation.

ressu commented 3 years ago

I moved the EAE issue to an issue and will fix it shortly. Merging this PR, thanks for confirming.