Merge pull request #194 from vaikas-google/master

Use the actual kubernetes object when deleting to ensure it absolutely
pull/167/merge
Brendan Melville 9 years ago
commit 5343c35b7e

@ -165,7 +165,12 @@ func (a *Configurator) configureResource(resource *common.Resource, o operation)
case GetOperation:
return a.k.Get(resource.Name, resource.Type)
case DeleteOperation:
ret, err = a.k.Delete(resource.Name, resource.Type)
obj, err := marshalResource(resource)
if err != nil {
resource.State = failState(err)
return "", err
}
ret, err = a.k.Delete(obj)
// Treat deleting a non-existent resource as success.
if err != nil {
if strings.HasSuffix(strings.TrimSpace(ret), "not found") {

@ -37,6 +37,6 @@ type KubernetesConfig struct {
type Kubernetes interface {
Get(name string, resourceType string) (string, error)
Create(resource string) (string, error)
Delete(name string, resourceType string) (string, error)
Delete(resource string) (string, error)
Replace(resource string) (string, error)
}

@ -100,11 +100,9 @@ func (k *KubernetesKubectl) Create(resource string) (string, error) {
return k.execute(args, resource)
}
func (k *KubernetesKubectl) Delete(name string, resourceType string) (string, error) {
args := []string{"delete",
resourceType,
name}
return k.execute(args, "")
func (k *KubernetesKubectl) Delete(resource string) (string, error) {
args := []string{"delete"}
return k.execute(args, resource)
}
func (k *KubernetesKubectl) Replace(resource string) (string, error) {

Loading…
Cancel
Save