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

odo dev: react to changes as soon as possible #5933

Conversation

feloy
Copy link
Contributor

@feloy feloy commented Jul 8, 2022

What type of PR is this:

/kind feature

What does this PR do / why we need it:

Which issue(s) this PR fixes:

Fixes partially #5867

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

How to test changes / Special notes to the reviewer:

Acceptance Criteria

  • It should handle Devfile changes when a Pod is in an Error state
  • It should not wait for a specific state in the reconcile loop
  • It should watch for all interesting resources (Deployment, ServiceBindings, ...) permanently, i.e. as long as odo dev is running
  • It should notify users of the current application state
  • If odo dev is running with the no-watch flag, it should not watch for files but still continue to watch cluster resources

@netlify
Copy link

netlify bot commented Jul 8, 2022

Deploy Preview for odo-docusaurus-preview canceled.

Name Link
🔨 Latest commit 053cdd1
🔍 Latest deploy log https://app.netlify.com/sites/odo-docusaurus-preview/deploys/62f0b277a7c4e200080a8fd1

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation labels Jul 8, 2022
@openshift-ci openshift-ci bot requested review from anandrkskd and dharmit July 8, 2022 09:51
@odo-robot
Copy link

odo-robot bot commented Jul 8, 2022

Validate Tests on commit a0efdb1 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Jul 8, 2022

Unit Tests on commit a0efdb1 finished successfully.
View logs: TXT HTML

@feloy feloy force-pushed the feature-5867/dev-watch-deployment-v2 branch from dd5940d to 30c723f Compare July 8, 2022 09:59
@odo-robot
Copy link

odo-robot bot commented Jul 8, 2022

Windows Tests (OCP) on commit a0efdb1 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Jul 8, 2022

Kubernetes Tests on commit a0efdb1 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Jul 8, 2022

OpenShift Tests on commit a0efdb1 finished successfully.
View logs: TXT HTML

@feloy feloy force-pushed the feature-5867/dev-watch-deployment-v2 branch 5 times, most recently from 4cfb015 to 1bc1cc7 Compare July 8, 2022 18:09
@feloy feloy force-pushed the feature-5867/dev-watch-deployment-v2 branch 6 times, most recently from 1a4111c to 4639f47 Compare July 12, 2022 08:56
@feloy feloy changed the title [wip] odo dev: react to changes as soon as possible odo dev: react to changes as soon as possible Jul 12, 2022
@openshift-ci openshift-ci bot 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 Jul 12, 2022
@feloy feloy force-pushed the feature-5867/dev-watch-deployment-v2 branch from 4639f47 to 577fa4f Compare July 13, 2022 05:42
Copy link
Member

@dharmit dharmit left a comment

Choose a reason for hiding this comment

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

Was surely challending to review commit-by-commit. Not sure if I would want to do it regularly. 😕

for k := range volumeNameToVolInfo {
keys = append(keys, k)
}
sort.Strings(keys)
Copy link
Member

Choose a reason for hiding this comment

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

Should we put this in a function since we are doing it twice in the same file?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would even go as far and suggest we combine the two functions GetEphemeralVolumesAndVolumeMounts, and GetPersistentVolumesAndVolumeMounts into one, since the only thing that sets them apart is their use of getEmptyDir, and getPVC respectively.

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 parameters volumeNameToVolInfo/ephemerals do not have the same type, it makes it difficult to replace with a unique function

@feloy feloy force-pushed the feature-5867/dev-watch-deployment-v2 branch 2 times, most recently from 5102b4e to 73988b7 Compare July 13, 2022 16:13
@feloy feloy force-pushed the feature-5867/dev-watch-deployment-v2 branch from de7defb to 2d2d7e9 Compare August 8, 2022 06:19
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Aug 8, 2022
@feloy
Copy link
Contributor Author

feloy commented Aug 8, 2022

It should handle Devfile changes when a Pod is in an Error state

How do you suggest I test this scenario? I modified the container component to use an invalid container image, which caused the Pod to go into ErrImagePull state, and then corrected it. It worked fine.

Anything else?

You can set a high memory request (1Ti for example), so the scheduler won't be able to find it a node

It should not wait for a specific state in the reconcile loop

How do I test this functionality? What am I supposed to look for?

This is pore an implementation detail, it is not visible at the user level, but you can check in the sources we are not waiting anymore for anything.

It should watch for all interesting resources (Deployment, ServiceBindings, ...) permanently, i.e. as long as odo dev is running

How do I test this? Should I do kubectl edit deployment and see? Same for ServiceBindings? What else does "interesting resources" encompass?

It should notify users of the current application state

As a user, what should I expect here?

You should not ask yourself what is teh state of the app at any moment, and you should not have to use kubectl or other tool to beb able to understand what's the state of the component

@feloy feloy requested review from dharmit and valaparthvi August 8, 2022 06:43
@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 8, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 11 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@dharmit
Copy link
Member

dharmit commented Aug 8, 2022

This is pore an implementation detail, it is not visible at the user level, but you can check in the sources we are not waiting anymore for anything.
You should not ask yourself what is teh state of the app at any moment, and you should not have to use kubectl or other tool to beb able to understand what's the state of the component

The thing is that these items are in the acceptance criteria. If, as a reviewer, I can't test it, how can I approve it?

@feloy
Copy link
Contributor Author

feloy commented Aug 8, 2022

This is pore an implementation detail, it is not visible at the user level, but you can check in the sources we are not waiting anymore for anything.
You should not ask yourself what is teh state of the app at any moment, and you should not have to use kubectl or other tool to beb able to understand what's the state of the component

The thing is that these items are in the acceptance criteria. If, as a reviewer, I can't test it, how can I approve it?

I'm not sure acceptance criteria are for user level only.

For the first point, you can check in the sources how it is implemented, and check that odo is not waiting anymore, like it was waiting before for a Pod to be started.

For the second point, this is quite subjective, but you can make lots of manipulations, and check that you understand at any moment what is the state of the component. If, at any moment, you don't know if the component is running or not, the acceptance creteria is not respected

@valaparthvi
Copy link
Contributor

/lgtm

@dharmit agrees.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Aug 8, 2022
@valaparthvi
Copy link
Contributor

/override ci/prow/v4.10-integration-e2e

@openshift-ci
Copy link

openshift-ci bot commented Aug 8, 2022

@valaparthvi: Overrode contexts on behalf of valaparthvi: ci/prow/v4.10-integration-e2e

In response to this:

/override ci/prow/v4.10-integration-e2e

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.

@feloy
Copy link
Contributor Author

feloy commented Aug 8, 2022

/override ci/prow/v4.10-integration-e2e

Tests pass on IBM Cloud

unable to download starter project "nodejs-starter": unexpected client error: unexpected requesting "https://github.com/odo-devfiles/nodejs-ex.git/info/refs?service=git-upload-pack" status code: 429

@openshift-ci
Copy link

openshift-ci bot commented Aug 8, 2022

@feloy: Overrode contexts on behalf of feloy: ci/prow/v4.10-integration-e2e

In response to this:

/override ci/prow/v4.10-integration-e2e

Tests pass on IBM Cloud

unable to download starter project "nodejs-starter": unexpected client error: unexpected requesting "https://github.com/odo-devfiles/nodejs-ex.git/info/refs?service=git-upload-pack" status code: 429

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.

@openshift-merge-robot openshift-merge-robot merged commit f22c3f8 into redhat-developer:main Aug 8, 2022
@rm3l rm3l linked an issue Aug 8, 2022 that may be closed by this pull request
6 tasks
@dharmit dharmit mentioned this pull request Aug 9, 2022
3 tasks
cdrage pushed a commit to cdrage/odo that referenced this pull request Aug 31, 2022
* Create auxialiary functions to find current deployment and pod name

* Create auxialiary function for pushing Kubernetes components to cluster

* Auxiliary function getPushDevfileCommands and remocve RunModeChanged flag as it is not possible anymore with long running dev command
+ move prelimiray tests at the beginning

* Create auxiliary function updatePVCsOwnerReferences + move isMainStorageEphemeral inside aux. function

* Watch for deployments in addition to watching for files during odo dev

* - Check the Deployment Generation to return earlier when generation changed
- Return earlier when pod is not ready

* Push receives a Status that it can update, to indicate the status of the component when the function returns. This status is passed from Start to Watch

* Use status to decide to sync files

* Simplify getting pod

* Status for PostStartEvents

* - Touch .gitignore earlier so it is not synced
- Add devstate.jso file to .gitignore

* Fix the integration tests.

* Make --no-watch work again

* Get smaller volumes for tests

* Quit when fail to exec port forwarding

* Exponential delay after an error

* Fix: get running pod

* Remove testing odo dev stops when the build command fails. odo dev now gives a change to the user to fix the problem

* Fix order or volumes and volume mounts in pod spec

* Use server side apply for updating PVC when supported

* Watch Devfile separately

* Adapt tests for devfile handled separately

* Update forwarded ports when necessary

* Display kubernetes resources created only when created/updated

* Do not set ResourceVersion when patching

* TEMP: Add more logs on failing integrattests

* Tests: select the *running* pod

* Use forward slashes for .gitignore content, even on Windows

* Rename GetOnePodFromSelector to GetRunningPodFromSelector

* Cleanup logs

* Fix 'odo log' integration test

* Add log "Waiting for Kubernetes resources"

* Fail if service bindings are not injected

* Rename sources related watcher, timer

* Fix delay after error

* Display info about Pod

* Disambiguate error messages

* Display events related to components pod

* Remove now unused functions used to wait for Deployment / Pod

* Typos + function renaming

* Do not watch devfile with --no-watch

* Use type switch for Kubernertes watch event

* Do not fail when watching Events is Forbidden

* Do not fail when servicebinding resources are forbidden

* Exit when build command fails on no-watch mode

* Sync devfile.yaml by default, workaround when commands change on devfile

* Rename to warningsWatcher

* Fix comment
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.

odo dev: react to changes as soon as possible
5 participants