konstructio / kubefirst

The Kubefirst Open Source Platform
https://kubefirst.konstruct.io/docs
MIT License
1.8k stars 139 forks source link

panic: interface conversion: runtime.Object is *v1.Status, not *v1.StatefulSet #1908

Open agardnerIT opened 11 months ago

agardnerIT commented 11 months ago

Which version of kubefirst are you using?

v2.3.5

Which cloud provider?

k3d (local)

Which DNS?

None specific

Which installation type?

CLI

Which distributed Git provider?

GitHub

Which Operating System?

macOS

What is the issue?

Trying to install k3d variant on localhost (MacBook Air m1).

I've had some timeouts so keep executing kubefirst k3d create and it seems to pick up where it left off.

But now it panicked:

Running preflight checks                ... done! [5 in 1ms]
Cloning and formatting git repositories ... done! [1 in 0s]
Applying github Terraform               ... done! [1 in 0s]
Pushing git repositories                ... done! [1 in 0s]
Creating k3d cluster                    ... done! [1 in 0s]
Bootstrapping Kubernetes resources      ... done! [2 in 114ms]
Verifying Kubernetes cluster is ready   ... done! [3 in 24.072s]
Installing and configuring Argo CD      ...  0.0% [......................................] [0 in 56.507756s]
Installing and configuring Argo CD      ...  0.0% [......................................] [0 in 57.507833s]
Installing and configuring Argo CD      ...  0.0% [......................................] [0 in 1m3.907738s]
Installing and configuring Argo CD      ...  0.0% [......................................] [0 in 1m4.007746s]
Installing and configuring Argo CD      ...  0.0% [......................................] [0 in 1m26.607746s]
[#############################################################################...........] [1m51s]
Installing and configuring Argo CD      ... 33.3% [############..........................] [1 in 4m21.407335s]
[################################################################################........] [4m46s]
panic: interface conversion: runtime.Object is *v1.Status, not *v1.StatefulSet

goroutine 12 [running]:
github.com/kubefirst/runtime/pkg/k8s.WaitForStatefulSetReady(0x14000dda180, 0x14001849500, 0x12c, 0x0)
    github.com/kubefirst/runtime@v0.3.28/pkg/k8s/exec.go:453 +0x580
github.com/kubefirst/runtime/pkg/k8s.VerifyArgoCDReadiness(0x14000de46e0?, 0x1, 0x1029c444c?)
    github.com/kubefirst/runtime@v0.3.28/pkg/k8s/argocd.go:32 +0xb0
github.com/kubefirst/kubefirst/cmd/k3d.runK3d(0x140008f3500?, {0x1063a4e80?, 0x0?, 0x0?})
    github.com/kubefirst/kubefirst/cmd/k3d/create.go:946 +0x4fc8
github.com/spf13/cobra.(*Command).execute(0x140008f3500, {0x1063a4e80, 0x0, 0x0})
    github.com/spf13/cobra@v1.7.0/command.go:940 +0x658
github.com/spf13/cobra.(*Command).ExecuteC(0x10631c520)
    github.com/spf13/cobra@v1.7.0/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).Execute(...)
    github.com/spf13/cobra@v1.7.0/command.go:992
github.com/kubefirst/kubefirst/cmd.Execute()
    github.com/kubefirst/kubefirst/cmd/root.go:48 +0x2c
main.main.func2()
    github.com/kubefirst/kubefirst/main.go:91 +0x1c
created by main.main in goroutine 1
    github.com/kubefirst/kubefirst/main.go:90 +0x614

Code of Conduct


Running again gives:

2023-11-13T19:55 INF pkg/helpers.go:78 > Using config file: /Users/adamgardner/.kubefirst
2023-11-13T19:55 INF cmd/k3d/create.go:128 > github.com ssh-rsa

2023-11-13T19:55 INF cmd/k3d/create.go:212 > verifying github authentication
2023-11-13T19:55 INF kubefirst-api/pkg/handlers/GitHubHandler/github.go:173 > GitHub user: agardnerIT
2023-11-13T19:55 INF cmd/k3d/create.go:363 > kubefirst version configs.K1Version: v2.3.5 
2023-11-13T19:55 INF cmd/k3d/create.go:364 > cloning gitops-template repo url: https://github.com/kubefirst/gitops-template.git 
2023-11-13T19:55 INF cmd/k3d/create.go:365 > cloning gitops-template repo branch: v2.3.5 
2023-11-13T19:55 INF cmd/k3d/create.go:374 > checking authentication to required providers
2023-11-13T19:55 INF cmd/k3d/create.go:429 > already completed github checks - continuing
2023-11-13T19:55 INF cmd/k3d/create.go:459 > already setup kbot user - continuing
2023-11-13T19:55 INF cmd/k3d/create.go:463 > validation and kubefirst cli environment check is complete
2023-11-13T19:55 INF cmd/k3d/create.go:534 > already completed download of dependencies to `$HOME/.k1/tools` - continuing
2023-11-13T19:55 INF cmd/k3d/create.go:581 > already completed gitops repo generation - continuing
2023-11-13T19:55 INF cmd/k3d/create.go:629 > already created GitHub Terraform resources
2023-11-13T19:55 INF cmd/k3d/create.go:681 > referencing gitops repository: git@github.com:agardnerIT/gitops.git
2023-11-13T19:55 INF cmd/k3d/create.go:682 > referencing metaphor repository: https://github.com/agardnerIT/metaphor.git
2023-11-13T19:55 INF cmd/k3d/create.go:752 > already pushed detokenized gitops repository content
2023-11-13T19:55 INF cmd/k3d/create.go:785 > already created k3d cluster resources
2023-11-13T19:55 INF cmd/k3d/create.go:821 > already added secrets to k3d cluster
2023-11-13T19:55 ERR internal/gitShim/containerRegistryAuth.go:61 > error while creating secret for container registry auth: Post "https://0.0.0.0:54366/api/v1/namespaces/argo/secrets": net/http: TLS handshake timeout
2023-11-13T19:57 INF pkg/k8s/exec.go:179 > waiting for traefik Deployment to be created
2023-11-13T19:57 ERR pkg/k8s/exec.go:188 > error waiting for traefik Deployment to be created: %!s(<nil>)

Running preflight checks                ... done! [5 in 2ms]
Cloning and formatting git repositories ... done! [1 in 0s]
Applying github Terraform               ... done! [1 in 0s]
Pushing git repositories                ... done! [1 in 0s]
Creating k3d cluster                    ... done! [1 in 0s]
Bootstrapping Kubernetes resources      ... done! [2 in 10.005s]
Verifying Kubernetes cluster is ready   ...  0.0% [......................................] [0 in 2m0.976619s]
[###########################################################################.............] [2m11s]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x448 pc=0x1060ae50c]

goroutine 9 [running]:
github.com/kubefirst/runtime/pkg/k8s.WaitForDeploymentReady(0x14000ee4480, 0x0, 0xf0)
    github.com/kubefirst/runtime@v0.3.28/pkg/k8s/exec.go:312 +0x2c
github.com/kubefirst/kubefirst/cmd/k3d.runK3d(0x14000af7800?, {0x10a4d0e80?, 0x0?, 0x0?})
    github.com/kubefirst/kubefirst/cmd/k3d/create.go:875 +0x4900
github.com/spf13/cobra.(*Command).execute(0x14000af7800, {0x10a4d0e80, 0x0, 0x0})
    github.com/spf13/cobra@v1.7.0/command.go:940 +0x658
github.com/spf13/cobra.(*Command).ExecuteC(0x10a448520)
    github.com/spf13/cobra@v1.7.0/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).Execute(...)
    github.com/spf13/cobra@v1.7.0/command.go:992
github.com/kubefirst/kubefirst/cmd.Execute()
    github.com/kubefirst/kubefirst/cmd/root.go:48 +0x2c
main.main.func2()
    github.com/kubefirst/kubefirst/main.go:91 +0x1c
created by main.main in goroutine 1
    github.com/kubefirst/kubefirst/main.go:90 +0x614
fharper commented 11 months ago

Thanks for reporting this issue @agardnerIT. I was not able to reproduce the timeout, so not able to reproduce the second issue also.

What happen if you run kubefirst k3d destroy and try to create the cluster again?

If you get a timeout again, before running the command again, can you copy the logs, and shared them here.