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

Dump Pod Status in logs instead of complete PodSpec #1506

Merged
merged 6 commits into from
Jun 28, 2022
Merged

Conversation

akankshakumari393
Copy link
Contributor

@akankshakumari393 akankshakumari393 commented Jun 23, 2022

Change Overview

As of now we used to dump all Pod Spec in logs in case of error or pod failure. This PR is to dump only the Pod Status and not all Spec.

Pull request type

Please check the type of change your PR introduces:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test

Issues

Test Plan

  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

Controller logs that shows only PodStatus for a Failed Mysql blueprint actionSet https://gist.github.com/akankshakumari393/3402379b3e6440f5ecd934af5204b649

@github-actions
Copy link
Contributor

Thanks for submitting this pull request 🎉. The team will review it soon and get back to you.

If you haven't already, please take a moment to review our project contributing guideline and Code of Conduct document.

@infraq infraq added this to In Progress in Kanister Jun 23, 2022
@akankshakumari393 akankshakumari393 changed the title Dump Pod Status in logs instead of all Spec Dump Pod Status in logs instead of complete PodSpec Jun 23, 2022
pkg/kube/pod.go Outdated
@@ -299,7 +299,7 @@ func WaitForPodCompletion(ctx context.Context, cli kubernetes.Interface, namespa
}
switch p.Status.Phase {
case v1.PodFailed:
return false, errors.Errorf("Pod %s failed. Pod details (%s)", name, log.SafeDumpPodObject(p))
return false, errors.Errorf("Pod %s failed. Pod Status details (%s)", name, log.SafeDumpPodStatusObject(p))
Copy link
Contributor

Choose a reason for hiding this comment

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

We can just use p.Status.String() directly. Changes to helper and the tests will not be necessary

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed - then we can also remove log.SafeDumpPodObject().

Copy link
Contributor

@ihcsim ihcsim left a comment

Choose a reason for hiding this comment

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

Kanister automation moved this from In Progress to Reviewer approved Jun 27, 2022
pkg/kube/pod.go Outdated Show resolved Hide resolved
Co-authored-by: Pavan Navarathna <6504783+pavannd1@users.noreply.github.com>
@mergify mergify bot merged commit 3e48f2d into master Jun 28, 2022
Kanister automation moved this from Reviewer approved to Done Jun 28, 2022
@mergify mergify bot deleted the kanister_1464 branch June 28, 2022 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants