-
Notifications
You must be signed in to change notification settings - Fork 244
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
Use volume components from the devfile #3584
Use volume components from the devfile #3584
Conversation
@adisky @johnmcollier Can you pls help review this PR since you both worked with volumes code and converting v1 to v2 schema.. |
/retest |
Codecov Report
@@ Coverage Diff @@
## master #3584 +/- ##
==========================================
+ Coverage 45.51% 45.73% +0.21%
==========================================
Files 121 122 +1
Lines 12187 12237 +50
==========================================
+ Hits 5547 5596 +49
- Misses 6089 6090 +1
Partials 551 551
Continue to review full report at Codecov.
|
pkg/devfile/adapters/common/utils.go
Outdated
@@ -92,7 +92,8 @@ type CommandNames struct { | |||
AdapterName string | |||
} | |||
|
|||
func isComponentSupported(component common.DevfileComponent) bool { | |||
// isComponentAContainer returns a bool if the component is a container | |||
func isComponentAContainer(component common.DevfileComponent) bool { |
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.
Wouldn’t this be cleaner if it was a method on the component called IsContainer
?
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.
Updated!
pkg/devfile/adapters/common/utils.go
Outdated
@@ -101,6 +102,15 @@ func isComponentSupported(component common.DevfileComponent) bool { | |||
return false | |||
} | |||
|
|||
// isComponentAVolume returns a bool if the component is a volume | |||
func isComponentAVolume(component common.DevfileComponent) bool { |
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.
Same as above?
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.
Updated!
/retest |
|
||
// containerNameToVolumes is a map of the Devfile container name to the Devfile container Volumes | ||
containerNameToVolumes := make(map[string][]DevfileVolume) | ||
for _, containerComp := range containerComponents { |
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.
Any way we can avoid 3 nested for loops? What about by creating / using a map of vol name -> volume components?
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.
updated
|
||
// Only testing this in Kubernetes because odo OpenShift CI | ||
// sets the min pvc storage size to 100Gi | ||
if os.Getenv("KUBERNETES") == "true" { |
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.
Can we add this condition in JustAfterEach()
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.
Not sure what the point is in JustAfterEach
? in AfterEach
we remove the namespace/project. So the pvc will be gone by then.
@maysun we are verifying valid volume size at very later stage when i inserted an invalid volume size, i got this error and odo push failed.
when i checked Also could we update the error message to something like |
@adisky good point reg validation. I will move it much earlier. However, I do not think we should make our own validation regex or give an example like "2Gi/2Mi" because there are a lot of units and ways to write storage as evident from the Kube documentation(and also from the kube client api regex error):
from https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ I will just use the Kube Client for validation and wrap it around like this: |
@maysunfaisal agreed, just give one or two example at the end of regex message. |
@adisky how does this sound to you:
|
@adisky @johnmcollier PR updated for review feedback, pls help re-review, thx! |
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.
Changes look good.
/retest |
pkg/devfile/validate/components.go
Outdated
ErrorNoComponents = "no components present" | ||
ErrorNoContainerComponent = fmt.Sprintf("odo requires atleast one component of type '%s' in devfile", common.ContainerComponentType) | ||
ErrorNoComponents = "no components present" | ||
ErrorNoContainerComponent = fmt.Sprintf("odo requires atleast one component of type '%s' in devfile", common.ContainerComponentType) |
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.
can we have proper error types defined? instead of using variables
https://github.com/openshift/odo/pull/3549/files#diff-5fd81db0ba5aa2ae5579e01facb598e8R6
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.
so you're saying we should have a struct for each err types?
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.
updated
Implicit storage have been removed from the schema devfile/api#101 yesterday. We can drop the support for that too. |
@mik-dass oh wow I had implicit volumes with this PR but I checked the schema and there was no implicit volumes and removed it. And now I have to add it back again 😭 EDIT - I meant to say I had non implicit volumes with this PR before it was removed. |
@maysunfaisal Thanks |
/retest |
Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
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.
/lgtm
/retest |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kadel 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:
Approvers can indicate their approval by writing |
/retest Please review the full test history for this PR and help us cut down flakes. |
3 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
* Volume components devfile Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com> * Volume Component integration tests Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com> * Vol Component Feedback 1 Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com> * Vol Component Feedback 2 Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com> * Vol Component Feedback 3 Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com> * Container component volMount & volume component dependency Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com> * Fix rebased test Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com> * Remove devfile v1 tests Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com> * Update rebased tests Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
Signed-off-by: Maysun J Faisal maysun.j.faisal@ibm.com
What type of PR is this?
/kind feature
What does does this PR do / why we need it:
Volume
components from the devfile - refer the devfile v2 schemaWhich issue(s) this PR fixes:
Fixes #3407
PR acceptance criteria:
Unit test 9932537
Integration test TODO a3eeee9
Documentation
How to test changes / Special notes to the reviewer:
firstvol
,secondvol
,thirdvol
andodo push
. When usingfirstvol
though not defined in volume components, will be implicitly added with a default size of5Gi
secondvol
will use a default size of5Gi
since its size is not mentioendthirdvol
will use the mentioned size of10Gi