omrikiei / ktunnel

A cli that exposes your local resources to kubernetes
GNU General Public License v3.0
913 stars 71 forks source link

`ktunnel expose` does not allow for custom request/limits #118

Open stekole opened 8 months ago

stekole commented 8 months ago

When looking at requests and limits for the expose pod, it gives a non-int value and does not look to be configuable.

Using a kubectl describe pod podname gives the following values:

    Limits:
      cpu:     1
      memory:  1e9
    Requests:
      cpu:        500e-3
      memory:     100e6
    Environment:  <none>

I cannot see anywhere in the code for expose to change these values, however it exists for inject. https://github.com/omrikiei/ktunnel/issues/19

Is there anyway this could be used? It would be great to be able to change these values

Thank you

jiehanzheng commented 6 months ago

The code is here: https://github.com/omrikiei/ktunnel/blob/e05cea977a9b540ae7e24d0b042e21533cee842d/pkg/k8s/common.go#L127-L130

19/#20 did address the resource request and limits for inject but since it's written inside the newContainer routine, it applies to expose as well.

I'm not well-versed enough in Go to quickly make this configurable from the CLI, but I made this hardcoded change to reduce the CPU request: https://github.com/jiehanzheng/ktunnel/commit/2c5a30cd1699b4f6ca74106e819c50e55ea2e939

mindovermiles262 commented 4 months ago

@jiehanzheng have these request/limits been working OK for you? I'm facing the same issue here. I might take a crack at trying to fix this