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

Migrate devfile specific vol code from odo to devfile/library #81

Merged
merged 2 commits into from
Apr 21, 2021

Conversation

maysunfaisal
Copy link
Member

Signed-off-by: Maysun J Faisal maysunaneek@gmail.com

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

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>
Copy link
Collaborator

@yangcao77 yangcao77 left a 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 {
Copy link
Collaborator

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
}

@@ -419,3 +419,46 @@ func getBuildConfigSpec(buildConfigSpecParams BuildConfigSpecParams) *buildv1.Bu
},
}
}

// GetVolumeMountPath gets the volume mount's path.
func GetVolumeMountPath(volumeMount v1.VolumeMount) string {
Copy link
Collaborator

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

Copy link
Member Author

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

containers[i].VolumeMounts = append(containers[i].VolumeMounts, corev1.VolumeMount{
Name: volumeName,
MountPath: mountPath,
SubPath: "",
Copy link
Collaborator

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

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 <maysunaneek@gmail.com>
Copy link
Collaborator

@yangcao77 yangcao77 left a 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

@openshift-ci-robot
Copy link

[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:
  • OWNERS [maysunfaisal,yangcao77]

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

@maysunfaisal maysunfaisal merged commit 1017f66 into devfile:master Apr 21, 2021
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.

3 participants