-
Notifications
You must be signed in to change notification settings - Fork 26
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
Assign resources to the NMA sidecar container #674
Conversation
pkg/meta/annotations.go
Outdated
@@ -159,6 +164,20 @@ const ( | |||
// image is built for that (and vice-versa). This annotation allows you to | |||
// skip that check. | |||
SkipDeploymentCheckAnnotation = "vertica.com/skip-deployment-check" | |||
|
|||
// Set of annotations that you can use to control the resources of the NMA | |||
// sidecar. The actual annoation name is: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// sidecar. The actual annoation name is: | |
// sidecar. The actual annotation name is: |
defVal := DefaultSidecarResource[resourceName] | ||
quantityStr := lookupStringAnnotation(annotations, annotationName, defVal.String()) | ||
if quantityStr == "" { | ||
return resource.Quantity{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why and we returning defVal here? Are you treating resource-annotation not set different from resource-annotation=""?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, if someone set the annotation but leaves it blank, we aren't going to use the default. I'll add a comment.
pkg/meta/resources.go
Outdated
@@ -26,7 +26,7 @@ var ( | |||
DefaultSidecarResource = map[corev1.ResourceName]resource.Quantity{ | |||
corev1.ResourceLimitsCPU: resource.MustParse("1"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it 1000 millicores?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is 1000 millicore. I believe just specifying 1 is equivalent to 1000m.
if nmaMemoryLimit.IsZero() { // Zero implies it isn't set. | ||
return allErrs | ||
} | ||
if vmeta.MinNMAMemoryLimit.Cmp(nmaMemoryLimit) == 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a min limit for cpu too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The memory is the important min to enforce because we cannot run things like catalog editor without at least 1GB of memory.
The NMA sidecar container now has default resources assigned to it in the pod spec. Some default values have been selected: 1CPU and 250MB of memory. These are for requests only. I intentionally left off the limit because of the burstable nature of the NMA container.
The resources are only set if the subcluster has defined resources. This ensures that the container can be run in low-resource environments (for testing purposes).
New annotations have been added to facilitate resource tuning. The new annotations are as follows:
vertica.com/nma-resources-limits-memory
vertica.com/nma-resources-limits-cpu
vertica.com/nma-resources-requests-memory
vertica.com/nma-resources-requests-cpu
Lastly, an existing e2e test case was updated. The test case was moved to the e2e-leg-7, as it assumes the use of the NMA sidecar and can only run on 24.2.0.