Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Index out of range during floating ip cleanup when trying to ssh to an openstack server #525

Open
stoyanr opened this issue Oct 14, 2021 · 1 comment

Comments

@stoyanr
Copy link
Contributor

stoyanr commented Oct 14, 2021

Describe the bug
gardenctl crashes with index out of range during floating ip cleanup when trying to ssh to an openstack server.

To Reproduce
Steps to reproduce the behavior:

  1. Which target was set 'gardenctl get target'

Target an openstack shoot:

gardenctl target shoot dev-2
  1. Which command was entered [e.g. 'gardenctl show vpn-seed']

Try to ssh to one of the servers:

gardenctl ssh <server-name>
  1. What was the output of the command
Downloaded id_rsa key
Check Public IP
(1/5) Getting the external network for creating FIP
The external network ID is 059c8408-aee7-4d3d-87eb-1c5fb6d5d347
(2/5) Creating floating IP from external network
The floating IP created is 100.114.52.62
(3/5) Add floating IP to openstack server node
waiting for 10 seconds to retry
waiting for 10 seconds to retry
waiting for 10 seconds to retry
waiting for 10 seconds to retry
waiting for 10 seconds to retry
waiting for 10 seconds to retry
waiting for 10 seconds to retry
waiting for 10 seconds to retry
waiting for 10 seconds to retry
waiting for 10 seconds to retry
waiting for 10 seconds to retry
waiting for 10 seconds to retry
(4/5) Establishing SSH connection

ssh: connect to host 100.114.52.62 port 22: Connection refused
exit status 255

(5/5) Cleanup
De-associate server with floating ip
panic: runtime error: index out of range [2] with length 2

goroutine 1 [running]:
github.com/gardener/gardenctl/pkg/cmd.operate(0x23e317a, 0x9, 0xc00004a1e0, 0x55, 0x0, 0x0)
	/home/runner/work/gardenctl/gardenctl/pkg/cmd/operate.go:59 +0x3129
github.com/gardener/gardenctl/pkg/cmd.(*OpenstackInstanceAttribute).cleanUpOpenstack(0xc0001599c0, 0xc000159878)
	/home/runner/work/gardenctl/gardenctl/pkg/cmd/ssh_openstack.go:122 +0x1d5
github.com/gardener/gardenctl/pkg/cmd.sshToOpenstackNode(0x7ffeefbff7ce, 0x2d, 0xc00c3c4660, 0x57, 0x23e2200, 0x8, 0xc00c3db600, 0x3b, 0xc00e214000, 0x2d4, ...)
	/home/runner/work/gardenctl/gardenctl/pkg/cmd/ssh_openstack.go:114 +0xb65
github.com/gardener/gardenctl/pkg/cmd.NewSSHCmd.func1(0xc0003b7600, 0xc00035b6d0, 0x1, 0x1, 0x0, 0x0)
	/home/runner/work/gardenctl/gardenctl/pkg/cmd/ssh.go:123 +0xfbe
github.com/spf13/cobra.(*Command).execute(0xc0003b7600, 0xc00035b670, 0x1, 0x1, 0xc0003b7600, 0xc00035b670)
	/home/runner/work/gardenctl/gardenctl/vendor/github.com/spf13/cobra/command.go:840 +0x47c
github.com/spf13/cobra.(*Command).ExecuteC(0x2fab620, 0x1d, 0xc00003ff00, 0x36)
	/home/runner/work/gardenctl/gardenctl/vendor/github.com/spf13/cobra/command.go:945 +0x336
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/work/gardenctl/gardenctl/vendor/github.com/spf13/cobra/command.go:885
github.com/gardener/gardenctl/pkg/cmd.Execute()
	/home/runner/work/gardenctl/gardenctl/pkg/cmd/root.go:119 +0x46f
main.main()
	/home/runner/work/gardenctl/gardenctl/cmd/gardenctl/main.go:20 +0x25

Subsequent attempts to ssh to the same server fail earlier with the same error and stack trace:

Downloaded id_rsa key
Check Public IP
(1/5) Getting the external network for creating FIP
The external network ID is 059c8408-aee7-4d3d-87eb-1c5fb6d5d347
(2/5) Creating floating IP from external network
The floating IP created is 100.114.52.151
(3/5) Add floating IP to openstack server node
panic: runtime error: index out of range [2] with length 2

goroutine 1 [running]:
github.com/gardener/gardenctl/pkg/cmd.operate(0x23e317a, 0x9, 0xc00402e060, 0x53, 0x0, 0x0)
	/home/runner/work/gardenctl/gardenctl/pkg/cmd/operate.go:59 +0x3129
github.com/gardener/gardenctl/pkg/cmd.sshToOpenstackNode(0x7ffeefbff7ce, 0x2d, 0xc00de42d80, 0x57, 0x23e2200, 0x8, 0xc00df02f80, 0x3b, 0xc00c350c00, 0x2d4, ...)
	/home/runner/work/gardenctl/gardenctl/pkg/cmd/ssh_openstack.go:75 +0x632
github.com/gardener/gardenctl/pkg/cmd.NewSSHCmd.func1(0xc0003b5600, 0xc00035b6d0, 0x1, 0x1, 0x0, 0x0)
	/home/runner/work/gardenctl/gardenctl/pkg/cmd/ssh.go:123 +0xfbe
github.com/spf13/cobra.(*Command).execute(0xc0003b5600, 0xc00035b670, 0x1, 0x1, 0xc0003b5600, 0xc00035b670)
	/home/runner/work/gardenctl/gardenctl/vendor/github.com/spf13/cobra/command.go:840 +0x47c
github.com/spf13/cobra.(*Command).ExecuteC(0x2fab620, 0x1d, 0xc00003fd80, 0x36)
	/home/runner/work/gardenctl/gardenctl/vendor/github.com/spf13/cobra/command.go:945 +0x336
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/work/gardenctl/gardenctl/vendor/github.com/spf13/cobra/command.go:885
github.com/gardener/gardenctl/pkg/cmd.Execute()
	/home/runner/work/gardenctl/gardenctl/pkg/cmd/root.go:119 +0x46f
main.main()
	/home/runner/work/gardenctl/gardenctl/cmd/gardenctl/main.go:20 +0x25

Expected behavior
gardenctl should be able to ssh to the server and if for some reason it's not able to, it should clean the floating ip without errors.

Gardenctl Version (please complete the following information):

$ gardenctl version
gardenctl:
		version     : v0.24.3
		build date  : 2021-09-02
		go version  : go1.15.15
		go compiler : gc
		platform    : darwin/amd64

Additional context
Add any other context about the problem here.

@stoyanr
Copy link
Contributor Author

stoyanr commented Oct 14, 2021

The error is not easily reproducible. On ssh to other servers of the same shoot it did not show up. On the other hand, it did show up sometimes when trying to ssh to AWS instances, although also there it showed up only rarely.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant