@@ -55,7 +55,7 @@ func (i instances) discoverNode(ctx context.Context, node *v1.Node) (*cloudprovi
5555 }
5656 return server , nil
5757 }
58- return nil , errors . New ( "failed to discoverNode" )
58+ return nil , nil
5959}
6060
6161func (i instances ) InstanceExists (ctx context.Context , node * v1.Node ) (bool , error ) {
@@ -65,15 +65,24 @@ func (i instances) InstanceExists(ctx context.Context, node *v1.Node) (bool, err
6565 return server != nil , err
6666}
6767
68- func (i instances ) InstanceShutdown (_ context.Context , node * v1.Node ) (bool , error ) {
68+ func (i instances ) InstanceShutdown (ctx context.Context , node * v1.Node ) (bool , error ) {
6969 klog .Infof ("InstanceShutdown %s" , node .Name )
70- // TODO check here for mounted volumes
70+ server , err := i .discoverNode (ctx , node )
71+ if err != nil {
72+ return false , fmt .Errorf ("failed to discoverNode %v" , err )
73+ }
74+ if server != nil {
75+ return false , nil
76+ }
7177 return true , nil
7278}
7379
7480func (i instances ) InstanceMetadata (ctx context.Context , node * v1.Node ) (* cloudprovider.InstanceMetadata , error ) {
7581 klog .Infof ("InstanceMetadata %s" , node .Name )
7682 server , err := i .discoverNode (ctx , node )
83+ if server == nil && err == nil {
84+ return nil , errors .New ("failed to discoverNode" )
85+ }
7786 klog .InfoDepth (1 , server )
7887 return server , err
7988}
0 commit comments