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

Add support for ulimits #1264

Merged
merged 5 commits into from
Apr 28, 2023

Conversation

dan-ash
Copy link
Contributor

@dan-ash dan-ash commented Apr 18, 2023

What

This PR add support for passing runtime(docker) ulimits flags for nodes

Why

The issue been discussed in #803 and a enhancement request #1140

Implications

This PR changes the CLI and internals of the go module, it also updating the config ApiVersion to v1alpha5

@all-contributors please add @dan-ash for code

@iwilltry42
Copy link
Member

Hi @dan-ash thanks a lot for this PR!
It looks pretty complete on a first glance.
I'm at the KubeCon right now, so could only quickly scan it on my phone.

Can you just try to move the initial CLI parsing to a single occurrence to avoid the duplicate code?
Probably there are more instances where we should do this in general.

Thank you!

@dan-ash
Copy link
Contributor Author

dan-ash commented Apr 19, 2023

Thanks @iwilltry42 I will have a look and try to do it for runtime labels as well

@dan-ash dan-ash force-pushed the start-k3d-node-containers-with-ulimit branch from e4560f9 to abcb08c Compare April 19, 2023 21:11
@dan-ash
Copy link
Contributor Author

dan-ash commented Apr 19, 2023

Hi @iwilltry42, please see my attempt to abstract the logic for parsing the ulimits

@dan-ash
Copy link
Contributor Author

dan-ash commented Apr 25, 2023

Hi @iwilltry42 when do you think you'll have time to review?
Thanks

Copy link
Member

@iwilltry42 iwilltry42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall. Just some minor comments to clarify, then we're good to go :)

Comment on lines 166 to 167
l.Log().Errorln("No runtime-label specified")
l.Log().Fatalln(err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
l.Log().Errorln("No runtime-label specified")
l.Log().Fatalln(err)
l.Log().Fatalf("No runtime-label specified: %v", err)


// ValidateRuntimeUlimitKey validates a given ulimit key is valid
func ValidateRuntimeUlimitKey(ulimitKey string) {
ulimitsKeys := map[string]bool{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get a list of supported keys from somewhere e.g. in the Docker SDK?
Would be nicer than maintaining it over here.
I'd be fine with it for a start though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be interface{} instead of bool, but I see the benefit of the latter a little further down

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally attempt to do so but the map var of it in the go-units is private
https://github.com/docker/go-units/blob/master/ulimit.go#L46

Hard: int64(hard),
}
default:
l.Log().Fatalf("Wrong Type")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use some more details

@dan-ash dan-ash force-pushed the start-k3d-node-containers-with-ulimit branch from df8b15e to 2c153c3 Compare April 27, 2023 19:18
@dan-ash dan-ash requested a review from iwilltry42 April 27, 2023 19:18
@iwilltry42
Copy link
Member

Great, thank you very much for this addition @dan-ash ! 🙏

@iwilltry42 iwilltry42 merged commit 88c5f18 into k3d-io:main Apr 28, 2023
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 this pull request may close these issues.

None yet

2 participants