Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PodName of CronJob running on EKS 1.21 is not correct #325

Closed
yu-shiba opened this issue Dec 6, 2021 · 2 comments · Fixed by #345
Closed

PodName of CronJob running on EKS 1.21 is not correct #325

yu-shiba opened this issue Dec 6, 2021 · 2 comments · Fixed by #345
Assignees
Labels
aws/eks Amazon Elastic Kubernetes Service status/investigate

Comments

@yu-shiba
Copy link

yu-shiba commented Dec 6, 2021

The default controller for CronJob in Kubernetes v1.21 has been changed to CronJobControllerV2.
At that time, the minimum execution unit of CronJob was changed to 1 minute.

Therefore, the generation of Cron Job name is changed from 11 characters of "-" + UnixTime. (Probably from 9 to 10 characters).
https://github.com/kubernetes/kubernetes/blob/v1.20.1/pkg/controller/cronjob/utils.go#L245

But CloudWatch Agent is not able to capture the correct PodName because the code assumes 11 characters (10 characters without "-" in the code).
https://github.com/aws/amazon-cloudwatch-agent/blob/master/plugins/processors/k8sdecorator/stores/utils.go#L71

So, even if define a CronJob like "iam-waiting-for-EKS-1-22", the PodName will be "iam".

This issue can be confirmed by running CloudWatch Agent with EKS 1.21 in the standard state (not disabled by feature-gate).

@jhnlsn jhnlsn added aws/eks Amazon Elastic Kubernetes Service status/investigate labels Jan 19, 2022
@khanhntd
Copy link
Contributor

Hey @yu-shiba. Thanks for letting us know the issues. After deep dive into the CronJobControllerV2, the getJobName has indeed used Unix Time in minutes instead of only Unix Time. Therefore, changing UnixTime from 10 characters to 9 characters currently and as a result, making the assumption of 10 characters wrong though. What I am asking myself was is there really a need to check 10 runes or only Unix Time is fine? Will ask my teammates about this before making any decision and fixed this ASAP

@yu-shiba
Copy link
Author

Hi @khanhntd and team. Thank you for providing us with a useful product.
I noticed this issue because the CronJob pod name shown in "CloudWatch Container Insights" was wrong.
I hope my findings will help you to resolve the issue as soon as possible.

What I am asking myself was is there really a need to check 10 runes or only Unix Time is fine?

I thought the same thing about this. And I couldn't make this decision, so I just let you know the results of the survey instead of PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws/eks Amazon Elastic Kubernetes Service status/investigate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants