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

Implement a restart endpoint #342

Closed
petar-cvit opened this issue Jun 17, 2024 · 6 comments · Fixed by #406
Closed

Implement a restart endpoint #342

petar-cvit opened this issue Jun 17, 2024 · 6 comments · Fixed by #406
Assignees
Labels
controller Update on controller go Pull requests that update Go code good first issue Good for newcomers kubernetes k8s related issues

Comments

@petar-cvit
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
To allow users to restart their workloads, cyclops-ctrl should expose a restart endpoint. You can register the endpoint and its handler function here.

The endpoint should receive the group, version, kind, name and the namespace of the resource that needs to be restarted. You can fetch those similarly to how it was done here. You can also check this link on how to restart a resource using go-client here.

Scope of the issue is implementing only the backend endpoint. Frontend part will be implemented separately.

@petar-cvit petar-cvit added good first issue Good for newcomers go Pull requests that update Go code controller Update on controller kubernetes k8s related issues labels Jun 17, 2024
@patelajay745
Copy link
Contributor

I would like to give try on it.

@patelajay745
Copy link
Contributor

What should an endpoint look like? I understand the underlying process, but what should the endpoint's response be?

@petar-cvit
Copy link
Collaborator Author

Hey @patelajay745, response of the endpoint can simply be 200 OK without the body if there was no error, or 500 Internal server error with the error in the response body. You can map the error in the response using dto.NewError (example here)

@patelajay745
Copy link
Contributor

Ok. Got it about response. How should endpoint look like?

@petar-cvit
Copy link
Collaborator Author

I was thinking about /resources/restart path that accepts POST method, and in the request body, you can send an object:

{
  "group": "...",
  "version": "...",
  "kind": "...",
  "name": "...",
  "namespace": "..."
}

@patelajay745
Copy link
Contributor

Got it . Thanks

petar-cvit pushed a commit that referenced this issue Jul 12, 2024
* added restart endpoints

* added statefulset and daemonset

* solved issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
controller Update on controller go Pull requests that update Go code good first issue Good for newcomers kubernetes k8s related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants