Skip to content

Commit d4fb287

Browse files
committed
search for node
1 parent 2c32f08 commit d4fb287

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ trim_trailing_whitespace = true
99
charset = utf-8
1010
max_line_length = 120
1111

12-
[{*.go}]
12+
[*.go]
1313
indent_style = tab
1414
insert_final_newline = true
1515

pkg/ionos/instances.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

6161
func (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

7480
func (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

Comments
 (0)