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

Adds default resources for fetcher pod #500

Merged
merged 2 commits into from
Feb 23, 2018
Merged

Conversation

vishal-biyani
Copy link
Member

@vishal-biyani vishal-biyani commented Feb 19, 2018

This PR adds default resources for Fetcher pod for both executors - pool manager and new deployment (And fixes #478 ). Currently, the resource numbers are based on experimentation. In future maybe we could look at the numbers from monitoring (Prometheus?)

Also, the getFetcherResources method is duplicated in both executors. On one hand, I wanted different fetcher resources for both but also wanted to avoid code duplication. I can not move the method up at executor level as it will cause cyclical dependency of packages, maybe create a util package within executor and then import in both executors?


This change is Reviewable

mincpu, err := resource.ParseQuantity("10m")
minmem, err := resource.ParseQuantity("16Mi")
maxcpu, err := resource.ParseQuantity("40m")
maxmem, err := resource.ParseQuantity("128Mi")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can move this outside of the function (either ignore the errors as they are hardcoded anyway, or check in the init(), or wrap them in a helper function (like MustParseQuantity))

@@ -87,6 +113,12 @@ func (deploy *NewDeploy) createOrGetDeployment(fn *crd.Function, env *crd.Enviro
return nil, err
}

fetcherResources, err := deploy.getFetcherResources()
if err != nil {
log.Printf("Error while parsing fetcher resources: %v", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why print here, rather than wrapping the err?

@@ -715,3 +723,27 @@ func (gp *GenericPool) destroy() error {

return nil
}

func (gp *GenericPool) getFetcherResources() (v1.ResourceRequirements, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract this to a common/util file + it doesn't seem to be needed to attach this function the GenericPool.

@@ -214,6 +246,10 @@ func (deploy *NewDeploy) createOrGetHpa(hpaName string, execStrategy *fission.Ex
return existingHpa, err
}

if depl == nil {
return nil, errors.New("Failed to create HPA, found empty deployment")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: try to stick with idiomatic go: error messages should not be capitalized.

@vishal-biyani vishal-biyani added this to the 0.6.0 milestone Feb 21, 2018
Copy link
Member

@erwinvaneyk erwinvaneyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍

@vishal-biyani
Copy link
Member Author

Thanks, @erwinvaneyk !

@@ -715,3 +723,27 @@ func (gp *GenericPool) destroy() error {

return nil
}

func (gp *GenericPool) getFetcherResources() (v1.ResourceRequirements, error) {
//TBD Hardcoded as of now, should be configurable?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it really ought to be configurable. You could write a quick GetenvWithDefault function and maybe use that? Something like resource.ParseQuantity(GetenvWithDefault("FETCHER_MINCPU", "5m"))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok to do in a later change if you like.

@vishal-biyani vishal-biyani merged commit e5b137f into master Feb 23, 2018
@vishal-biyani vishal-biyani deleted the fetcher_resources branch February 23, 2018 19:37
sarun87 pushed a commit to sarun87/fission that referenced this pull request Feb 27, 2018
The fetcher needs a relatively smaller set of resources and does not have to be same as the function container/defaults. This change adds defaults for fetcher containers in function pods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default ResourceRequirements for Fetcher container
3 participants