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

[features] migrate npm feature #481

Merged
merged 3 commits into from
May 11, 2022
Merged

[features] migrate npm feature #481

merged 3 commits into from
May 11, 2022

Conversation

celenechang
Copy link
Contributor

What does this PR do?

Migrate NPM feature to new framework
Adjust VolumeManager to handle case when more than one but fewer than all containers need a volumeMount

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

Describe your test plan

Write there any instructions and details you may have to test your PR.

@celenechang celenechang added this to the v1.0.0 milestone May 8, 2022
@celenechang celenechang requested review from a team as code owners May 8, 2022 01:46
@codecov-commenter
Copy link

codecov-commenter commented May 8, 2022

Codecov Report

Merging #481 (4594072) into main (27d2ea8) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #481   +/-   ##
=======================================
  Coverage   59.68%   59.68%           
=======================================
  Files           3        3           
  Lines         129      129           
=======================================
  Hits           77       77           
  Misses         40       40           
  Partials       12       12           
Flag Coverage Δ
unittests 59.68% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 27d2ea8...4594072. Read the comment docs.

@@ -59,13 +65,18 @@ func (impl *volumeManagerImpl) AddVolumeWithMergeFunc(volume *corev1.Volume, vol
return nil
}

func (impl *volumeManagerImpl) AddVolumeToContainerWithMergeFunc(volume *corev1.Volume, volumeMount *corev1.VolumeMount, containerName commonv1.AgentContainerName, volumeMergeFunc VolumeMergeFunction, volumeMountMergeFunc VolumeMountMergeFunction) error {
func (impl *volumeManagerImpl) AddVolumeToContainersWithMergeFunc(volume *corev1.Volume, volumeMount *corev1.VolumeMount, containerNames []commonv1.AgentContainerName, volumeMergeFunc VolumeMergeFunction, volumeMountMergeFunc VolumeMountMergeFunction) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

A solution should be to call the function AddVolumeToContainerWithMergeFunc() in a loop on containerNames. It will not be optimum in term of tentative to add the Volume, but it can reduce the code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea i thought about that, but in the worst case scenario it would loop through the impl.podTmpl.Spec.Containers 4 x 5 times..

we could add the return into the if block which would help a bit. do you prefer this route?

update: will implement the way you suggest

Copy link
Collaborator

Choose a reason for hiding this comment

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

we can keep the function as it is too 👍

@@ -59,13 +65,18 @@ func (impl *volumeManagerImpl) AddVolumeWithMergeFunc(volume *corev1.Volume, vol
return nil
}

func (impl *volumeManagerImpl) AddVolumeToContainerWithMergeFunc(volume *corev1.Volume, volumeMount *corev1.VolumeMount, containerName commonv1.AgentContainerName, volumeMergeFunc VolumeMergeFunction, volumeMountMergeFunc VolumeMountMergeFunction) error {
func (impl *volumeManagerImpl) AddVolumeToContainersWithMergeFunc(volume *corev1.Volume, volumeMount *corev1.VolumeMount, containerNames []commonv1.AgentContainerName, volumeMergeFunc VolumeMergeFunction, volumeMountMergeFunc VolumeMountMergeFunction) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we can keep the function as it is too 👍

@celenechang celenechang merged commit 4842be7 into main May 11, 2022
@celenechang celenechang deleted the celene/npm_feature branch May 11, 2022 13:21
celenechang added a commit that referenced this pull request May 18, 2022
* [features] migrate npm feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants