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

add event api integration for deploy health check #3072

Merged

Conversation

tejal29
Copy link
Contributor

@tejal29 tejal29 commented Oct 16, 2019

Relates to #176

Fixes #3020
/cc @sujit-kamireddy
Description

In this PR, we add events for deployment status check phase which will help IDEs to get signal if a deployment is stabilized before they can start debugging an application.

User facing changes

Event Changes

Before

  1. On example run skaffold dev --port-forward --status-check
    No deployment status check related events are seen.
tejaldesai@@nodejs-guestbook (master)$ curl localhost:50052/v1/event_log

{"result":{"timestamp":"2019-10-16T21:58:38.402979793Z","event":{"buildEvent":{"artifact":"gcr.io/tejal-test/node-guestbook-frontend","status":"Complete"}},"entry":"Build completed for artifact gcr.io/tejal-test/node-guestbook-frontend"}}
{"result":{"timestamp":"2019-10-16T21:58:38.796363557Z","event":{"deployEvent":{"status":"In Progress"}},"entry":"Deploy started"}}
{"result":{"timestamp":"2019-10-16T21:58:40.002287949Z","event":{"deployEvent":{"status":"Complete"}},"entry":"Deploy complete"}}
{"result":{"timestamp":"2019-10-16T21:58:40.203815130Z","event":{"portEvent":{"localPort":8080,"remotePort":8080,"namespace":"default","resourceType":"service","resourceName":"node-guestbook-backend"}},"entry":"Forwarding container  to local port 8080"}}

After
Deployment status check events are seen.

{"result":{"timestamp":"2019-10-16T22:04:27.036932835Z","event":{"buildEvent":{"artifact":"gcr.io/tejal-test/node-guestbook-frontend","status":"Complete"}},"entry":"Build completed for artifact gcr.io/tejal-test/node-guestbook-frontend"}}
{"result":{"timestamp":"2019-10-16T22:04:27.041619570Z","event":{"deployEvent":{"status":"In Progress"}},"entry":"Deploy started"}}
{"result":{"timestamp":"2019-10-16T22:04:28.839756885Z","event":{"deployEvent":{"status":"Complete"}},"entry":"Deploy complete"}}

{"result":{"timestamp":"2019-10-16T22:04:28.841071895Z","event":{"statusCheckEvent":{"status":"Started"}},"entry":"Status check started"}}

{"result":{"timestamp":"2019-10-16T22:04:29.554067745Z","event":{"resourceStatusCheckEvent":
{"resource":"default:deployment/node-guestbook-backend","status":"In Progress",
"message":"default:deployment/node-guestbook-backend Waiting for rollout to finish: 0 of 1 updated replicas are available...\n"}},
"entry":"Resource default:deployment/node-guestbook-backend status updated to In Progress"}}

{"result":{"timestamp":"2019-10-16T22:04:29.554119649Z","event":{"resourceStatusCheckEvent":
{"resource":"default:deployment/node-guestbook-frontend","status":"In Progress",
"message":"default:deployment/node-guestbook-frontend Waiting for rollout to finish: 0 of 1 updated replicas are available...\n"}},
"entry":"Resource default:deployment/node-guestbook-frontend status updated to In Progress"}}

{"result":{"timestamp":"2019-10-16T22:04:29.554152477Z","event":{"resourceStatusCheckEvent":
{"resource":"default:deployment/node-guestbook-mongodb","status":"In Progress",
"message":"default:deployment/node-guestbook-mongodb Waiting for rollout to finish: 0 of 1 updated replicas are available...\n"}},
"entry":"Resource default:deployment/node-guestbook-mongodb status updated to In Progress"}}

{"result":{"timestamp":"2019-10-16T22:04:30.652952944Z","event":{"resourceStatusCheckEvent":
{"resource":"default:deployment/node-guestbook-backend","status":"Succeeded",
"message":"Succeeded"}},
"entry":"Resource default:deployment/node-guestbook-backend status completed successfully"}}

{"result":{"timestamp":"2019-10-16T22:04:30.654777428Z","event":{"resourceStatusCheckEvent":
{"resource":"default:deployment/node-guestbook-frontend","status":"Succeeded",
"message":"Succeeded"}},
"entry":"Resource default:deployment/node-guestbook-frontend status completed successfully"}}

{"result":{"timestamp":"2019-10-16T22:04:31.860354818Z","event":{"resourceStatusCheckEvent":
{"resource":"default:deployment/node-guestbook-mongodb","status":"Succeeded",
"message":"Succeeded"}},
"entry":"Resource default:deployment/node-guestbook-mongodb status completed successfully"}}

{"result":{"timestamp":"2019-10-16T22:04:31.860376342Z","event":{"statusCheckEvent":
{"status":"Succeeded"}},"entry":"Status check succeeded"}}

{"result":{"timestamp":"2019-10-16T22:04:31.934776579Z",
"event":{"portEvent{"localPort":8080,"remotePort":8080,"namespace":"default",
"resourceType":"service","resourceName":"node-guestbook-backend"}},
"entry":"Forwarding container  to local port 8080"}}


Next PRs.

None

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes unit tests
  • Mentions any output changes.
  • Adds documentation as needed: user docs, YAML reference, CLI reference.
  • Adds integration tests if needed.

See the contribution guide for more details.

Reviewer Notes

  • The code flow looks good.
  • Unit test added.
  • User facing changes look good.

Release Notes

Describe any user facing changes here so maintainer can include it in the release notes, or delete this block.

Add skaffold deploy health check events for deployments, when 
- A deployment has a new status 
- A deployment failed
- A deployed is rolled out successfully.

@codecov
Copy link

codecov bot commented Oct 16, 2019

Codecov Report

Merging #3072 into master will increase coverage by 0.01%.
The diff coverage is 87.5%.

Impacted Files Coverage Δ
pkg/skaffold/deploy/status_check.go 55.75% <87.5%> (+1.97%) ⬆️

Copy link
Contributor

@nkubala nkubala left a comment

Choose a reason for hiding this comment

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

code looks good. should this be documented somewhere in the code or is it just going to live in the API docs once those get merged?

@tejal29 tejal29 merged commit ec51375 into GoogleContainerTools:master Oct 18, 2019
@tejal29
Copy link
Contributor Author

tejal29 commented Oct 18, 2019

code looks good. should this be documented somewhere in the code or is it just going to live in the API docs once those get merged?

I think once status-check is turned on by default, i will document the feature and events.

@tejal29 tejal29 deleted the add_deploy_healthcheck_events branch April 15, 2021 07:33
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.

Spurious port-forwarding failures causing debug failure
4 participants