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

reset spec if update returned error #3818

Merged
merged 1 commit into from
Jan 20, 2025
Merged

Conversation

zzzzzzzzzy9
Copy link
Contributor

reset spec if update returned error

@zzzzzzzzzy9
Copy link
Contributor Author

@AkihiroSuda could you please review this pr? thanks.

@AkihiroSuda
Copy link
Member

How to test this?

@zzzzzzzzzy9
Copy link
Contributor Author

zzzzzzzzzy9 commented Jan 15, 2025

1、update memory and gave a wrong args to restart.

nerdctl -n k8s.io update --memory=450000000 --restart=123 ef66

2、This will got an error like this:

FATA[0000] 1 errors:
unsupported restart policy "123", supported policies are: ["no" "always" "on-failure" "unless-stopped"]

3、

nerdctl -n k8s.io inspect --mode=native <Container ID>

inspect we can see the memory is 450000000 now. In fact, the memory is not being updated.

@AkihiroSuda
Copy link
Member

Can we have an integration test?

@zzzzzzzzzy9
Copy link
Contributor Author

Ok, I will do it.

@zzzzzzzzzy9 zzzzzzzzzy9 force-pushed the update branch 2 times, most recently from dee98b2 to a99bdc0 Compare January 15, 2025 07:52
@zzzzzzzzzy9
Copy link
Contributor Author

Done. @AkihiroSuda

)

func TestUpdateContainer(t *testing.T) {
testutil.DockerIncompatible(t)
Copy link
Member

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor Author

@zzzzzzzzzy9 zzzzzzzzzy9 Jan 20, 2025

Choose a reason for hiding this comment

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

Because this depends on inspect --mode=native to see the memory change, but docker does not support inspect --mode=native

@AkihiroSuda AkihiroSuda added this to the v2.0.3 milestone Jan 17, 2025
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks, I'm merging this, but wondering if we can omit --mode=native and run some (docker|nerdctl) exec command instead

@AkihiroSuda AkihiroSuda merged commit 2eeb8de into containerd:main Jan 20, 2025
30 checks passed
@zzzzzzzzzy9
Copy link
Contributor Author

We can't use exec because the update fails and the actual memory is not modified. But the original situation is that even though it has not been modified, inspect --mode=native shows that it has been modified. So exec can't see this problem.

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.

2 participants