Skip to content

Adding container flag for storage and fixing code to work with it #4595

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

Conversation

mohammedzee1000
Copy link
Contributor

@mohammedzee1000 mohammedzee1000 commented Apr 7, 2021

Signed-off-by: Mohammed Zeeshan Ahmed [email protected]

What type of PR is this?

Uncomment only one /kind line, and delete the rest.
For example, > /kind bug would simply become: /kind bug

/kind feature

What does does this PR do / why we need it:
This PR attempts to fix need for container flag in storage create command

Which issue(s) this PR fixes:

Fixes #4105

PR acceptance criteria:

How to test changes / Special notes to the reviewer:
WIP

@openshift-ci-robot openshift-ci-robot added kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. labels Apr 7, 2021
}

// if there are patherrors at this point give generic error
if len(pathErrorContainers) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

if volumeExists {
ei.devfileObj.Data.UpdateComponent(volumeComponent)
} else {
err = ei.devfileObj.Data.AddComponents([]devfilev1.Component{volumeComponent})
Copy link
Contributor

Choose a reason for hiding this comment

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

here as we are checking pathErrorContainers below this, we might be adding duplicate volume mounts?

Copy link
Contributor Author

@mohammedzee1000 mohammedzee1000 Apr 8, 2021

Choose a reason for hiding this comment

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

Moved to below the loop. I will push the updated commit shortly.

I am not sure though how we will add duplicate volume mounts. We only add volume mount, if the container in question does not already have it, and similarly, we add the global volume component only if it has not already been added. Otherwise, we update the existing volume component

@mohammedzee1000
Copy link
Contributor Author

/refresh

@mohammedzee1000 mohammedzee1000 changed the title WIP Adding container flag for storage and fixing code to work with it \Adding container flag for storage and fixing code to work with it Apr 9, 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 Apr 9, 2021
@mohammedzee1000 mohammedzee1000 changed the title \Adding container flag for storage and fixing code to work with it Adding container flag for storage and fixing code to work with it Apr 9, 2021
@dharmit
Copy link
Member

dharmit commented Apr 12, 2021

@mohammedzee1000 Thanks for taking this ahead. This feature needs documentation. Please take a look at where it makes most sense to add this on https://odo.dev. It might make sense to add it to Using persistent storage doc.

@dharmit
Copy link
Member

dharmit commented Apr 12, 2021

/hold

Remove hold after documentation is added.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. Required by Prow. label Apr 12, 2021
@mohammedzee1000
Copy link
Contributor Author

Will do

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Apr 12, 2021
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Apr 14, 2021
@mohammedzee1000 mohammedzee1000 force-pushed the store_specific_cont branch 2 times, most recently from 13ae176 to 2f956c9 Compare April 15, 2021 08:17
@mohammedzee1000
Copy link
Contributor Author

mohammedzee1000 commented Apr 15, 2021

Running locally with ginkgo -v gives me (latest run)

odo devfile storage command tests When devfile storage create command is executed 
  should create storage and attach to specified container successfully and list it correctly
  /home/mzee1000/workbench/work/golang/redhat-gomod/odo/tests/integration/devfile/cmd_devfile_storage_test.go:69

Created dir: /tmp/871693683
Setting KUBECONFIG=/tmp/871693683/config
Creating a new project: cmd-devfile-storage-test69jfu
Running odo with args [odo project create cmd-devfile-storage-test69jfu -w -v4]
[odo] I0415 15:07:14.226189 1916796 preference.go:235] The path for preference file is /home/mzee1000/.odo/preference.yaml
[odo] I0415 15:07:14.227070 1916796 util.go:727] HTTPGetRequest: https://raw.githubusercontent.com/openshift/odo/master/build/VERSION
[odo] I0415 15:07:14.227173 1916796 util.go:748] Response will be cached in /tmp/odohttpcache for 1h0m0s
[odo] I0415 15:07:15.650322 1916796 util.go:761] Cached response used.
[odo] I0415 15:07:15.877240 1916796 kclient.go:202] Checking if "projects" resource supported
[odo]  •  Waiting for project to come up  ...
[odo] I0415 15:07:18.973153 1916796 projects.go:190] Status of creation of project cmd-devfile-storage-test69jfu is Active
[odo] I0415 15:07:18.973205 1916796 projects.go:195] Project cmd-devfile-storage-test69jfu now exists
[odo] I0415 15:07:20.559193 1916796 namespace.go:181] Status of creation of service account &ServiceAccount{ObjectMeta:{default  cmd-devfile-storage-test69jfu /api/v1/namespaces/cmd-devfile-storage-test69jfu/serviceaccounts/default ebf7703f-678e-42dc-b0b5-2bb09b7e901d 45300 0 2021-04-15 15:07:17 +0530 IST <nil> <nil> map[] map[] [] []  []},Secrets:[]ObjectReference{ObjectReference{Kind:,Namespace:,Name:default-token-zxpp2,UID:,APIVersion:,ResourceVersion:,FieldPath:,},ObjectReference{Kind:,Namespace:,Name:default-dockercfg-5mnnc,UID:,APIVersion:,ResourceVersion:,FieldPath:,},},ImagePullSecrets:[]LocalObjectReference{LocalObjectReference{Name:default-dockercfg-5mnnc,},},AutomountServiceAccountToken:nil,} is ready
 ✓  Waiting for project to come up [5s]
[odo]  ✓  Project 'cmd-devfile-storage-test69jfu' is ready for use
[odo] I0415 15:07:20.600824 1916796 odo.go:73] Could not get the latest release information in time. Never mind, exiting gracefully :)
[odo]  ✓  New project created and now using project: cmd-devfile-storage-test69jfu
Current working dir: /home/mzee1000/workbench/work/golang/redhat-gomod/odo/tests/integration/devfile
Running odo with args [odo create nodejs lvtwgi --context /tmp/871693683 --project cmd-devfile-storage-test69jfu]
[odo] I0415 15:07:20.680634 1916896 util.go:727] HTTPGetRequest: https://raw.githubusercontent.com/openshift/odo/master/build/VERSION
[odo] I0415 15:07:20.680646 1916896 util.go:422] path /tmp/871693683/.odo/config.yaml doesn't exist, skipping it
[odo] I0415 15:07:20.680776 1916896 util.go:422] path /tmp/871693683/.odo/env/env.yaml doesn't exist, skipping it
[odo] I0415 15:07:20.680783 1916896 util.go:422] path /tmp/871693683/.odo/env/env.yaml doesn't exist, skipping it
[odo] I0415 15:07:20.680789 1916896 util.go:422] path /tmp/871693683/devfile.yaml doesn't exist, skipping it
[odo] I0415 15:07:20.680794 1916896 util.go:422] path /tmp/871693683/devfile.yaml doesn't exist, skipping it
[odo] I0415 15:07:20.680800 1916896 util.go:422] path /tmp/871693683/devfile.yaml doesn't exist, skipping it
[odo] I0415 15:07:20.680810 1916896 preference.go:235] The path for preference file is /tmp/871693683/preference.yaml
[odo] I0415 15:07:20.680805 1916896 util.go:748] Response will be cached in /tmp/odohttpcache for 1h0m0s
[odo] I0415 15:07:20.680890 1916896 preference.go:235] The path for preference file is /tmp/871693683/preference.yaml
[odo] I0415 15:07:20.680961 1916896 util.go:761] Cached response used.
[odo] I0415 15:07:20.680967 1916896 preference.go:235] The path for preference file is /tmp/871693683/preference.yaml
[odo] I0415 15:07:20.681020 1916896 util.go:727] HTTPGetRequest: https://raw.githubusercontent.com/odo-devfiles/registry/master/devfiles/index.json
[odo] I0415 15:07:20.681055 1916896 util.go:748] Response will be cached in /tmp/odohttpcache for 15m0s
[odo] I0415 15:07:23.940701 1916896 util.go:761] Cached response used.
[odo] I0415 15:07:23.941698 1916896 util.go:422] path /tmp/871693683/devfile.yaml doesn't exist, skipping it
[odo] Devfile Object Validation
[odo]  •  Checking devfile existence  ...
 ✓  Checking devfile existence [33182ns]
[odo]  •  Creating a devfile component from registry: DefaultDevfileRegistry  ...
 ✓  Creating a devfile component from registry: DefaultDevfileRegistry [71783ns]
[odo] Validation
[odo]  •  Validating if devfile name is correct  ...
[odo] I0415 15:07:23.942041 1916896 util.go:422] path /tmp/871693683/devfile.yaml doesn't exist, skipping it
[odo] I0415 15:07:23.942060 1916896 preference.go:235] The path for preference file is /tmp/871693683/preference.yaml
 ✓  Validating if devfile name is correct [98264ns]
[odo] I0415 15:07:23.942256 1916896 preference.go:235] The path for preference file is /tmp/871693683/preference.yaml
[odo] I0415 15:07:23.942426 1916896 util.go:727] HTTPGetRequest: https://raw.githubusercontent.com/odo-devfiles/registry/master/devfiles/nodejs/devfile.yaml
[odo] I0415 15:07:23.942561 1916896 util.go:748] Response will be cached in /tmp/odohttpcache for 15m0s
[odo] I0415 15:07:24.918600 1916896 util.go:761] Cached response used.
[odo] I0415 15:07:24.926349 1916896 content.go:33] converted devfile YAML to JSON
[odo] I0415 15:07:24.926544 1916896 apiVersion.go:50] devfile apiVersion: '2.0.0'
[odo] I0415 15:07:24.926567 1916896 helper.go:41] devfile apiVersion '2.0.0' is supported
[odo] I0415 15:07:24.946778 1916896 schema.go:46] validated devfile schema
[odo] I0415 15:07:24.951755 1916896 validate.go:50] Successfully validated devfile sections
[odo] I0415 15:07:24.951806 1916896 preference.go:235] The path for preference file is /tmp/871693683/preference.yaml
[odo] 
[odo] Please use `odo push` command to create the component with source deployed
[odo] I0415 15:07:24.952495 1916896 odo.go:73] Could not get the latest release information in time. Never mind, exiting gracefully :)
Running odo with args [odo storage create lbokv --path /data1 --context /tmp/871693683 --container funtime --size 1Gi]
[odo] I0415 15:07:25.036363 1916936 util.go:727] HTTPGetRequest: https://raw.githubusercontent.com/openshift/odo/master/build/VERSION
[odo] I0415 15:07:25.036366 1916936 preference.go:235] The path for preference file is /tmp/871693683/preference.yaml
[odo] I0415 15:07:25.036492 1916936 util.go:748] Response will be cached in /tmp/odohttpcache for 1h0m0s
[odo] I0415 15:07:25.036617 1916936 util.go:761] Cached response used.
[odo] I0415 15:07:28.905322 1916936 context.go:130] absolute devfile path: '/tmp/871693683/devfile.yaml'
[odo] I0415 15:07:28.905360 1916936 context.go:72] absolute devfile path: '/tmp/871693683/devfile.yaml'
[odo] I0415 15:07:28.906185 1916936 content.go:33] converted devfile YAML to JSON
[odo] I0415 15:07:28.906332 1916936 apiVersion.go:50] devfile apiVersion: '2.0.0'
[odo] I0415 15:07:28.906347 1916936 helper.go:41] devfile apiVersion '2.0.0' is supported
[odo] I0415 15:07:28.918903 1916936 schema.go:46] validated devfile schema
[odo] I0415 15:07:28.922517 1916936 validate.go:50] Successfully validated devfile sections
[odo]  ✓  Added storage lbokv to lvtwgi
[odo] 
[odo] Please use `odo push` command to make the storage accessible to the component
[odo] I0415 15:07:28.923971 1916936 writer.go:53] devfile yaml created at: 'devfile.yaml'
[odo] I0415 15:07:28.924032 1916936 odo.go:73] Could not get the latest release information in time. Never mind, exiting gracefully :)
Running odo with args [odo storage list --context /tmp/871693683]
[odo] I0415 15:07:28.993369 1916983 preference.go:235] The path for preference file is /tmp/871693683/preference.yaml
[odo] I0415 15:07:28.993714 1916983 util.go:727] HTTPGetRequest: https://raw.githubusercontent.com/openshift/odo/master/build/VERSION
[odo] I0415 15:07:28.993779 1916983 util.go:748] Response will be cached in /tmp/odohttpcache for 1h0m0s
[odo] I0415 15:07:28.993941 1916983 util.go:761] Cached response used.
[odo] I0415 15:07:31.686303 1916983 context.go:130] absolute devfile path: '/tmp/871693683/devfile.yaml'
[odo] I0415 15:07:31.686347 1916983 context.go:72] absolute devfile path: '/tmp/871693683/devfile.yaml'
[odo] I0415 15:07:31.687309 1916983 content.go:33] converted devfile YAML to JSON
[odo] I0415 15:07:31.687491 1916983 apiVersion.go:50] devfile apiVersion: '2.0.0'
[odo] I0415 15:07:31.687517 1916983 helper.go:41] devfile apiVersion '2.0.0' is supported
[odo] I0415 15:07:31.693138 1916983 schema.go:46] validated devfile schema
[odo] I0415 15:07:31.694461 1916983 validate.go:50] Successfully validated devfile sections
[odo] The component 'lvtwgi' has the following storage attached:
[odo] NAME      SIZE     PATH       CONTAINER     STATE
[odo] lbokv     1Gi      /data1     funtime       Not Pushed
[odo] 
[odo] I0415 15:07:32.964422 1916983 odo.go:73] Could not get the latest release information in time. Never mind, exiting gracefully :)
Running odo with args [odo push --context /tmp/871693683]
[odo] I0415 15:07:33.036499 1917026 context.go:130] absolute devfile path: '/tmp/871693683/devfile.yaml'
[odo] I0415 15:07:33.036531 1917026 context.go:72] absolute devfile path: '/tmp/871693683/devfile.yaml'
[odo] I0415 15:07:33.036553 1917026 util.go:727] HTTPGetRequest: https://raw.githubusercontent.com/openshift/odo/master/build/VERSION
[odo] I0415 15:07:33.036607 1917026 util.go:748] Response will be cached in /tmp/odohttpcache for 1h0m0s
[odo] I0415 15:07:33.036779 1917026 util.go:761] Cached response used.
[odo] I0415 15:07:33.036783 1917026 content.go:33] converted devfile YAML to JSON
[odo] I0415 15:07:33.036830 1917026 apiVersion.go:50] devfile apiVersion: '2.0.0'
[odo] I0415 15:07:33.036837 1917026 helper.go:41] devfile apiVersion '2.0.0' is supported
[odo] I0415 15:07:33.040322 1917026 schema.go:46] validated devfile schema
[odo] I0415 15:07:33.041487 1917026 validate.go:50] Successfully validated devfile sections
[odo] I0415 15:07:33.041594 1917026 preference.go:235] The path for preference file is /tmp/871693683/preference.yaml
[odo] I0415 15:07:36.674927 1917026 preference.go:235] The path for preference file is /tmp/871693683/preference.yaml
[odo] I0415 15:07:36.675216 1917026 context.go:130] absolute devfile path: '/tmp/871693683/devfile.yaml'
[odo] I0415 15:07:36.675240 1917026 context.go:72] absolute devfile path: '/tmp/871693683/devfile.yaml'
[odo] I0415 15:07:36.676176 1917026 content.go:33] converted devfile YAML to JSON
[odo] I0415 15:07:36.676387 1917026 apiVersion.go:50] devfile apiVersion: '2.0.0'
[odo] I0415 15:07:36.676411 1917026 helper.go:41] devfile apiVersion '2.0.0' is supported
[odo] I0415 15:07:36.693698 1917026 schema.go:46] validated devfile schema
[odo] I0415 15:07:36.694039 1917026 validate.go:50] Successfully validated devfile sections
[odo] I0415 15:07:36.694175 1917026 preference.go:235] The path for preference file is /tmp/871693683/preference.yaml
[odo] I0415 15:07:36.694428 1917026 preference.go:235] The path for preference file is /tmp/871693683/preference.yaml
[odo] I0415 15:07:36.725486 1917026 preference.go:235] The path for preference file is /tmp/871693683/preference.yaml
[odo] I0415 15:07:36.725697 1917026 preference.go:235] The path for preference file is /tmp/871693683/preference.yaml
[odo] I0415 15:07:38.369314 1917026 utils.go:60] Deployment lvtwgi not found
[odo] 
[odo] Validation
[odo]  •  Validating the devfile  ...
[odo] I0415 15:07:38.369441 1917026 command.go:171] Build command: devbuild
[odo] I0415 15:07:38.369458 1917026 command.go:178] Run command: devrun
 ✓  Validating the devfile [90617ns]
[odo] 
[odo] Creating Kubernetes resources for component lvtwgi
[odo] I0415 15:07:38.369508 1917026 preference.go:235] The path for preference file is /tmp/871693683/preference.yaml
[odo] I0415 15:07:40.448995 1917026 kubernetes.go:57] Creating a PVC with name lbokv-lvtwgi-wjnf and labels map[app:app app.kubernetes.io/instance:lvtwgi app.kubernetes.io/managed-by:odo app.kubernetes.io/managed-by-version:v2.0.8 app.kubernetes.io/part-of:app app.kubernetes.io/storage-name:lbokv component:lvtwgi storage-name:lbokv]
[odo]  ✓  Added storage lbokv to lvtwgi
[odo] I0415 15:07:41.097023 1917026 command.go:92] the command group of kind "debug" is not found in the devfile
[odo] I0415 15:07:41.097073 1917026 utils.go:223] Updating container runtime entrypoint with supervisord
[odo] I0415 15:07:41.097103 1917026 utils.go:118] Updating container runtime with supervisord volume mounts
[odo] I0415 15:07:41.097129 1917026 utils.go:128] Updating container runtime env with run command
[odo] I0415 15:07:41.097151 1917026 utils.go:145] Updating container runtime env with run command's workdir
[odo] I0415 15:07:42.205697 1917026 adapter.go:475] Creating deployment lvtwgi
[odo] I0415 15:07:42.205711 1917026 adapter.go:476] The component name is lvtwgi
[odo] I0415 15:07:43.911670 1917026 adapter.go:519] Successfully created component lvtwgi
[odo] I0415 15:07:45.695516 1917026 adapter.go:527] Successfully created Service for component lvtwgi
[odo] I0415 15:07:45.695540 1917026 deployments.go:108] Waiting for lvtwgi deployment rollout
[odo]  •  Waiting for component to start  ...
[odo] I0415 15:07:47.169809 1917026 deployments.go:141] Deployment Condition: {"type":"Available","status":"False","lastUpdateTime":"2021-04-15T09:37:43Z","lastTransitionTime":"2021-04-15T09:37:43Z","reason":"MinimumReplicasUnavailable","message":"Deployment does not have minimum availability."}
[odo] I0415 15:07:47.169832 1917026 deployments.go:141] Deployment Condition: {"type":"Progressing","status":"True","lastUpdateTime":"2021-04-15T09:37:43Z","lastTransitionTime":"2021-04-15T09:37:43Z","reason":"ReplicaSetUpdated","message":"ReplicaSet \"lvtwgi-57dbf7fd89\" is progressing."}
[odo] I0415 15:07:47.169841 1917026 deployments.go:152] Waiting for deployment "lvtwgi" rollout to finish: 0 of 1 updated replicas are available...
[odo] I0415 15:07:47.169861 1917026 deployments.go:159] Waiting for deployment spec update to be observed...
[odo]  ✗  Waiting for component to start [5m]
[odo]  ✗  Failed to start component with name lvtwgi. Error: Failed to create the component: error while waiting for deployment rollout: timeout while waiting for lvtwgi deployment roll out
Deleting project: cmd-devfile-storage-test69jfu
Running odo with args [odo project delete cmd-devfile-storage-test69jfu -f]
[odo] I0415 15:12:47.243075 1919723 util.go:727] HTTPGetRequest: https://raw.githubusercontent.com/openshift/odo/master/build/VERSION
[odo] I0415 15:12:47.243200 1919723 util.go:748] Response will be cached in /tmp/odohttpcache for 1h0m0s
[odo] I0415 15:12:47.243322 1919723 util.go:761] Cached response used.
[odo] I0415 15:12:48.733727 1919723 kclient.go:202] Checking if "projects" resource supported
[odo] I0415 15:12:49.601020 1919723 kclient.go:202] Checking if "projects" resource supported
[odo]  ✓  Deleted project : cmd-devfile-storage-test69jfu
[odo]  ⚠  Warning! Projects are deleted from the cluster asynchronously. Odo does its best to delete the project. Due to multi-tenant clusters, the project may still exist on a different node.
[odo] I0415 15:12:49.964451 1919723 odo.go:73] Could not get the latest release information in time. Never mind, exiting gracefully :)
Setting current dir to: /home/mzee1000/workbench/work/golang/redhat-gomod/odo/tests/integration/devfile
Deleting dir: /tmp/871693683


• Failure [335.939 seconds]
odo devfile storage command tests
/home/mzee1000/workbench/work/golang/redhat-gomod/odo/tests/integration/devfile/cmd_devfile_storage_test.go:13
  When devfile storage create command is executed
  /home/mzee1000/workbench/work/golang/redhat-gomod/odo/tests/integration/devfile/cmd_devfile_storage_test.go:28
    should create storage and attach to specified container successfully and list it correctly [It]
    /home/mzee1000/workbench/work/golang/redhat-gomod/odo/tests/integration/devfile/cmd_devfile_storage_test.go:69

    No future change is possible.  Bailing out early after 314.207s.
    Running odo with args [odo push --context /tmp/871693683]
    Expected
        <int>: 1
    to match exit code:
        <int>: 0

    /home/mzee1000/workbench/work/golang/redhat-gomod/odo/tests/helper/helper_run.go:34

@mohammedzee1000
Copy link
Contributor Author

I am unable to tell why push is timing out here

@prietyc123
Copy link
Contributor

[odo] I0415 15:07:47.169861 1917026 deployments.go:159] Waiting for deployment spec update to be observed...
[odo] ✗ Waiting for component to start [5m]
[odo] ✗ Failed to start component with name lvtwgi. Error: Failed to create the component: error while waiting for deployment rollout: timeout while waiting for lvtwgi deployment roll out
Deleting project: cmd-devfile-storage-test69jfu

Issue is tracked here: #3256

@prietyc123
Copy link
Contributor

PR #4625 should fix kubernetes issue.

[ssh:Fedora 32] Executing command [rm -rf amqp_ci_rcv_odo-minikube-pr-build_PR_4595] 
INFO[2021-04-15T10:21:53Z]                                              
INFO[2021-04-15T10:21:53Z] [ssh:Fedora 32] Command Error failed to initialize executor failed to initialize ssh client dial tcp -IP REDACTED-:22: connect: connection refused, failing gracefully

/test psi-kubernetes-integration-e2e

@mohammedzee1000
Copy link
Contributor Author

Ah thanks for the info i guess this pr is now up for review

Comment on lines +85 to +108
if storage.Container == "" || (storage.Container != "" && c.Name == storage.Container) {
if err := ei.devfileObj.Data.AddVolumeMounts(c.Name, vm); err != nil {
return err
}
Copy link
Contributor

@mik-dass mik-dass Apr 16, 2021

Choose a reason for hiding this comment

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

We also need to check if the given container exists or not.

[mrinaldas@localhost project]$ odo storage create --container fredajdkjsadkj
 ✓  Added storage nodejs-project-yvzb-ffnp to nodejs-project-yvzb

Please use `odo push` command to make the storage accessible to the component

In the above example, fredajdkjsadkj is an invalid container.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The check was added and will be push shortly

Comment on lines 112 to 134
} else {
ei.devfileObj.Data.UpdateComponent(vc[0])
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need to update the container as the having a volume based container with the same name will error out in validation.
https://github.com/openshift/odo/blob/cdd92ef3a5051f340df6427aadc46c17d6a99309/pkg/envinfo/storage.go#L35
We should throw an error here instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated else to return error

@@ -41,7 +41,7 @@ type LocalStorage struct {
Size string `yaml:"Size,omitempty"`
// Path of the storage to which it will be mounted on the container
Path string `yaml:"Path,omitempty"`
// Container is the container name on which the storage will be mounted
// Container is the container name on which storage is mounted
Copy link
Contributor

Choose a reason for hiding this comment

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

this storage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, will push shortly

Signed-off-by: Mohammed Zeeshan Ahmed <[email protected]>
Signed-off-by: Mohammed Zeeshan Ahmed <[email protected]>
Signed-off-by: Mohammed Zeeshan Ahmed <[email protected]>
Signed-off-by: Mohammed Zeeshan Ahmed <[email protected]>
Signed-off-by: Mohammed Zeeshan Ahmed <[email protected]>
Signed-off-by: Mohammed Zeeshan Ahmed <[email protected]>
Signed-off-by: Mohammed Zeeshan Ahmed <[email protected]>
Signed-off-by: Mohammed Zeeshan Ahmed <[email protected]>
Signed-off-by: Mohammed Zeeshan Ahmed <[email protected]>
Signed-off-by: Mohammed Zeeshan Ahmed <[email protected]>
Signed-off-by: Mohammed Zeeshan Ahmed <[email protected]>
// get all volume mount paths in current container
pt, err := ei.devfileObj.Data.GetVolumeMountPaths(storageName, c.Name)
if err != nil {
return "", err
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I missed this earlier but this will fail when the storage is mounted on the second container and not the first

odo storage list
The component 'nodejs-project-dmjd' has the following storage attached:
NAME      SIZE     PATH        CONTAINER     STATE
red       1Gi      /red        runtime-1     Not Pushed
red1      1Gi      /data       runtime-1     Not Pushed
red11     3Gi      /data-1     runtime-1     Not Pushed

odo storage delete red11 
 ✗  volume red11 not mounted to component runtime

We can continue here in case of an error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed and also added test for this case. Pushing shortly

Copy link
Contributor

@mik-dass mik-dass left a comment

Choose a reason for hiding this comment

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

/lgtm

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

openshift-ci bot commented Apr 20, 2021

@mohammedzee1000: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/psi-openshift-integration-e2e 13ae176 link /test psi-openshift-integration-e2e
ci/prow/psi-minishift-integration-e2e 13ae176 link /test psi-minishift-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.

@mik-dass
Copy link
Contributor

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Apr 20, 2021
@mohammedzee1000
Copy link
Contributor Author

Prow issue
/retest

@openshift-bot
Copy link

/retest

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

@openshift-merge-robot openshift-merge-robot merged commit 2a0cb0d into redhat-developer:master Apr 21, 2021
@mohammedzee1000 mohammedzee1000 deleted the store_specific_cont branch April 21, 2021 05:55
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. kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation 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.

storage create should have the option to specify a container
8 participants