-
Notifications
You must be signed in to change notification settings - Fork 36
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
Migrate devfile specific vol code from odo to devfile/library #81
Conversation
Signed-off-by: Maysun J Faisal <[email protected]>
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 big issues as this PR is migrate from odo, some minor changes requested
return | ||
} else if tt.wantErr && err != nil { | ||
return | ||
} else if tt.wantErr && err == nil { |
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 simplify these checks?
if (err != nil) != tt.wantErr {
...
}
if tt.wantErr && err != nil {
return
}
pkg/devfile/generator/utils.go
Outdated
@@ -419,3 +419,46 @@ func getBuildConfigSpec(buildConfigSpecParams BuildConfigSpecParams) *buildv1.Bu | |||
}, | |||
} | |||
} | |||
|
|||
// GetVolumeMountPath gets the volume mount's path. | |||
func GetVolumeMountPath(volumeMount v1.VolumeMount) string { |
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 reason we want to make GetVolumeMountPath
an exposed function?
non of the util functions are exposed. if it is expected to be exposed, then should be under generator.go
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.
odo is using it in some of their code, i will move it to generators.go
pkg/devfile/generator/utils.go
Outdated
containers[i].VolumeMounts = append(containers[i].VolumeMounts, corev1.VolumeMount{ | ||
Name: volumeName, | ||
MountPath: mountPath, | ||
SubPath: "", |
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.
SubPath
is omitempty
, so no need to specifically set to ""
} | ||
} | ||
|
||
func TestAddVolumeMountToContainers(t *testing.T) { |
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.
test names are missing in this test suite
Signed-off-by: Maysun J Faisal <[email protected]>
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 to me
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: maysunfaisal, yangcao77 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 |
Signed-off-by: Maysun J Faisal [email protected]
What does this PR do?
This PR migrates the volume functions and logic that are devfile specific from the odo repo. Odo PR redhat-developer/odo#4627 refactored these code and this PR is a direct port of those functions
What issues does this PR fix or reference?
Part of devfile/api#181
Is your PR tested? Consider putting some instruction how to test your changes
yes, ensured the tests were copied over too