-
Notifications
You must be signed in to change notification settings - Fork 752
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
support kompose down subcommand #113
Conversation
Fixes #41 |
Do we really need |
} | ||
logrus.Infof("Successfully deleted service: %s", name) | ||
|
||
err = client.Deployments(api.NamespaceDefault).Delete(name, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not enough to just delete Deployments, because it will leave running pods behind.
First you need to scale Deployments to 0, and than it is safe to delete Deployment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it seems that we need also somehow clean ReplicaSets :-(
Now I remember. kubectl
uses Reaper to clean all related objects.
You can see it here: https://github.com/kubernetes/kubernetes/blob/v1.3.5/pkg/kubectl/stop.go#L362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, in the future k8s will support server-side cascading deletion. For now we can use reapers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right.
btw: look at func ReaperFor(....
this might useful.
Let me know if I can help you with that more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a follow-up commit below. Can you check it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we should delete all jobs or not. Marked it //TODO
Stuck at #117 where I can't use "k8s.io/kubernetes/pkg/kubectl/cmd" for printing resources in format of |
|
@ngtuna If it is just for printing, can we use something else for now? |
@kadel yes I'm also thinking about it |
60db735
to
fe9859e
Compare
fe9859e
to
f276906
Compare
Add new subcommand
kompose down
, in contrast withkompose up
. There are two options:It will delete corresponding services and deployments of converted application.
It will delete all resources (deployments, services, replication controllers, daemonsets) in the cluster. (only at default namespace, other namespaces are coming in follow-up PR).
Can you take a look @janetkuo ? I'm not sure if I missed something in calling kubernetes apis. For example, I set DeleteOptions = nil when deleting deployment. or ListOptions is empty. They are temporarily set until we find suitable customized options.