Skip to content

Add a support to delete kubernetes API objects from yaml #1373

Closed
@marukaz

Description

@marukaz

What is the feature and why do you need it:

There is already a util to create kubernetes API objects from yaml and it's very useful.
However, when I create an object from a yaml file, I sometimes want to delete the object created using that file, but there is no util for that.
I think it would be useful to have a util for delete that is paired with create_from_yaml.py, in other words, something like kubectl delete -f.

Describe the solution you'd like to see:

from kubernetes import utils, client

yaml_path = "path/to/yaml"
k8s_client = client.ApiClient()

utils.create_from_yaml(k8s_client, yaml_path)
utils.delete_with_yaml(k8s_client, yaml_path)

Metadata

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions