-
Notifications
You must be signed in to change notification settings - Fork 882
rkt list|status: app state info (i.e. exit codes) in --format=json #3638
Conversation
Can one of the admins verify this patch? |
ok to test |
This looks fine in general, however I'm wondering if we should tackle #3551 first so that this JSON is properly typed+versioned and we can then touch it with a bit more freedom in future. |
@fabiokung also related, in case you want to tackle them at once: #3550. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A nit and a question, thanks a lot for the contribution!
Generally I agree with @lucab that we need to address versioning sooner than later.
lib/pod.go
Outdated
@@ -63,3 +75,63 @@ func NewPodFromInternalPod(p *pkgPod.Pod) (*Pod, error) { | |||
|
|||
return pod, nil | |||
} | |||
|
|||
// appStateInImmutablePod infers most App state from the Pod itself, since all apps are created and destroyed with the Pod | |||
func appStateInImmutablePod(app *App, pod *pkgPod.Pod) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we put appStateInImmutablePod
in lib/app.go
next to appStateInMutablePod
since they are related and of the same type.
lib/pod.go
Outdated
finishedAt := finish.UnixNano() | ||
app.FinishedAt = &finishedAt | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the above state check seems a bit unnecessary (and the fallthrough
indicates this fact) since we are collecting startedAt/finishedAt timepoints only, hence I suggest to skip it at all (if that is possible).
Make `rkt list|status --format=json` compatible with the default k=v format and include state info (exit codes in particular). Also deprecate App.AppNames in the json output, but keep it there for backwards compatibility. Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
59e6cb6
to
c81074d
Compare
@s-urbaniak I made (and amended) the suggested changes, thanks! @lucab I moved existing json models to a versioned package, mirroring what is being done for the gRPC API. Is that the right design? Is |
c81074d
to
78198cb
Compare
Mark the current JSON output format for rkt status|list as v1, so we can track changes and compatibility moving forward. Fixes rkt#3551 Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
78198cb
to
e6561a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this LGTM, but leaving the last two eyes to @lucab, thanks!
@fabiokung I'm fine with your answers and cleanup, I'm just worried that people should not rely on this JSON output until we stick some versioning on top of it. To be explicit, I'd like to see:
before touching JSON output and pointing people to it. If your usecase to expose those info is to parse them externally, I fear we are already at that point. |
I don't think we need to couple getting versioning right with including this change. There's no semantic changes to the current fields, and adding new fields to a json document can generally be considered backwards compatible. This change LGTM. |
This PR has already enough LGTM and I have been persuaded by the above thread that my stance of coupling this with output-versioning is not the best course of action, so I'm merging this while keeping #3551 open. @fabiokung sorry for the back and forth and thanks for your contribution! |
Make
rkt list|status --format=json
compatible with the defaultk=v
format and include state info (exit codes in particular).Also deprecate
App.AppNames
in the json output, but keep it there for backwards compatibility.Before the change:
After the change:
Signed-off-by: Fabio Kung fabio.kung@gmail.com