googlearchive / k8s-service-catalog

[DEPRECATED] Commandline tool to manage Service Catalog lifecycle and GCP Service Broker atop Kubernetes Cluster
Apache License 2.0
69 stars 31 forks source link

make 'install' and 'add-gcp-broker' idempotent #147

Closed kibbles-n-bytes closed 6 years ago

kibbles-n-bytes commented 6 years ago

kubectl apply -f $FILENAME is the recommended way to declaratively create and manage k8s resources via configuration templates. It also is handy in that it is idempotent!

NOTE: Technically, you should only do kubectl apply from the very beginning, and it is not recommended to be mixed with kubectl create. However, I tested on my 1.8 cluster and it has had no side effects. If on the slight chance there's a problem, deleting and re-adding Service Catalog and the GCP broker via sc will 100% fix the issue. And anyone using sc on a fresh cluster would be only applying from the very beginning.

Fixes: #142

maqiuyujoyce commented 6 years ago

This is beautiful! What about "delete"?

kibbles-n-bytes commented 6 years ago

I just submitted a PR that makes deletion of k8s resouces also idempotent, though there is some non-idempotent gcloud-specific stuff still, so the sc commands aren't yet there. :sweat_smile:

maqiuyujoyce commented 6 years ago

Cool, thank you! Another question is, the idempotency will only be kept within the one single kubectl command, right? There are more than one deployment happened in sc install and no matter which one fails, the installation will fail and we need to clean up namespace "service-catalog". I am not sure if this PR addresses that.

kibbles-n-bytes commented 6 years ago

Yeah, there still is work to be done to clean up after failed installs. This will only make sure that runs in the past won't affect future successes.