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

Adds storage Push() for devfile components. #4407

Merged
merged 6 commits into from
Mar 15, 2021

Conversation

mik-dass
Copy link
Contributor

@mik-dass mik-dass commented Feb 4, 2021

What type of PR is this?

/kind code-refactoring

What does does this PR do / why we need it:

It also adds CLI messages for creation and deletion of storage.

Which issue(s) this PR fixes:

Fixes part of #4298

PR acceptance criteria:

How to test changes / Special notes to the reviewer:

  • Adding storage and removing volumes to the devfile should print log messages during odo push.
  • Tests should pass.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Feb 4, 2021
@openshift-ci-robot
Copy link
Collaborator

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mik-dass

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Feb 4, 2021
@mik-dass mik-dass marked this pull request as ready for review February 5, 2021 08:54
Copy link
Contributor

@maysunfaisal maysunfaisal left a comment

Choose a reason for hiding this comment

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

  • Just glanced through the PR to see how it may affect devfile/library.
  • A few thoughts from odo's perspective if you will 😉

pkg/storage/kubernetes.go Outdated Show resolved Hide resolved
continue
}
volumeNameToPVCName[pvc.Labels[storagelabels.DevfileStorageLabel]] = pvc.Name
}

// Get PVC volumes and Volume Mounts
containers, pvcVolumes, err := storage.GetPVCAndVolumeMount(containers, volumeNameToPVCName, containerNameToVolumes)
Copy link
Contributor

Choose a reason for hiding this comment

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

so i was looking to extract this logic out, so that the library can return the updated containers with volume mounts and the pvc volumes after reading the devfile.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have only modified the network calls in this function.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, after this merged, I can look to consolidate this in devfile/library call; so anyone calling devfile/library generator func like generator.GetVolume() will return the pvcVolumes and updated container volumeMounts 👍

pkg/kclient/kclient.go Outdated Show resolved Hide resolved
@mik-dass mik-dass force-pushed the storage_push branch 8 times, most recently from d958305 to 97007be Compare March 2, 2021 10:21
@mik-dass
Copy link
Contributor Author

mik-dass commented Mar 2, 2021

• Failure in Spec Setup (JustBeforeEach) [306.915 seconds]
odo service command tests for OperatorHub
/go/src/github.com/openshift/odo/tests/integration/operatorhub/cmd_service_test.go:17
  When linking devfile component with Operator backed service
  /go/src/github.com/openshift/odo/tests/integration/operatorhub/cmd_service_test.go:372
    should successfully connect and disconnect a component with an existing service [JustBeforeEach]
    /go/src/github.com/openshift/odo/tests/integration/operatorhub/cmd_service_test.go:422
    Timeout after 5 minutes

/retest

@mik-dass mik-dass changed the title [WIP] Adds storage Push() for devfile components. Adds storage Push() for devfile components. Mar 2, 2021
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Mar 2, 2021
@mik-dass mik-dass force-pushed the storage_push branch 3 times, most recently from 95905d8 to 52ed1f6 Compare March 4, 2021 14:15
pkg/storage/storage.go Outdated Show resolved Hide resolved
pkg/storage/storage.go Outdated Show resolved Hide resolved
pkg/storage/s2i.go Show resolved Hide resolved
pkg/storage/storage.go Show resolved Hide resolved
pkg/occlient/occlient.go Show resolved Hide resolved
continue
}
volumeNameToPVCName[pvc.Labels[storagelabels.DevfileStorageLabel]] = pvc.Name
}

// Get PVC volumes and Volume Mounts
containers, pvcVolumes, err := storage.GetPVCAndVolumeMount(containers, volumeNameToPVCName, containerNameToVolumes)
Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, after this merged, I can look to consolidate this in devfile/library call; so anyone calling devfile/library generator func like generator.GetVolume() will return the pvcVolumes and updated container volumeMounts 👍

Copy link
Contributor

@maysunfaisal maysunfaisal left a comment

Choose a reason for hiding this comment

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

lgtm

for _, pvc := range pvcs {
found := false
for _, volumeMount := range volumeMounts {
if volumeMount.Name == pvc.Name+"-vol" {
// this volume mount is used by a PVC
validVolumeMounts[volumeMount.Name] = true

found = true
Copy link
Contributor

Choose a reason for hiding this comment

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

I dont think you need this check at all, if you think about it; you can have a volume component in a devfile(and a pvc for it) and not be mounted on any container component. Is it really an err case?

I think this goes back to the case where odo should only create pvc for volume components that are used in container components but i guess it can be a separate issue on it its own

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I dont think you need this check at all, if you think about it; you can have a volume component in a devfile(and a pvc for it) and not be mounted on any container component. Is it really an err case?

Yes, we decided not to support such a case as this may lead to unintentional PVC usage.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Mar 12, 2021
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@mik-dass mik-dass added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. Required by Prow. label Mar 13, 2021
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Mar 15, 2021
Copy link
Contributor

@maysunfaisal maysunfaisal left a comment

Choose a reason for hiding this comment

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

lgtm, good catch on source volume

@maysunfaisal
Copy link
Contributor

/retest

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Mar 15, 2021
@mik-dass mik-dass removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. Required by Prow. label Mar 15, 2021
@mik-dass
Copy link
Contributor Author

[ssh:Fedora 32]     --- FAIL: TestCreateOrUpdateComponent/Case_4:_Valid_devfile,_already_running_component (0.00s)
[ssh:Fedora 32]         adapter_test.go:112: component adapter create unexpected error invalid configuration: no configuration has been provided
[ssh:Fedora 32]             Please login to your server: 
[ssh:Fedora 32]             
[ssh:Fedora 32]             odo login https://mycluster.mydomain.com

/retest

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Mar 15, 2021
@maysunfaisal
Copy link
Contributor

rebased
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Mar 15, 2021
@openshift-ci
Copy link

openshift-ci bot commented Mar 15, 2021

@mik-dass: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/v4.6-integration-e2e b1a49ed link /test v4.6-integration-e2e
ci/prow/v4.6-e2e-4x-psi daf11e5 link /test v4.6-e2e-4x-psi
ci/prow/v4.7-e2e-4x-psi ba6e110 link /test v4.7-e2e-4x-psi
ci/prow/psi-kubernetes-integration-e2e e75b72c link /test psi-kubernetes-integration-e2e
ci/prow/psi-openshift-integration-e2e e75b72c link /test psi-openshift-integration-e2e

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit 687e751 into redhat-developer:master Mar 15, 2021
@mik-dass mik-dass deleted the storage_push branch March 16, 2021 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. lgtm Indicates that a PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants