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

resourceReqs and podLabels for mover job/deploy #1072

Merged

Conversation

tesshuflower
Copy link
Contributor

Resolves: #707

Describe what this PR does

Allows configuration of resourceRequirements and podLabels for mover jobs/deployments.

Is there anything that requires special attention?

Docs still need to be updated - will need to warn users that using these knobs can potentially crash mover pods or prevent them from being scheduled.

Related issues:
moverResourceRequirements

Copy link

codecov bot commented Jan 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6a16bdf) 66.9% compared to head (86c6a22) 67.3%.
Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1072     +/-   ##
=======================================
+ Coverage   66.9%   67.3%   +0.4%     
=======================================
  Files         55      55             
  Lines       7080    7117     +37     
=======================================
+ Hits        4739    4795     +56     
+ Misses      2061    2042     -19     
  Partials     280     280             
Files Coverage Δ
controllers/mover/rclone/builder.go 90.0% <100.0%> (ø)
controllers/mover/rclone/mover.go 71.7% <100.0%> (+0.2%) ⬆️
controllers/mover/restic/builder.go 90.9% <100.0%> (ø)
controllers/mover/restic/mover.go 81.5% <100.0%> (+<0.1%) ⬆️
controllers/mover/rsync/builder.go 91.7% <100.0%> (+0.6%) ⬆️
controllers/mover/rsync/mover.go 77.2% <100.0%> (+0.1%) ⬆️
controllers/mover/rsynctls/builder.go 91.3% <100.0%> (ø)
controllers/mover/rsynctls/mover.go 71.6% <100.0%> (+<0.1%) ⬆️
controllers/mover/syncthing/builder.go 92.8% <100.0%> (ø)
controllers/mover/syncthing/mover.go 81.7% <100.0%> (+<0.1%) ⬆️
... and 1 more

Resolves: backube#707

Signed-off-by: Tesshu Flower <tflower@redhat.com>
@tesshuflower
Copy link
Contributor Author

/cc @JohnStrunk

- in cases where user has set securityReqs/
resourceRequirements, and then unsets in the spec,
we would not update the spec - in this case
make sure the job/deploy template gets updated
properly back to the default/empty values

Signed-off-by: Tesshu Flower <tflower@redhat.com>
Comment on lines 198 to 208
// Security context
if moverConfig.MoverSecurityContext != nil {
podTemplateSpec.Spec.SecurityContext = moverConfig.MoverSecurityContext
}

// Adjust the job/deploy containers resourceRequirements based on resourceRequirements from the moverConfig
if moverConfig.MoverResources != nil {
for i := range podTemplateSpec.Spec.Containers {
podTemplateSpec.Spec.Containers[i].Resources = *moverConfig.MoverResources
}
}
Copy link
Member

Choose a reason for hiding this comment

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

An observation... If a field in the moverConfig is null, we won't make any change to the template. Would this prevent us from removing these items once they are set?

I'm wondering if this should just be a simple assignment in the case of SecurityContext and perhaps assignment of an empty corev1.ResourceRequirements{} for MoverResources.

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm this is a very good point - I think I was hoping not to reset anything that could have been set up earlier, but I think this should work if I simply set the securityContext as you said - one specific case that I made me do it this way I think was Syncthing. It sets a memory limit by default on the mover pod, which I'm allowing to be overridden.

Copy link

sonarcloud bot commented Jan 25, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.5% Duplication on New Code

See analysis details on SonarCloud

Copy link
Member

@JohnStrunk JohnStrunk left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link
Contributor

openshift-ci bot commented Jan 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JohnStrunk, tesshuflower

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [JohnStrunk,tesshuflower]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 23ea932 into backube:main Jan 26, 2024
33 checks passed
@tesshuflower tesshuflower deleted the moverResourceRequirements branch January 29, 2024 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Customize cpu/Memory resourceRequirements/Limit on mover pods
2 participants