kubernetes: When the number of jobs exceeds 500, cronjob cannot schedule, bug of pager.List
What happened: When the number of jobs exceeds 500, cronjob cannot schedule, bug of pager.List What you expected to happen: When the number of jobs exceeds 500, cronjobs are scheduled normally How to reproduce it (as minimally and precisely as possible): Create at least 501 jobs and one cronjob to see if cronjobs can be scheduled Anything else we need to know?: internalversion.List convert to batchv1.JobList error The following is the error log:
May 05 17:28:16 qa-cpu003.aibee.cn kube-controller-manager[40548]: E0505 17:28:16.100551 40548 cronjob_controller.go:117] expected type *batchv1.JobList, got type *internalversion.List
Environment:
- Kubernetes version (use
kubectl version): v1.14 - Cloud provider or hardware configuration:
- OS (e.g:
cat /etc/os-release):
NAME="Ubuntu"
VERSION="18.04.1 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.1 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
- Kernel (e.g.
uname -a):
Linux qa-cpu001.aibee.cn 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
- Install tools: ansible and kube binary
- Network plugin and version (if this is a network-related bug): calico
- Others:
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 23 (19 by maintainers)
@jpbetz I have the same analyze about this bug. I push a pr to fix this. Would do like to review it?
I try to use meta.EachListItem to change the list into []batchv1.Job cc @jingyih @smarterclayton
As it stands, it looks like the
pager.ListAPI is error-prone, but I’m not certain how to fix it beyond improving the documentation (ideas?).The cast to
*batchv1.JobListin the cronjob controller is not safe. But it’s not obvious to developers since it works up to the page limit and intuitively seems like a reasonable thing to try.pager.Listreturns aruntime.Objectwhich can be either:ListPageFuncprovided topager.New(in this case*batchv1.JobList), if the result fits in a single pagemetainternalversion.List(see thepager.Listimplementation) if it exceeds a single page in size and must be accumulated.meta.ListAccessorcan be safely used to access the list returned bypager.List. As a starter, we should document that inpager.Listand use it here. But we should also figure out how we can makepager.Listsafer for future use.cc @jingyih @smarterclayton