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

Services should be stoppable and restartable on Docker and K8S #673

Closed
laurentluce opened this issue Jun 2, 2023 · 0 comments · Fixed by #756
Closed

Services should be stoppable and restartable on Docker and K8S #673

laurentluce opened this issue Jun 2, 2023 · 0 comments · Fixed by #756
Assignees
Labels

Comments

@laurentluce
Copy link
Contributor

Background & motivation

There is no way today to just stop a service without completely removing it including its network configuration. The service then needs to be re-added to start it again. More details here.

Desired behaviour

I should be able to stop and start a service using stop and start primitives in Starlark and in the API.

How important is this to you?

Painful; the lack of this feature makes using Kurtosis frictionful.

@laurentluce laurentluce self-assigned this Jun 2, 2023
@github-actions github-actions bot added the painful Painful bug label Jun 2, 2023
laurentluce added a commit that referenced this issue Jun 9, 2023
## Description:
Add `plan.start_service` and `plan.stop_service` Starlark instructions
for the Docker backend. Support for the K8S backend first requires an
update to the Gateway to manage the port forwarder connection during
stop and start operations. The k8s backend code itself is ready and the
changes (small) are in this PR.

No new backend methods are introduced, the goal being to re-use the
current code as much as possible. All the changes under `api/` and
`cli/` are related to the renaming of the API method `StartServices` to
`AddServices`. Most of the code added is unit and integration tests. The
map of service registrations at the service network layer is used as
part of the existing start service process so I am using this map to
store the service status and config required for the restart process. I
thought about using a map of created `Services` but it is not as clean
as leveraging the map of service registrations.

Added some PR comments to help with the review.

Follow-up work in subsequent PRs:

- Update gateway to manage the port forwarder connection during stop and
start operations and enable support for k8s.
- Update documentation.

## Is this change user facing?
YES

## References (if applicable):
#673
laurentluce added a commit that referenced this issue Jun 23, 2023
## Description:
Most of the work for the K8S backend was done as part of #694. In
addition, the port forwarder reconnect feature reduced the amount of
work we had to finish. Here are the changes made in this PR:
- We keep the K8S service untouched when we stop the user service so it
can be restarted easily by creating a new pod. This change does not
impact the remove service expected behavior.
- We don't try to create a port forwarder connection if the service is
stopped.

A service stopped here is a k8s service with no pod running. I think it
is time to return the service status (registered, started, stopped) as
part of the GetServices response so we can simplify the second item
above. I will do that in a follow-up PR.

## Is this change user facing?
YES

## References (if applicable):
Closes #673 
#694 
#736
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant