Skip to content

config: preserve legacy grpc address across sparse imports#13317

Merged
dmcgowan merged 1 commit into
containerd:mainfrom
fuweid:fix-merge-issue
Apr 30, 2026
Merged

config: preserve legacy grpc address across sparse imports#13317
dmcgowan merged 1 commit into
containerd:mainfrom
fuweid:fix-merge-issue

Conversation

@fuweid

@fuweid fuweid commented Apr 29, 2026

Copy link
Copy Markdown
Member

When migrating v3 [grpc] config to the v4 server plugin config, only emit fields that were actually set in the legacy config. This prevents a sparse imported [grpc] section, such as one only setting max_send_message_size, from generating address = "" and overwriting the address migrated from the root config.

Add table-driven coverage for sparse legacy grpc imports, including address preservation, imported address override, and default address retention when no imported config specifies address.

Fixes: #13316

@dmcgowan @berkayoz

Copilot AI review requested due to automatic review settings April 29, 2026 13:41
@github-project-automation github-project-automation Bot moved this to Needs Triage in Pull Request Review Apr 29, 2026
@dosubot dosubot Bot added the kind/bug label Apr 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates legacy v3 [grpc] → v4 server plugin migration to avoid emitting unset (zero-value) fields during merge, preventing sparse imported configs from unintentionally overwriting existing addresses.

Changes:

  • Adjust legacy gRPC migration to only populate plugin fields that were set in the legacy config.
  • Add table-driven tests covering sparse legacy gRPC imports and expected merge behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
cmd/containerd/server/config/config.go Builds migrated gRPC/grpc-tcp plugin maps sparsely to avoid overwriting fields with empty/zero values.
cmd/containerd/server/config/config_test.go Adds table-driven coverage for sparse v3 gRPC imports and address preservation/override behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +255 to +263
grpcConfig["uid"] = grpcUID
grpcConfig["gid"] = grpcGID
} else {
if grpcUID != 0 {
grpcConfig["uid"] = grpcUID
}
if grpcGID != 0 {
grpcConfig["gid"] = grpcGID
}

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

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

When grpcAddress != "", this unconditionally emits uid/gid into the migrated plugin config even when they’re zero values. That contradicts the stated goal of only emitting fields that were actually set in the legacy config, and it can also overwrite non-zero defaults or previously-merged values with 0 during subsequent merges. Consider applying the same conditional logic for uid/gid regardless of whether address is set (i.e., only set them in grpcConfig when non-zero), while keeping address emission gated on grpcAddress != "".

Suggested change
grpcConfig["uid"] = grpcUID
grpcConfig["gid"] = grpcGID
} else {
if grpcUID != 0 {
grpcConfig["uid"] = grpcUID
}
if grpcGID != 0 {
grpcConfig["gid"] = grpcGID
}
}
if grpcUID != 0 {
grpcConfig["uid"] = grpcUID
}
if grpcGID != 0 {
grpcConfig["gid"] = grpcGID

Copilot uses AI. Check for mistakes.
Comment thread cmd/containerd/server/config/config_test.go
@fuweid fuweid added this to the 2.3 milestone Apr 29, 2026

@prakleumas prakleumas left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

beep boop
Hello! I am @samuelkarp's friendly code review robot 🤖! Sam asked me to take a look and post my comments directly on GitHub.

Please treat my comments as suggestions and advisory, not mandates. Since I am an LLM and my output is used here directly, you should evaluate carefully and see if my suggestions make sense. Feel free to directly resolve any you disagree with.

This is not an automated action. This bot does not read or reply to comments.

Comment thread cmd/containerd/server/config/config_test.go Outdated
Comment thread cmd/containerd/server/config/config_test.go Outdated

@samuelkarp samuelkarp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Bot comments are reasonable suggestions, otherwise LGTM.

When migrating v3 [grpc] config to the v4 server plugin config, only
emit fields that were actually set in the legacy config. This prevents
a sparse imported [grpc] section, such as one only setting
max_send_message_size, from generating address = "" and overwriting the
address migrated from the root config.

Add table-driven coverage for sparse legacy grpc imports, including
address preservation, imported address override, and default address
retention when no imported config specifies address.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
Copilot AI review requested due to automatic review settings April 29, 2026 17:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-project-automation github-project-automation Bot moved this from Needs Triage to Review In Progress in Pull Request Review Apr 29, 2026
@dmcgowan dmcgowan added this pull request to the merge queue Apr 29, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 29, 2026
@dmcgowan dmcgowan added this pull request to the merge queue Apr 29, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 30, 2026
@dmcgowan dmcgowan added this pull request to the merge queue Apr 30, 2026
Merged via the queue into containerd:main with commit ee17fa1 Apr 30, 2026
58 checks passed
@github-project-automation github-project-automation Bot moved this from Review In Progress to Done in Pull Request Review Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[v2.3.0-rc.0] containerd socket is not created with old config.toml

6 participants