Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Implement cleanup command #385

Merged
merged 6 commits into from
Apr 21, 2020
Merged

Implement cleanup command #385

merged 6 commits into from
Apr 21, 2020

Conversation

rynowak
Copy link
Member

@rynowak rynowak commented Apr 20, 2020

This is new command that can be used to delete everything running in a
cluster related to an application using the labels we use.

This currently uses a hardcoded set of resource types. It would be
possible to make this generic, which might become needed in the future.
See comments in the code.


The overall design for how to use the command:

tye cleanup

Will read a solution or tye.yaml to get the application name. It then
enumerates and deletes all resources in the cluser with
app.kubernetes.io/part-of=application-name (in the current namespace).

tye cleanup --what-if

Will do the same, but without actually doing the deletion.

tye cleanup -i

Will interactively give you a yes/no choice for whether to delete each
resource.


`PATH`

The path to either a file or directory to execute `tye cleanup` on. Can either be a yaml, sln, or project file, however it is recommend to have a tye.yaml file for `tye cleanup`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider allowing service name, so someone can delete everything associated with a service

tye delete frontend

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't want to do service name because I think that raises a lot of questions - and we don't have per-service deployment yet.

For instance, does it update the config of every other service to remove its env-vars? (Probably not).

Per-application cleanup is easier to reason about because things like secrets/bindings are shared. Basically we could support per-service cleanup, but then what happens? does the usage of it by other services just dangle?

Copy link
Contributor

Choose a reason for hiding this comment

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

That seems well justified.


## Examples

- Deploy an application from the current directory:
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix these examples.

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you mean fix? You mean update them when we decide on a command name?

src/tye/CleanupHost.cs Outdated Show resolved Hide resolved
src/tye/CleanupHost.cs Outdated Show resolved Hide resolved
rynowak and others added 6 commits April 20, 2020 15:30
This is new command that can be used to delete everything running in a
cluster related to an application using the labels we use.

This currently uses a hardcoded set of resource types. It would be
possible to make this generic, which might become needed in the future.
See comments in the code.

---

The overall design for how to use the command:

```sh
tye cleanup
```

Will read a solution or tye.yaml to get the application name. It then
enumerates and deletes all resources in the cluser with
`app.kubernetes.io/part-of=application-name` (in the current namespace).

```sh
tye cleanup --what-if
```

Will do the same, but without actually doing the deletion.

```sh
tye cleanup -i
```

Will interactively give you a yes/no choice for whether to delete each
resource.
Co-Authored-By: Justin Kotalik <jukotali@microsoft.com>
Co-Authored-By: Justin Kotalik <jukotali@microsoft.com>
@rynowak rynowak merged commit 1178d1d into master Apr 21, 2020
@rynowak rynowak deleted the rynowak/cleanup branch April 21, 2020 17:22
kishanAnem pushed a commit to kishanAnem/tye that referenced this pull request May 15, 2020
This is new command that can be used to delete everything running in a
cluster related to an application using the labels we use.

This currently uses a hardcoded set of resource types. It would be
possible to make this generic, which might become needed in the future.
See comments in the code.

---

The overall design for how to use the command:

```sh
tye undeploy
```

Will read a solution or tye.yaml to get the application name. It then
enumerates and deletes all resources in the cluster with
`app.kubernetes.io/part-of=application-name` (in the current namespace).

```sh
tye undeploy --what-if
```

Will do the same, but without actually doing the deletion.

```sh
tye undeploy -i
```

Will interactively give you a yes/no choice for whether to delete each
resource.
kishanAnem pushed a commit to kishanAnem/tye that referenced this pull request May 15, 2020
This is new command that can be used to delete everything running in a
cluster related to an application using the labels we use.

This currently uses a hardcoded set of resource types. It would be
possible to make this generic, which might become needed in the future.
See comments in the code.

---

The overall design for how to use the command:

```sh
tye undeploy
```

Will read a solution or tye.yaml to get the application name. It then
enumerates and deletes all resources in the cluster with
`app.kubernetes.io/part-of=application-name` (in the current namespace).

```sh
tye undeploy --what-if
```

Will do the same, but without actually doing the deletion.

```sh
tye undeploy -i
```

Will interactively give you a yes/no choice for whether to delete each
resource.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants