vmware-archive / octant

Highly extensible platform for developers to better understand the complexity of Kubernetes clusters.
https://octant.dev
Apache License 2.0
6.28k stars 483 forks source link

Issues listing namespace with cronjobs happening on k8s v1.21.4 #2812

Open hugodopradofernandes opened 3 years ago

hugodopradofernandes commented 3 years ago

What steps did you take and what happened: Namespace does not load at all on Octant when it tries to display cronjobs.

What did you expect to happen: Items from workspace to load - cronjobs causing the issue. When displaying only workloads, works fine. When cronjob is part of the view, it fails

Anything else you would like to add: [Miscellaneous information that will assist in solving the issue.] Namespace that Octant could not list

[hprado@rancherv2server ~]$ kubectl get all --namespace klustair-scan 
NAME                                        READY   STATUS    RESTARTS   AGE
pod/klustair-app-frontend-65cc49594-6nkdq   1/1     Running   0          35m
pod/klustair-app-postgresql-0               1/1     Running   0          35m
pod/klustair-app-runner-58d4d95f95-vfh67    1/1     Running   0          35m

NAME                                       TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
service/klustair-app-frontend              ClusterIP   10.43.3.162     <none>        80/TCP     35m
service/klustair-app-postgresql            ClusterIP   10.43.114.228   <none>        5432/TCP   35m
service/klustair-app-postgresql-headless   ClusterIP   None            <none>        5432/TCP   35m

NAME                                    READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/klustair-app-frontend   1/1     1            1           35m
deployment.apps/klustair-app-runner     1/1     1            1           35m

NAME                                              DESIRED   CURRENT   READY   AGE
replicaset.apps/klustair-app-frontend-65cc49594   1         1         1       35m
replicaset.apps/klustair-app-runner-58d4d95f95    1         1         1       35m

NAME                                       READY   AGE
statefulset.apps/klustair-app-postgresql   1/1     35m

NAME                             SCHEDULE     SUSPEND   ACTIVE   LAST SCHEDULE   AGE
cronjob.batch/klustair-app-job   15 9 * * *   False     0        <none>          35m
[hprado@rancherv2server ~]$

Log error that repeats when trying to load this namespace:


2021-08-31T13:15:03.378-0300    ERROR   api/content_manager.go:159      generate content        {"client-id": "8b01d9fa-0a76-11ec-8adc-52540031336b", "err": "generate content: scheme convert: converting (v1.CronJob) to (v1beta1.CronJob): unknown conversion", "content-path": "overview/namespace/klustair-scan"}
github.com/vmware-tanzu/octant/internal/api.(*ContentManager).runUpdate.func1
        /__w/octant/octant/internal/api/content_manager.go:159
github.com/vmware-tanzu/octant/internal/api.(*InterruptiblePoller).Run.func1
        /__w/octant/octant/internal/api/poller.go:86
github.com/vmware-tanzu/octant/internal/api.(*InterruptiblePoller).Run
        /__w/octant/octant/internal/api/poller.go:95
github.com/vmware-tanzu/octant/internal/api.(*ContentManager).Start
        /__w/octant/octant/internal/api/content_manager.go:133
2021-08-31T13:15:04.379-0300    ERROR   api/content_manager.go:159      generate content        {"client-id": "8b01d9fa-0a76-11ec-8adc-52540031336b", "err": "generate content: scheme convert: converting (v1.CronJob) to (v1beta1.CronJob): unknown conversion", "content-path": "overview/namespace/klustair-scan"}
github.com/vmware-tanzu/octant/internal/api.(*ContentManager).runUpdate.func1
        /__w/octant/octant/internal/api/content_manager.go:159
github.com/vmware-tanzu/octant/internal/api.(*InterruptiblePoller).Run.func1
        /__w/octant/octant/internal/api/poller.go:86
github.com/vmware-tanzu/octant/internal/api.(*InterruptiblePoller).Run
        /__w/octant/octant/internal/api/poller.go:95
github.com/vmware-tanzu/octant/internal/api.(*ContentManager).Start
        /__w/octant/octant/internal/api/content_manager.go:133

Environment:

hugodopradofernandes commented 2 years ago

batch/v1beta1 CronJob is deprecated in v1.21+, unavailable in v1.25+; use batch/v1 CronJob

brunnels commented 2 years ago

I can confirm this is still happening with apiVersion: batch/v1 CronJobs using 0.25.0 in windows

brunnels commented 2 years ago

This should be a simple fix. Any chance to get a new release?

flo-mic commented 2 years ago

I'm facing the same issue when browsing a namespace with Cron jobs enabled (e.g. a nextcloud deployment from this chart https://github.com/nextcloud/helm/tree/master/charts/nextcloud). The cron jobs use the "batch/v1" API and the kubernetes version is v1.22.

haiwu commented 2 years ago

I just hit the same issue.

ITH-Icoserve commented 2 years ago

Same issue here, on kubernetes v1.23.3

wizardofdevops commented 2 years ago

same issue

mpccolorado commented 2 years ago

Same issue

pbebbo commented 2 years ago

same issue

ScottAlbertine commented 2 years ago

Same issue, even after changing all cron jobs to be v1 instead of v1beta1

tihakkar643 commented 2 years ago

Same issue. Using batch/v1

Freydal commented 2 years ago

I'm pretty sure the following needs to be updated to batchv1. I haven't fully vetted if it isn't going to break anything, but roughly fixed the issue at hand.

https://github.com/vmware-tanzu/octant/blob/fd077fc3948e1b107f674d527454c4384c6e8ea9/internal/describer/objects.go#L55-L61