feat: add veth pair support#13816
Conversation
96f0370 to
b0d1a3b
Compare
There was a problem hiding this comment.
Pull request overview
Adds first-class support for declaratively managing Linux veth pairs via a new VethConfig machine config document, wiring it through config parsing, schema/doc generation, runtime resources, and network controllers.
Changes:
- Introduces
VethConfigmachine config type (with validation), schema/doc output, and release notes. - Adds
VethPairSpec/VethPairStateresources and controllers to create/track veth pairs and project per-endpointLinkSpecs. - Updates link/config controllers and integration tests to incorporate veth pair lifecycle, rename, VRF composition, and cleanup.
Reviewed changes
Copilot reviewed 38 out of 42 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| website/content/v1.14/schemas/config.schema.json | Publishes VethConfig/VethPeerConfig into the v1.14 website schema bundle. |
| website/content/v1.14/reference/configuration/network/vethconfig.md | Adds generated documentation page for VethConfig. |
| website/content/v1.14/reference/api.md | Extends API reference to include veth-related resource specs. |
| pkg/machinery/resources/network/veth_pair_state.go | Adds VethPairState typed resource definition and dynamic protobuf registration. |
| pkg/machinery/resources/network/veth_pair_spec.go | Adds VethPairSpec typed resource definition, endpoint spec type, and canonical ID helpers. |
| pkg/machinery/resources/network/veth_pair_spec_test.go | Unit tests for veth pair canonicalization, IDs, and state resource basics. |
| pkg/machinery/resources/network/network.go | Adds LinkKindVeth constant. |
| pkg/machinery/resources/network/link_spec.go | Extends LinkSpecSpec with a Veth field and merge handling. |
| pkg/machinery/resources/network/link_spec_test.go | Updates YAML marshal test to include veth block. |
| pkg/machinery/resources/network/deep_copy.generated.go | Regenerates deep-copy implementations for new veth-related spec structs. |
| pkg/machinery/resources/network/address_spec.go | Updates deep-copy generator invocation to include veth-related types. |
| pkg/machinery/config/types/network/veth.go | Implements VethConfigV1Alpha1 config document, validation, and peer endpoint wrapper. |
| pkg/machinery/config/types/network/veth_test.go | Adds marshal/unmarshal stability and validation tests for VethConfig. |
| pkg/machinery/config/types/network/testdata/vethconfig.yaml | Adds expected YAML fixture for VethConfig encoding tests. |
| pkg/machinery/config/types/network/network.go | Adds veth.go to docgen and deep-copy generation inputs. |
| pkg/machinery/config/types/network/network_doc.go | Adds generated doc metadata for VethConfig and VethPeerConfig. |
| pkg/machinery/config/types/network/link.go | Adds VethKind to conflicting link kinds list. |
| pkg/machinery/config/types/network/deep_copy.generated.go | Regenerates deep-copy for config types including VethConfigV1Alpha1. |
| pkg/machinery/config/schemas/config.schema.json | Publishes VethConfig/VethPeerConfig into the machinery schema bundle. |
| pkg/machinery/config/container/container.go | Adds veth-aware link-name conflict detection and exposes veth configs + peer as link configs. |
| pkg/machinery/config/container/container_test.go | Tests veth link config enumeration and conflict behavior. |
| pkg/machinery/config/config/network.go | Introduces NetworkVethConfig/NetworkVethLinkConfig interfaces. |
| pkg/machinery/config/config/config.go | Adds NetworkVethConfigs() to the main config interface. |
| pkg/machinery/api/resource/definitions/network/network.pb.go | Regenerates protobuf Go bindings for new veth-related messages/fields. |
| pkg/machinery/api/resource/definitions/network/network_vtproto.pb.go | Regenerates vtproto fast-path bindings for new veth-related messages/fields. |
| internal/integration/api/network-config.go | Adds integration test covering veth create/rename, VRF composition, and cleanup. |
| internal/app/machined/pkg/runtime/v1alpha2/v1alpha2_state.go | Registers VethPairSpec and VethPairState resources in runtime state. |
| internal/app/machined/pkg/runtime/v1alpha2/v1alpha2_controller.go | Wires new veth controllers into the runtime controller set. |
| internal/app/machined/pkg/controllers/network/veth_pair_spec.go | Adds controller projecting VethPairSpec into endpoint LinkSpecs. |
| internal/app/machined/pkg/controllers/network/veth_pair_spec_test.go | Adds controller-level tests for veth pair lifecycle and edge cases. |
| internal/app/machined/pkg/controllers/network/veth_integration_test.go | Adds end-to-end tests for veth pair lifecycle driven by machine config. |
| internal/app/machined/pkg/controllers/network/veth_config.go | Adds controller rendering VethConfig into VethPairSpec. |
| internal/app/machined/pkg/controllers/network/veth_config_test.go | Tests projection from machine config to VethPairSpec and literal endpoint naming. |
| internal/app/machined/pkg/controllers/network/link_spec.go | Extends link reconciliation to create/cleanup veth pairs and track VethPairState. |
| internal/app/machined/pkg/controllers/network/link_spec_test.go | Adds tests for veth handling in LinkSpecController. |
| internal/app/machined/pkg/controllers/network/link_config.go | Skips veth endpoints in LinkConfig processing (veth endpoints are literal / handled elsewhere). |
| internal/app/machined/pkg/controllers/network/link_config_test.go | Adds VRF + veth new-style machine configuration test coverage. |
| internal/app/machined/pkg/controllers/network/address_config_test.go | Adds address config projection coverage for veth endpoints. |
| internal/app/machined/pkg/adapters/network/veth_pair_spec.go | Adds rtnetlink attribute encoding helper for veth peer creation. |
| internal/app/machined/pkg/adapters/network/veth_pair_spec_test.go | Unit tests for veth rtnetlink attribute encoding. |
| hack/release.toml | Adds release notes entry documenting the new VethConfig feature. |
| api/resource/definitions/network/network.proto | Adds protobuf message definitions/fields for veth-related specs. |
Files not reviewed (4)
- pkg/machinery/api/resource/definitions/network/network.pb.go: Generated file
- pkg/machinery/api/resource/definitions/network/network_vtproto.pb.go: Generated file
- pkg/machinery/config/types/network/deep_copy.generated.go: Generated file
- pkg/machinery/config/types/network/network_doc.go: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add a new `VethConfig` machine config document to support veth pairs. Fixes: siderolabs#12859 Signed-off-by: Noel Georgi <git@frezbo.dev>
b0d1a3b to
ac1f2f0
Compare
| return multiErr.ErrorOrNil() | ||
| } | ||
|
|
||
| func (ctrl *LinkSpecController) cleanupVethPairStates( |
There was a problem hiding this comment.
I think it's crazy that this code is here... I don't think this controller should ever produce any state
There was a problem hiding this comment.
the change here seems to be too complicated compared to what it should be imho
I don't see why veth is so much special - it's basically two LinkSpecs. what is there that needs to be handled very different?
The status of veth pairs should be/can be observed via LinkStatus, as this would cover links which were not created by Talos
There was a problem hiding this comment.
Or we could create VethPairStatus out of LinkStatus if we want to
| } | ||
| } | ||
|
|
||
| if linkConfig, ok := d.(config.NetworkCommonLinkConfig); ok { |
There was a problem hiding this comment.
I think this is too specific for a single type, instead we should in the common block handle the fact that Veth basically has two names - one for itself and another for the peer
There was a problem hiding this comment.
we could test for a specific small interface for the document to claim another name I think
| // | ||
| //gotagsrewrite:gen | ||
| type VethSpec struct { | ||
| PeerName string `yaml:"peerName,omitempty" protobuf:"1"` |
There was a problem hiding this comment.
link_status should have a matching change
| const VethPairStateType = resource.Type("VethPairStates.net.talos.dev") | ||
|
|
||
| // VethPairState records a veth pair managed by LinkSpecController. | ||
| type VethPairState = typed.Resource[VethPairStateSpec, VethPairStateExtension] |
There was a problem hiding this comment.
| type VethPairState = typed.Resource[VethPairStateSpec, VethPairStateExtension] | |
| type VethPairStatus = typed.Resource[VethPairStateSpec, VethPairStateExtension] |
we use Status everywhere
Not sure what is the ID of the resource? Do we create to resources per pair?
Add `CRICustomizationConfig` and `CRIBaseRuntimeSpecConfig` documents with automatic CRI regeneration and restart. Deprecate `machine.files` and `machine.baseRuntimeSpecOverrides` while preserving legacy compatibility. Fixes: siderolabs#13816 Signed-off-by: Noel Georgi <git@frezbo.dev>
Add `CRICustomizationConfig` and `CRIBaseRuntimeSpecConfig` documents with automatic CRI regeneration and restart. Deprecate `machine.files` and `machine.baseRuntimeSpecOverrides` while preserving legacy compatibility. Fixes: siderolabs#13816 Signed-off-by: Noel Georgi <git@frezbo.dev>
Add a new
VethConfigmachine config document to support veth pairs.Fixes: #12859