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

Bug with gracePeriod conversion #415

Closed
pims opened this issue Mar 1, 2022 · 3 comments · Fixed by #416
Closed

Bug with gracePeriod conversion #415

pims opened this issue Mar 1, 2022 · 3 comments · Fixed by #416

Comments

@pims
Copy link
Contributor

pims commented Mar 1, 2022

When a graceperiod is configured, it looks like the conversion to int64 is incorrect.

func deleteOptions(gracePeriod time.Duration) metav1.DeleteOptions {
	if gracePeriod < 0 {
		return metav1.DeleteOptions{}
	}

	return metav1.DeleteOptions{GracePeriodSeconds: (*int64)(&gracePeriod)}
}

The issue is with:

GracePeriodSeconds: (*int64)(&gracePeriod)

since a duration default value is in nanoseconds, converting gracePeriod to int64 leads to using nanoseconds instead of seconds.

Example at: https://go.dev/play/p/Ee-vADPoDPt

PR incoming.

@pims pims changed the title Bug: with gracePeriod Bug with gracePeriod conversion Mar 1, 2022
pims added a commit to pims/chaoskube that referenced this issue Mar 1, 2022
@pims
Copy link
Contributor Author

pims commented Mar 1, 2022

I0301 19:31:00.435366 34724 kuberuntime_container.go:586] Killing container "docker://0613c6a155c02bcf56179e4d10c641e3ee01604c2f05341b7ac507ec3816d2b6" with 60000000000 second grace period

here's what we noticed in our cluster 🙃

@linki
Copy link
Owner

linki commented Apr 28, 2022

🤦‍♂️

@linki
Copy link
Owner

linki commented Apr 28, 2022

@pims Thanks for fixing this! 🤗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants