From a1829d683e49537df4984529455903cc95d6cfaf Mon Sep 17 00:00:00 2001 From: Josh Horwitz Date: Mon, 21 Aug 2017 14:55:43 -0400 Subject: [PATCH 1/3] Add InstanceExists* methods to cloud provider interface for CCM --- pkg/cloudprovider/providers/openstack/openstack_instances.go | 5 +++++ pkg/volume/cinder/attacher_test.go | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/pkg/cloudprovider/providers/openstack/openstack_instances.go b/pkg/cloudprovider/providers/openstack/openstack_instances.go index 2ae872cc99982..d8f96061f75e0 100644 --- a/pkg/cloudprovider/providers/openstack/openstack_instances.go +++ b/pkg/cloudprovider/providers/openstack/openstack_instances.go @@ -110,6 +110,11 @@ func (i *Instances) ExternalID(name types.NodeName) (string, error) { return srv.ID, nil } +// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running. +func (i *Instances) InstanceExistsByProviderID(providerID string) (bool, error) { + return false, errors.New("unimplemented") +} + // InstanceID returns the kubelet's cloud provider ID. func (os *OpenStack) InstanceID() (string, error) { if len(os.localInstanceID) == 0 { diff --git a/pkg/volume/cinder/attacher_test.go b/pkg/volume/cinder/attacher_test.go index e1818d58447e9..d6a4b5b06e639 100644 --- a/pkg/volume/cinder/attacher_test.go +++ b/pkg/volume/cinder/attacher_test.go @@ -650,6 +650,10 @@ func (instances *instances) InstanceTypeByProviderID(providerID string) (string, return "", errors.New("Not implemented") } +func (instances *instances) InstanceExistsByProviderID(providerID string) (bool, error) { + return false, errors.New("unimplemented") +} + func (instances *instances) List(filter string) ([]types.NodeName, error) { return []types.NodeName{}, errors.New("Not implemented") } From 54a5f768368e7b569b09def459fc910c62910558 Mon Sep 17 00:00:00 2001 From: Josh Horwitz Date: Fri, 25 Aug 2017 16:15:55 -0400 Subject: [PATCH 2/3] address test & doc comments --- pkg/cloudprovider/providers/openstack/openstack_instances.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/cloudprovider/providers/openstack/openstack_instances.go b/pkg/cloudprovider/providers/openstack/openstack_instances.go index d8f96061f75e0..6f81763794006 100644 --- a/pkg/cloudprovider/providers/openstack/openstack_instances.go +++ b/pkg/cloudprovider/providers/openstack/openstack_instances.go @@ -111,6 +111,7 @@ func (i *Instances) ExternalID(name types.NodeName) (string, error) { } // InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running. +// If false is returned with no error, the instance will be immediately deleted. func (i *Instances) InstanceExistsByProviderID(providerID string) (bool, error) { return false, errors.New("unimplemented") } From fb6a0a90aefbc2d7bff76307f92dcf0192c357b0 Mon Sep 17 00:00:00 2001 From: Josh Horwitz Date: Fri, 25 Aug 2017 18:04:10 -0400 Subject: [PATCH 3/3] change godoc based on feedback from luxas --- pkg/cloudprovider/providers/openstack/openstack_instances.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cloudprovider/providers/openstack/openstack_instances.go b/pkg/cloudprovider/providers/openstack/openstack_instances.go index 6f81763794006..7a7574a968abc 100644 --- a/pkg/cloudprovider/providers/openstack/openstack_instances.go +++ b/pkg/cloudprovider/providers/openstack/openstack_instances.go @@ -111,7 +111,7 @@ func (i *Instances) ExternalID(name types.NodeName) (string, error) { } // InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running. -// If false is returned with no error, the instance will be immediately deleted. +// If false is returned with no error, the instance will be immediately deleted by the cloud controller manager. func (i *Instances) InstanceExistsByProviderID(providerID string) (bool, error) { return false, errors.New("unimplemented") }