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

How to define pod resource limits in pom.xml? #2040

Closed
TueDissingWork opened this issue Feb 6, 2023 · 14 comments · Fixed by #2090
Closed

How to define pod resource limits in pom.xml? #2040

TueDissingWork opened this issue Feb 6, 2023 · 14 comments · Fixed by #2090
Assignees
Labels
demoable Issues which can be demoed during the Sprint review meeting enhancement New feature or request
Milestone

Comments

@TueDissingWork
Copy link
Contributor

Hi Guys,
I wanted to see if I could get rid of all partial yaml definitions and instead rely solely on what is available through the pom.xml. But I am having trouble with defining the resource requestsand release limits within the pom.xml.
I can't seem to locate it in the documentation, but I might just be missing it.

Any pointers on how to achieve this would be great.

Thanks,
Tue

@rohanKanojia
Copy link
Member

Do you want to add these in Deployment's PodTemplateSpec?

@TueDissingWork
Copy link
Contributor Author

Currently working with an OpenShift cluster. I need it to end up within the DeploymentConfig.yaml.
Any way to handle this from inside the pom?

@rohanKanojia
Copy link
Member

I don't think we're supporting this currently. We do provide support for setting requests/limits for OpenShift S2I build but for main DeploymentConfig it is not available at the moment.

Maybe we can add these fields in <resource> configuration so that user can specify requests/limits like this:

<configuration>
    <resources>
        <requests>
              <cpu>500m</cpu>
              <memory>512Mi</memory>
        </requests>
       <limits>
              <cpu>1000m</cpu>
              <memory>1Gi</memory>
        </limits>
</configuration>

our DefaultControllerEnricher would add these specified requests/limits into generated controllers.

@TueDissingWork
Copy link
Contributor Author

I don't think we're supporting this currently. We do provide support for setting requests/limits for OpenShift S2I build but for main DeploymentConfig it is not available at the moment.

Maybe we can add these fields in <resource> configuration so that user can specify requests/limits like this:

<configuration>
    <resources>
        <requests>
              <cpu>500m</cpu>
              <memory>512Mi</memory>
        </requests>
       <limits>
              <cpu>1000m</cpu>
              <memory>1Gi</memory>
        </limits>
</configuration>

our DefaultControllerEnricher would add these specified requests/limits into generated controllers.

Thank you for the explanation. Any good examples on how to approach this?
Need to differentiate these limits between different NS (dev/test/prod)?

@rohanKanojia
Copy link
Member

rohanKanojia commented Feb 6, 2023

For now, you're using fragments, right?

Do you think for now you can try using jkube.environment for placing different fragments for different environments? You can see short demo here

@TueDissingWork
Copy link
Contributor Author

yeah, I am using fragtments, but wanted to get away from that, as each file (for each NS) are more or less identical; resources being the dynamic component.

@TueDissingWork
Copy link
Contributor Author

ahh, there's a common environment well. Maybe that is what I am looking for! Will test this.

@TueDissingWork
Copy link
Contributor Author

when combining multiple "environments" it seems to do the trick. Thanks!

@rohanKanojia
Copy link
Member

I think providing resource limits via XML/Groovy DSL might also be a good addition.

@TueDissingWork
Copy link
Contributor Author

mits via XML/Groovy DSL might also be a good a

I agree, then I could get completely rid of the remaining fragments.

@rohanKanojia
Copy link
Member

@manusa : Do you think providing resource requests/limits in <resource> configuration makes sense? If you agree I'll open this issue

@TueDissingWork
Copy link
Contributor Author

@manusa : Do you think providing resource requests/limits in <resource> configuration makes sense? If you agree I'll open this issue

It think it makes a lot of sense! A little too busy right now to add it myself, but maybe in a few weeks I could start contributing this; or just assist in testing/validating the solution.

@rohanKanojia rohanKanojia reopened this Feb 7, 2023
@manusa
Copy link
Member

manusa commented Feb 7, 2023

@manusa : Do you think providing resource requests/limits in <resource> configuration makes sense? If you agree I'll open this issue

Yes it does. However, we need to fix the ResourceConfig class first. We've been adding more and more fields there and everything is a mess. We need to merge #1969 before proceeding with this.

@manusa manusa added the enhancement New feature or request label Feb 14, 2023
@sunix sunix added the demoable Issues which can be demoed during the Sprint review meeting label Feb 14, 2023
@rohanKanojia rohanKanojia self-assigned this Mar 20, 2023
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Mar 20, 2023
…mits via controller resource config (eclipse-jkube#2040)

+ Rename existing OpenShiftBuildConfig class (that was only for
  OpenShift Build requests/limits) to RequestsLimitsConfig
+ Add new field `resourceRequestsLimits` to ControllerResourceConfig
+ Add new field `resourceClaims` to ControllerResourceConfig
+ ContainerHandler adds provided requests/limits to container if they're
  provided in ControllerResourceConfig via abovementioned fields.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Mar 20, 2023
…mits via controller resource config (eclipse-jkube#2040)

+ Rename existing OpenShiftBuildConfig class (that was only for
  OpenShift Build requests/limits) to RequestsLimitsConfig
+ Add new field `resourceRequestsLimits` to ControllerResourceConfig
+ Add new field `resourceClaims` to ControllerResourceConfig
+ ContainerHandler adds provided requests/limits to container if they're
  provided in ControllerResourceConfig via abovementioned fields.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@rohanKanojia
Copy link
Member

ResourceRequirements struct (resources field ) contains a new alpha field claims since latest Kubernetes release. It seems to be related to Kubenetes Dynamic Resource Allocation (which has to be enabled with a feature gate).

Does it make sense to add support for this field as well? Or shall we leave it for now until some user requests it in future (when it becomes stable)?

rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Mar 21, 2023
…mits via controller resource config (eclipse-jkube#2040)

+ Rename existing OpenShiftBuildConfig class (that was only for
  OpenShift Build requests/limits) to RequestsLimitsConfig
+ Add new field `resourceRequestsLimits` to ControllerResourceConfig
+ ContainerHandler adds provided requests/limits to container if they're
  provided in ControllerResourceConfig via abovementioned fields.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Mar 21, 2023
…mits via controller resource config (eclipse-jkube#2040)

+ Rename existing OpenShiftBuildConfig class (that was only for
  OpenShift Build requests/limits) to RequestsLimitsConfig
+ Add new field `resourceRequestsLimits` to ControllerResourceConfig
+ ContainerHandler adds provided requests/limits to container if they're
  provided in ControllerResourceConfig via abovementioned fields.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Mar 21, 2023
…mits via controller resource config (eclipse-jkube#2040)

+ Rename existing OpenShiftBuildConfig class (that was only for
  OpenShift Build requests/limits) to RequestsLimitsConfig
+ Add new field `resourceRequestsLimits` to ControllerResourceConfig
+ ContainerHandler adds provided requests/limits to container if they're
  provided in ControllerResourceConfig via abovementioned fields.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Mar 21, 2023
…mits via controller resource config (eclipse-jkube#2040)

+ Rename existing OpenShiftBuildConfig class (that was only for
  OpenShift Build requests/limits) to RequestsLimitsConfig
+ Add new field `resourceRequestsLimits` to ControllerResourceConfig
+ ContainerHandler adds provided requests/limits to container if they're
  provided in ControllerResourceConfig via abovementioned fields.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Mar 24, 2023
…mits via controller resource config (eclipse-jkube#2040)

+ Rename existing OpenShiftBuildConfig class (that was only for
  OpenShift Build requests/limits) to RequestsLimitsConfig
+ Add new field `resourceRequestsLimits` to ControllerResourceConfig
+ ContainerHandler adds provided requests/limits to container if they're
  provided in ControllerResourceConfig via abovementioned fields.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Mar 29, 2023
…mits via controller resource config (eclipse-jkube#2040)

+ Rename existing OpenShiftBuildConfig class (that was only for
  OpenShift Build requests/limits) to RequestsLimitsConfig
+ Add new field `resourceRequestsLimits` to ControllerResourceConfig
+ ContainerHandler adds provided requests/limits to container if they're
  provided in ControllerResourceConfig via abovementioned fields.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
manusa pushed a commit to rohanKanojia/jkube that referenced this issue Mar 30, 2023
…mits via controller resource config (eclipse-jkube#2040)

+ Rename existing OpenShiftBuildConfig class (that was only for
  OpenShift Build requests/limits) to RequestsLimitsConfig
+ Add new field `resourceRequestsLimits` to ControllerResourceConfig
+ ContainerHandler adds provided requests/limits to container if they're
  provided in ControllerResourceConfig via abovementioned fields.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@manusa manusa added this to the 1.12.0 milestone Mar 30, 2023
manusa pushed a commit that referenced this issue Mar 30, 2023
…mits via controller resource config (#2040)

+ Rename existing OpenShiftBuildConfig class (that was only for
  OpenShift Build requests/limits) to RequestsLimitsConfig
+ Add new field `resourceRequestsLimits` to ControllerResourceConfig
+ ContainerHandler adds provided requests/limits to container if they're
  provided in ControllerResourceConfig via abovementioned fields.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
demoable Issues which can be demoed during the Sprint review meeting enhancement New feature or request
Projects
None yet
4 participants