juju icon indicating copy to clipboard operation
juju copied to clipboard

cannot destroy / kill a Kubernetes juju controller

Open claudiubelu opened this issue 7 months ago • 2 comments

Description

Currently, we cannot destroy a Kubernetes Controller because the kubernetesEnvironProvider cannot be cast to a CloudEnvironProvider (the Open method has a different return type), causing certain operations like juju destroy-controller to fail. Example:

juju destroy-controller --no-prompt --destroy-storage  --force --no-wait sunbeam-controller --verbose --debug
06:36:49 INFO  juju.cmd supercommand.go:56 running juju [3.6.5 33b026f4ab2a4fe371764b9c41993d3e1e90ddef gc go1.24.1]
06:36:49 DEBUG juju.cmd supercommand.go:57   args: []string{"/snap/juju/30723/bin/juju", "destroy-controller", "--no-prompt", "--destroy-storage", "--force", "--no-wait", "sunbeam-controller", "--verbose", "--debug"}
06:36:49 INFO  juju.juju api.go:90 connecting to API addresses: [172.16.1.201:17070]
06:36:49 DEBUG juju.api apiclient.go:1080 successfully dialed "wss://172.16.1.201:17070/api"
06:36:49 INFO  juju.api apiclient.go:601 connection established to "wss://172.16.1.201:17070/api"
06:36:49 INFO  juju.juju api.go:90 connecting to API addresses: [172.16.1.201:17070]
06:36:49 DEBUG juju.api apiclient.go:1080 successfully dialed "wss://172.16.1.201:17070/api"
06:36:49 INFO  juju.api apiclient.go:601 connection established to "wss://172.16.1.201:17070/api"
06:36:49 DEBUG juju.api monitor.go:35 RPC connection died
06:36:49 DEBUG juju.api monitor.go:35 RPC connection died
ERROR getting controller environ: cloud environ provider provider.kubernetesEnvironProvider not valid
06:36:49 DEBUG cmd supercommand.go:571 error stack:
github.com/juju/juju/environs.Open:30: cloud environ provider provider.kubernetesEnvironProvider not valid
github.com/juju/juju/cmd/juju/controller.(*destroyCommand).Run:261: getting controller environ

Juju version

3.6.5

Cloud

Kubernetes

Expected behaviour

We should be able to kill / destroy a Kubernetes controller.

Reproduce / Test

  1. Bootstrap a controller on Kubernetes.
  2. Destroy it.

Notes & References

Test checking this claim: https://github.com/juju/juju/pull/19794

claudiubelu avatar May 20 '25 06:05 claudiubelu

This bug has now been triaged. JUJU-7956

jujubot avatar May 21 '25 14:05 jujubot

I think we're trying to kill the controller through the API, which is causing issues.

See:

https://github.com/juju/juju/blob/a93170f7ea42bb3e0774bc315ed5a6328631d8a3/cmd/juju/controller/destroy.go#L615-L620

Then ends up calling:

https://github.com/juju/juju/blob/a93170f7ea42bb3e0774bc315ed5a6328631d8a3/cmd/juju/controller/destroy.go#L699-L703

Which ultimately calls:

https://github.com/juju/juju/blob/a93170f7ea42bb3e0774bc315ed5a6328631d8a3/environs/open.go#L29-L31

The problem is this isn't correct for CAAS.

It would be interesting why we don't have anything in the local storage though?

SimonRichardson avatar May 22 '25 08:05 SimonRichardson