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

feat/cyclops-ui: Add support to fetch Deployment/StatefulSet logs #660

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

Sheikh-Abubaker
Copy link
Contributor

@Sheikh-Abubaker Sheikh-Abubaker commented Oct 28, 2024

closes #257

πŸ“‘ Description

Test video of Deployment/StatefulSet logs feature:

2024-10-28.17-35-21.mp4

βœ… Checks

  • I have tested my code (provide screenshots or screen recordings of a working solution)
  • I have performed a self-review of my code

β„Ή Additional context

Reinstated the Handler functions for Deployment/StatefulSet logs i.e:

h.router.GET("/resources/deployments/:namespace/:deployment/:container/logs", modulesController.GetDeploymentLogs)
h.router.GET("/resources/statefulsets/:namespace/:name/:container/logs", modulesController.GetStatefulSetsLogs)

Tested the feature with both traditional API call using axios and the existing logstream function successfully.

@Sheikh-Abubaker Sheikh-Abubaker requested a review from a team as a code owner October 28, 2024 12:21
@Sheikh-Abubaker
Copy link
Contributor Author

Hi @petar-cvit please check this out!

@Sheikh-Abubaker Sheikh-Abubaker changed the title feat/ui: Add support to fetch Deployment/StatefulSet logs feat/cyclops-ui: Add support to fetch Deployment/StatefulSet logs Oct 28, 2024
@Sheikh-Abubaker
Copy link
Contributor Author

@quest-bot loot #257

@quest-bot quest-bot bot added the βš”οΈ Quest Tracks quest-bot quests label Oct 28, 2024
Copy link

quest-bot bot commented Oct 28, 2024

Quest PR submitted! image Quest PR submitted!

@Sheikh-Abubaker, you are attempting to solve the issue and loot this Quest. Will you be successful?


Questions? Check out the docs.

@Sheikh-Abubaker
Copy link
Contributor Author

Hey @petar-cvit, just updated the branch and it is now in sync with the main.

@Sheikh-Abubaker
Copy link
Contributor Author

Sheikh-Abubaker commented Nov 25, 2024

@petar-cvit if you'd like to test the statefulset logs feature, you could utilise Grafana tempo chart: https://github.com/grafana/helm-charts/tree/main/charts/tempo/templates, and any template from the official Cyclops template repository: https://github.com/cyclops-ui/templates could be utilised to test deployment logs.

@Sheikh-Abubaker
Copy link
Contributor Author

Sheikh-Abubaker commented Dec 16, 2024

Hey @petar-cvit tuned in the feature with the refactored code!

@Sheikh-Abubaker
Copy link
Contributor Author

Hey @petar-cvit looking forward to your review!

Copy link
Collaborator

@petar-cvit petar-cvit left a comment

Choose a reason for hiding this comment

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

@Sheikh-Abubaker sorry for the delay. I left two comments

@@ -107,4 +120,259 @@ const StatefulSet = ({ name, namespace, workload }: Props) => {
);
};

export default StatefulSet;
export const StatefulSetLogsButton = ({ name, namespace, workload }: Props) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see that this component is similar to the DeploymentLogsButton component. Can we have a single component for the Pod logs button and for the Statefulset/Deployment logs button? You can pass apiVersion and kind to the component if needed.

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 reason I created a separate component so that I could export the the button and place it in the column with View Manifest and Restart button, as I saw in some previous PRs which was closed you wanted the logs button in the same column as View Manifest and Restart button

Copy link
Collaborator

@petar-cvit petar-cvit Jan 22, 2025

Choose a reason for hiding this comment

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

I'm ok for creating a separate component, but we could make just one that can be reused for each resource type

Comment on lines +100 to +101
h.router.GET("/resources/deployments/:namespace/:deployment/:container/logs", modulesController.GetDeploymentLogs)
h.router.GET("/resources/statefulsets/:namespace/:name/:container/logs", modulesController.GetStatefulSetsLogs)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Im not sure these two methods work. In the case of multiple pods for a deployment, it will just append logs from one pod to another regardless of the time those were produced at. The logs should be sorted by when they have been produced. Could you also check that out?

Also, we could just have a single endpoint that would be provided with a group, version, kind, name and namespace and it could just return all the logs for the requested resource. That way we don't have to duplicate endpoints for Deployments, Statefulsets, Pods...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
βš”οΈ Quest Tracks quest-bot quests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a button for Deployment/Statefulset logs
2 participants