fantapsody opened a new pull request #9736:
URL: https://github.com/apache/pulsar/pull/9736


   ### Motivation
   
   Currently, users could request arbitrary resource values within the range of 
`functionInstanceMinResources` and `functionInstanceMaxResources` when creating 
functions, while in a production environment, it's common to define certain 
resource granularities (such as 0.5cpu/512Mi) and only allow the requested 
resources to be multiples of these granularities (such as 1cpu/512Mi, 
2cpu/1.5Gi, 4cpu/8Gi) to reduce management costs.
   
   Moreover, sometimes it's also necessary to require different types of 
resources to be the same multiples of the granularity. For example, if the 
resource granularities are set to 0.5cpu/512Mi, then valid resource values 
could be:
   - 0.5cpu/512Mi
   - 1cpu/1Gi
   - 1.5cpu/1.5Gi
   - 2cpu/2Gi
   - ...
   
   *Explain here the context, and why you're making that change. What is the 
problem you're trying to solve.*
   
   ### Modifications
   
   The PR adds two new function settings to address the feature mentioned 
above, and added checks in the admission controller to valid request against 
the rules:
   - `functionInstanceResourceGranularities`: granularities of requested 
resources. If the granularity of any type of resource is set the requested 
resource of the type must be a multiple of the granularity.
   - `functionInstanceResourceChangeInLockStep`: if this configuration is set 
to be true, the amount of requested resources of all type of resources that 
have the granularity set must be the same multiples of their granularities.
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   This change added tests and can be verified as follows:
   
     - Added unit tests to verify the configurations and checks.
   
   ### Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / no)
     - The public API: (yes / no)
     - The schema: (yes / no / don't know)
     - The default values of configurations: (yes / no)
     - The wire protocol: (yes / no)
     - The rest endpoints: (yes / no)
     - The admin cli options: (yes / no)
     - Anything that affects deployment: (yes / no / don't know)
   
   ### Documentation
   
   A sample configuration has been added to conf/functions_worker.yml.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to