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

Assign resources to the NMA sidecar container #674

Merged
merged 9 commits into from
Jan 30, 2024

Conversation

spilchen
Copy link
Collaborator

@spilchen spilchen commented Jan 25, 2024

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.

@spilchen spilchen requested a review from roypaulin January 25, 2024 18:30
@spilchen spilchen self-assigned this Jan 25, 2024
@@ -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:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// 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{}
Copy link
Collaborator

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=""?

Copy link
Collaborator Author

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.

@@ -26,7 +26,7 @@ var (
DefaultSidecarResource = map[corev1.ResourceName]resource.Quantity{
corev1.ResourceLimitsCPU: resource.MustParse("1"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it 1000 millicores?

Copy link
Collaborator Author

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 {
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

@spilchen spilchen merged commit 90b4b89 into main Jan 30, 2024
29 checks passed
@spilchen spilchen deleted the spilchen/nma-annotations branch January 30, 2024 12:39
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.

2 participants