Problem
Upgrade from Konvoy 1.8.x to 2.1.1 will fail with the error below [1], if the konvoy 1.8.x cluster was originally provisioned with an existing AWS VPC infra.
[1]
dkp prepare-to-adopt cluster aws
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
github.com/mesosphere/konvoy2/pkg/adoption/state.(*State).GetAWSVPC(0x40)
github.com/mesosphere/konvoy2/pkg/adoption/state/aws.go:91 +0xc5
github.com/mesosphere/konvoy2/pkg/adoption/state.(*State).convertAWSClusterVPC(0xc0008ba9a0)
github.com/mesosphere/konvoy2/pkg/adoption/state/aws.go:33 +0x1d
github.com/mesosphere/konvoy2/pkg/adoption/state.(*State).convertAWSClusterSpec(0xc0008df240)
github.com/mesosphere/konvoy2/pkg/adoption/state/aws.go:16 +0x25
github.com/mesosphere/konvoy2/pkg/adoption/state.(*State).ConvertV2(0xc0008df240)
github.com/mesosphere/konvoy2/pkg/adoption/state/state.go:259 +0x425
github.com/mesosphere/konvoy2/cmd/konvoy/app/cluster.RunPrepareToAdoptCluster(0xc0008de500, 0xc00099fd70, 0xc00081d040, {0x1eb846b, 0x0})
github.com/mesosphere/konvoy2/cmd/konvoy/app/cluster/prepare-to-adopt.go:134 +0x1a5
github.com/mesosphere/konvoy2/cmd/konvoy/app/cluster.NewPrepareToAdoptClusterCommandForProvider.func1(0xc000937180, {0x3737288, 0x0, 0x0})
github.com/mesosphere/konvoy2/cmd/konvoy/app/cluster/prepare-to-adopt.go:97 +0x2d
github.com/spf13/cobra.(*Command).execute(0xc000937180, {0x3737288, 0x0, 0x0})
github.com/spf13/cobra@v1.2.1/command.go:856 +0x60e
github.com/spf13/cobra.(*Command).ExecuteC(0xc0008db400)
github.com/spf13/cobra@v1.2.1/command.go:974 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
github.com/spf13/cobra@v1.2.1/command.go:902
main.main()
./main.go:31 +0x1dd
Cause
As DKP 2.1.1 prepares to adopt the cluster, it retrieves the list of resources from the terraform state. Since, the cluster was provisioned with an existing VPC, this resource is not managed by terraform and therefore not in the terraform state resource list. Hence the index out of range error returned.
Solution
Our Engineering is looking into adding this support to DKP 2.1.2 patch release.
Reference: COPS-7183