Add timestamp-links arg #133

Merged
hjacobs merged 1 commits from fishy/kube-web-view:timestamp-link into main 7 months ago
fishy commented 7 months ago

Also find and replace ISO-8601 timestamps in highlight filter according
to timestamp-links arg.

This could be used to link timestamps directly to the centralized log
viewer at the specific timestamp (for example, finishedAt timestamp).

Also find and replace ISO-8601 timestamps in highlight filter according to timestamp-links arg. This could be used to link timestamps directly to the centralized log viewer at the specific timestamp (for example, finishedAt timestamp).
Owner

That looks interesting, have to check it out..

Can you post a screenshot here with examples of where you use it (without confidential details)?

That looks interesting, have to check it out.. Can you post a screenshot here with examples of where you use it (without confidential details)?
Poster

The main use case of this is to link to the log viewer. Say you noticed that one of your pods had restarts, you can go into the pod view, search for "finishedAt" at the page to find the timestamp of last restart, and click the timestamp to go directly to the log at that timestamp to see what exactly happened to cause the restart.
image

The main use case of this is to link to the log viewer. Say you noticed that one of your pods had restarts, you can go into the pod view, search for "finishedAt" at the page to find the timestamp of last restart, and click the timestamp to go directly to the log at that timestamp to see what exactly happened to cause the restart. ![image](/attachments/fba1d199-8c4c-4f28-8657-90476f129c2d)
hjacobs reviewed 7 months ago
kube_web/web.py Outdated
if namespace:
query = query.filter(namespace=namespace)
resource = await kubernetes.get_by_name(query, name)
resource._config = config
Poster
Owner

I think the config has nothing to do with the resource, so it should not pollute the resource object. You can pass the config to the template by setting it in the context below.

I think the config has nothing to do with the resource, so it should not pollute the resource object. You can pass the config to the template by setting it in the `context` below.
fishy commented 7 months ago
Poster

I don't see how context is attached to resource object, nor do I see any example of the jinja filters using it. Do you have any example on how to do that?

I don't see how context is attached to resource object, nor do I see any example of the jinja filters using it. Do you have any example on how to do that?
Poster
Owner

The resource object is the Kubernetes resource, you only want the config to be used in your template filter. You can pass config to the template via the context dict and then use it.

The `resource` object is the Kubernetes resource, you only want the `config` to be used in your template filter. You can pass `config` to the template via the `context` dict and then use it.
fishy commented 7 months ago
Poster

Oh I see what you mean now. Done.

Oh I see what you mean now. Done.
fishy force-pushed timestamp-link from b062b14363 to 69695b1810 7 months ago
hjacobs merged commit 211f146c8e into main 7 months ago
fishy deleted branch timestamp-link 7 months ago
The pull request has been merged as 211f146c8e.
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.