GoogleCloudPlatform / k8s-config-connector

GCP Config Connector, a Kubernetes add-on for managing GCP resources
https://cloud.google.com/config-connector/docs/overview
Apache License 2.0
896 stars 230 forks source link

Cleaning up objects no longer declared? #192

Open max-sixty opened 4 years ago

max-sixty commented 4 years ago

I have a set of manifests in a path, and I'm running kubectl apply -f config-connector/ when I make changes to them.

When I rename one of the objects, or remove one, am I right in thinking the old objects are not deleted? And that I have to actively run kubectl delete ...? Is there a way of clearing up objects no longer declared, or otherwise syncing the GCP objects to a set of manifests?

Thanks!

caieo commented 4 years ago

Hi @max-sixty, you're correct in thinking that renaming one of the objects just creates a new object and the old one is not deleted. You will have to actively run kubectl delete ... to delete the old object.

Config Connector does not have any clean-up functionality that checks for objects no longer declared, but it sounds like you might be interested in Config Sync. With Config Sync, you can continue to manage your manifests in that one folder (but in a Git repository) and it will make sure it's in sync with the resources in that folder.

max-sixty commented 4 years ago

Thanks @caieo .

Config Sync looks heavier duty and I think requires Anthos; I'll keep an eye on how it evolves. FWIW the new config-connector -project tool + diffs could probably fill most of this need.