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

libct/configs/validate: allow / in sysctl names #3254

Merged
merged 1 commit into from
Oct 29, 2021

Conversation

kolyshkin
Copy link
Contributor

Runtime spec says:

sysctl (object, OPTIONAL) allows kernel parameters to be modified at
runtime for the container. For more information, see the sysctl(8)
man page.

and sysctl(8) says:

variable
The name of a key to read from. An example is
kernel.ostype. The '/' separator is also accepted in place of a '.'.

Apparently, runc config validator do not support sysctls with / as a
separator. Fortunately this is a one-line fix.

Add some more test data where / is used as a separator.

Related to: kubernetes/kubernetes#102393

Runtime spec says:

> sysctl (object, OPTIONAL) allows kernel parameters to be modified at
> runtime for the container. For more information, see the sysctl(8)
> man page.

and sysctl(8) says:

> variable
>    The name of a key to read from. An example is
>    kernel.ostype. The '/' separator is also accepted in place of a '.'.

Apparently, runc config validator do not support sysctls with / as a
separator. Fortunately this is a one-line fix.

Add some more test data where / is used as a separator.

Signed-off-by: Kir Kolyshkin <[email protected]>
Comment on lines +191 to +195
"fs/mqueue/ctl": "ctl",
"net.ctl": "ctl",
"net/ctl": "ctl",
"kernel.ctl": "ctl",
"kernel/ctl": "ctl",

Choose a reason for hiding this comment

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

In the unit test, the sysctl value with existing dots and slashes is also added.

@@ -150,6 +150,7 @@ func (v *ConfigValidator) sysctl(config *configs.Config) error {
)

for s := range config.Sysctl {
s := strings.Replace(s, "/", ".", -1)
Copy link

@mengjiao-liu mengjiao-liu Nov 1, 2021

Choose a reason for hiding this comment

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

I think there is a problem with your conversion:
If the ssyctl value is net/pv4/conf/eno2.100/rp_filter
The correct conversion result should be net.ipv4.conf.eno2/100.rp_filter

see kubernetes/kubernetes#102393 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

@mengjiao-liu Could you open a github issue?

Choose a reason for hiding this comment

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

Ok, I will open a issue.

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

Successfully merging this pull request may close these issues.

4 participants