jodevsa / wireguard-operator

Painless deployment of wireguard on kubernetes
MIT License
642 stars 36 forks source link

Wireguard CRD does not provide a way to set resources #181

Closed winston0410 closed 2 months ago

winston0410 commented 3 months ago

Is your feature request related to a problem? Please describe. At the moment the Wireguard CRD does not allow passing resources configuration

Describe the solution you'd like I would like to see resources section being allowed for Wireguard CRD

Describe alternatives you've considered N/A, the aforementioned solution seems to be the most direct and effective

Additional context

jodevsa commented 3 months ago

Hey, can you ellaborate more what are the resources section about? Maybe you can provide an example?

jodevsa commented 3 months ago

Ah I think you mean something to set pod cpu and memory resources?

winston0410 commented 3 months ago

Ah I think you mean something to set pod cpu and memory resources?

Hey, yes exactly that

jodevsa commented 3 months ago

Thanks! Can you tell me more about the use case? did you notice that wireguard uses high cpu/memory or ?

winston0410 commented 3 months ago

Sure, my use case is I want to limit resource used by every application in my cluster. Not that I notice wireguard using a lot at the moment, but just to prevent it from using excessive memory.

Another case that I can think of is, if we are able to set cpu/memory limit, I can get those metrics with kube-state-metrics from prometheus, and set a PrometheusRule to generate an alert when say it exceed 100% of the requested memory.

winston0410 commented 3 months ago

@jodevsa Would you like to see an API like this? This would allow user to customize resources for the metrics and the agent container:

---
apiVersion: vpn.wireguard-operator.io/v1alpha1
kind: Wireguard
metadata:
  name: vpn-gateway
  namespace: wireguard
spec:
  agent:
    resources:
      limits:
        cpu: xxx
        memory: xxx
      requests:
        cpu: xxx
        memory: xxx
  metrics:
    resources:
      limits:
        cpu: xxx
        memory: xxx
      requests:
        cpu: xxx
        memory: xxx

This pattern would allow our users passing arguments into each of those containers, even though I cannot think of anything that a user would need to pass at the moment, except the resources