diff --git a/cluster-autoscaler/cloudprovider/hetzner/hetzner_servers_cache.go b/cluster-autoscaler/cloudprovider/hetzner/hetzner_servers_cache.go index 04a2e964d6ff..36090d41d467 100644 --- a/cluster-autoscaler/cloudprovider/hetzner/hetzner_servers_cache.go +++ b/cluster-autoscaler/cloudprovider/hetzner/hetzner_servers_cache.go @@ -18,7 +18,6 @@ package hetzner import ( "context" - "errors" "strconv" "sync" "time" @@ -136,7 +135,8 @@ func (m *serversCache) getServer(nodeIdOrName string) (*hcloud.Server, error) { } } - return nil, errors.New("server not found") + // return nil if server not found + return nil, nil } func (m *serversCache) getServersByNodeGroupName(nodeGroup string) ([]*hcloud.Server, error) { diff --git a/cluster-autoscaler/cloudprovider/hetzner/hetzner_servers_cache_test.go b/cluster-autoscaler/cloudprovider/hetzner/hetzner_servers_cache_test.go index 629365dd45c1..c0cc7ec5a540 100644 --- a/cluster-autoscaler/cloudprovider/hetzner/hetzner_servers_cache_test.go +++ b/cluster-autoscaler/cloudprovider/hetzner/hetzner_servers_cache_test.go @@ -70,6 +70,7 @@ func TestServersCache(t *testing.T) { require.NoError(t, err) assert.Equal(t, "test2", foundservers.Name) - _, err = c.getServer("test3") - require.Error(t, err) + server, err := c.getServer("test3") + require.Nil(t, server) + require.NoError(t, err) }