From ac620bad1ded700d902044027916f007a7e8a547 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Thu, 22 Oct 2026 12:07:32 -0400 Subject: [PATCH] docs(api): Define Accepted on network resources The NetworkService and NetworkEgressPolicy type and field docs said an admission webhook verifies that the requester owns the referenced VPC before the object is accepted, and that the OwnershipVerified and OwnershipDenied reasons come from it. No such webhook exists and nothing sets those reasons. On a NetworkService the controller sets Accepted to True once a gateway node is registered in the namespace, and the platform API that serves tenants checks VPC ownership before it writes the service. Nothing sets any condition on a NetworkEgressPolicy. A client reading the CRD descriptions would take Accepted as proof of ownership, which it is not. Describe the actual contract on both kinds and their vpcRef fields, mark the two reason constants as reserved, point NetworkEgressPolicy's conditions at the reason constant instead of rule_types.go, which no longer exists, and drop the gateway architecture note that called these comments stale. The constants stay, since the tenant-facing API may still set them. The CRD descriptions and API reference are regenerated with the pinned controller-gen. Related to #708 Co-Authored-By: Claude Opus 5.5 --- api/network/v1alpha1/egresspolicy_types.go | 27 +++++++------- api/network/v1alpha1/networkservice_types.go | 37 +++++++++++-------- ...c.datumapis.com_networkegresspolicies.yaml | 27 +++++++------- ...alactic.datumapis.com_networkservices.yaml | 17 +++++---- docs/agents/ARCHITECTURE-GATEWAY.md | 2 +- docs/api/network-gateway.md | 36 +++++++++--------- 6 files changed, 76 insertions(+), 70 deletions(-) diff --git a/api/network/v1alpha1/egresspolicy_types.go b/api/network/v1alpha1/egresspolicy_types.go index 122c8573a..81412425b 100644 --- a/api/network/v1alpha1/egresspolicy_types.go +++ b/api/network/v1alpha1/egresspolicy_types.go @@ -12,14 +12,14 @@ import ( // of an egress flow is an arbitrary internet address, not a pre-configured // backend list. // -// It is namespaced (deployed to galactic-system) and tenant-writable; like -// NetworkService's vpcRef, vpcRef/vpcAttachmentRef are opaque string identifiers -// because this kind carries identifiers from the VPC API in -// api/cloud/v1alpha1 without a Kubernetes object reference. An admission webhook (implemented by the consuming controller) must -// verify the requester is authorized for vpcRef/vpcAttachmentRef before a -// policy is accepted — see the Accepted condition. +// It is namespaced (deployed to galactic-system), and RBAC on the namespace +// decides who may write it. Like NetworkService's vpcRef, vpcRef and +// vpcAttachmentRef are opaque string identifiers because this kind carries +// identifiers from the VPC API in api/cloud/v1alpha1 without a Kubernetes +// object reference. Galactic does not check that the writer is authorized for +// them, and nothing in this repository sets the Accepted condition. // -// Presence of an accepted NetworkEgressPolicy resolves only *enablement* +// Presence of a NetworkEgressPolicy resolves only *enablement* // (should this tenant's VRF get an egress route toward the shared // translation tier at all) — unlike this type's original design (superseded), there is // no single "assigned gateway node" to compute or pin: any EgressShard may @@ -50,16 +50,15 @@ type NetworkEgressPolicy struct { type NetworkEgressPolicySpec struct { // VPCRef is the opaque identifier of the target VPC this policy applies // to. This repo does not own the VPC API and does not validate the - // identifier beyond non-emptiness; the admission webhook of the - // consuming controller is responsible for verifying the requester is - // authorized for this VPC before the policy is accepted. + // identifier beyond non-emptiness, or check that the writer is + // authorized for this VPC. // +kubebuilder:validation:Required // +kubebuilder:validation:MinLength=1 VPCRef string `json:"vpcRef"` // VPCAttachmentRef is the opaque identifier of the target // VPCAttachment this policy applies to. Like VPCRef, this is an opaque - // string reference validated by the admission webhook, not by this API. + // string reference that this API checks only for non-emptiness. // +kubebuilder:validation:Required // +kubebuilder:validation:MinLength=1 VPCAttachmentRef string `json:"vpcAttachmentRef"` @@ -72,9 +71,9 @@ type NetworkEgressPolicyStatus struct { // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty"` - // Conditions contains the standard conditions for this resource, - // including Accepted (see AcceptedReasonOwnershipVerified / - // AcceptedReasonOwnershipDenied in rule_types.go, reused as-is here). + // Conditions contains the standard conditions for this resource. Nothing + // in this repository sets them. Accepted, when set, uses the ownership + // reasons shared with NetworkService (see AcceptedReasonOwnershipVerified). // // +listType=map // +listMapKey=type diff --git a/api/network/v1alpha1/networkservice_types.go b/api/network/v1alpha1/networkservice_types.go index 396850b52..18209e77d 100644 --- a/api/network/v1alpha1/networkservice_types.go +++ b/api/network/v1alpha1/networkservice_types.go @@ -39,28 +39,34 @@ const ( NetworkServiceProtocolICMP NetworkServiceProtocol = "icmp" ) -// Accepted reasons — used as Accepted.Reason on NetworkService (and reused by -// NetworkEgressPolicy), set by the admission webhook that verifies the -// requester is authorized for the VPC resources the object references. +// Ownership reasons for the Accepted condition on NetworkService and +// NetworkEgressPolicy, reserved for an admission check that verifies the +// requester is authorized for the VPC resources the object references. No such +// check runs in this repository and nothing sets these reasons. On a +// NetworkService, Accepted reports only that a gateway node is registered in +// its namespace. const ( - // AcceptedReasonOwnershipVerified indicates admission verified the - // requester is authorized for the VPC resources the object references. + // AcceptedReasonOwnershipVerified is reserved for an admission check that + // found the requester authorized for the VPC resources the object + // references. AcceptedReasonOwnershipVerified string = "OwnershipVerified" - // AcceptedReasonOwnershipDenied indicates admission rejected the object - // because the requester is not authorized for the VPC resources it - // references. + // AcceptedReasonOwnershipDenied is reserved for an admission check that + // rejected the object because the requester is not authorized for the VPC + // resources it references. AcceptedReasonOwnershipDenied string = "OwnershipDenied" ) // NetworkService defines ingress load-balancing for a single tenant VPC, served // by every NetworkGateway node identically (anycast Direct Server Return — // see NetworkGateway's doc comment). It is namespaced (deployed to -// galactic-system) and tenant-writable; vpcRef is an opaque string identifier -// because this kind carries identifiers from the VPC API in -// api/cloud/v1alpha1 without a Kubernetes object reference. An admission webhook (implemented by the consuming controller) must -// verify the requester is authorized for vpcRef before a service is accepted — -// see the Accepted condition. +// galactic-system) and written by the platform API that serves tenants, which +// verifies the tenant owns vpcRef before it writes the service; RBAC on the +// namespace decides who else may write it. vpcRef is an opaque string +// identifier because this kind carries identifiers from the VPC API in +// api/cloud/v1alpha1 without a Kubernetes object reference. Accepted is set +// once a gateway node is registered in the namespace and is not an ownership +// check. // // Unlike the earlier Full-NAT design this type originally described, there // is no primary/secondary gateway node for a service: every NetworkGateway @@ -101,9 +107,8 @@ type NetworkService struct { type NetworkServiceSpec struct { // VPCRef is the opaque identifier of the target VPC this service applies // to. This repo does not own the VPC API and does not validate the - // identifier beyond non-emptiness; the admission webhook of the - // consuming controller is responsible for verifying the requester is - // authorized for this VPC before the service is accepted. + // identifier beyond non-emptiness. The platform API that serves tenants + // verifies the tenant owns this VPC before it writes the service. // +kubebuilder:validation:Required // +kubebuilder:validation:MinLength=1 VPCRef string `json:"vpcRef"` diff --git a/config/crd/galactic.datumapis.com_networkegresspolicies.yaml b/config/crd/galactic.datumapis.com_networkegresspolicies.yaml index 12012f86d..586bce97a 100644 --- a/config/crd/galactic.datumapis.com_networkegresspolicies.yaml +++ b/config/crd/galactic.datumapis.com_networkegresspolicies.yaml @@ -38,14 +38,14 @@ spec: of an egress flow is an arbitrary internet address, not a pre-configured backend list. - It is namespaced (deployed to galactic-system) and tenant-writable; like - NetworkService's vpcRef, vpcRef/vpcAttachmentRef are opaque string identifiers - because this kind carries identifiers from the VPC API in - api/cloud/v1alpha1 without a Kubernetes object reference. An admission webhook (implemented by the consuming controller) must - verify the requester is authorized for vpcRef/vpcAttachmentRef before a - policy is accepted — see the Accepted condition. + It is namespaced (deployed to galactic-system), and RBAC on the namespace + decides who may write it. Like NetworkService's vpcRef, vpcRef and + vpcAttachmentRef are opaque string identifiers because this kind carries + identifiers from the VPC API in api/cloud/v1alpha1 without a Kubernetes + object reference. Galactic does not check that the writer is authorized for + them, and nothing in this repository sets the Accepted condition. - Presence of an accepted NetworkEgressPolicy resolves only *enablement* + Presence of a NetworkEgressPolicy resolves only *enablement* (should this tenant's VRF get an egress route toward the shared translation tier at all) — unlike this type's original design (superseded), there is no single "assigned gateway node" to compute or pin: any EgressShard may @@ -83,16 +83,15 @@ spec: description: |- VPCAttachmentRef is the opaque identifier of the target VPCAttachment this policy applies to. Like VPCRef, this is an opaque - string reference validated by the admission webhook, not by this API. + string reference that this API checks only for non-emptiness. minLength: 1 type: string vpcRef: description: |- VPCRef is the opaque identifier of the target VPC this policy applies to. This repo does not own the VPC API and does not validate the - identifier beyond non-emptiness; the admission webhook of the - consuming controller is responsible for verifying the requester is - authorized for this VPC before the policy is accepted. + identifier beyond non-emptiness, or check that the writer is + authorized for this VPC. minLength: 1 type: string required: @@ -106,9 +105,9 @@ spec: properties: conditions: description: |- - Conditions contains the standard conditions for this resource, - including Accepted (see AcceptedReasonOwnershipVerified / - AcceptedReasonOwnershipDenied in rule_types.go, reused as-is here). + Conditions contains the standard conditions for this resource. Nothing + in this repository sets them. Accepted, when set, uses the ownership + reasons shared with NetworkService (see AcceptedReasonOwnershipVerified). items: description: Condition contains details for one aspect of the current state of this API Resource. diff --git a/config/crd/galactic.datumapis.com_networkservices.yaml b/config/crd/galactic.datumapis.com_networkservices.yaml index b07d74227..4f3773be1 100644 --- a/config/crd/galactic.datumapis.com_networkservices.yaml +++ b/config/crd/galactic.datumapis.com_networkservices.yaml @@ -36,11 +36,13 @@ spec: NetworkService defines ingress load-balancing for a single tenant VPC, served by every NetworkGateway node identically (anycast Direct Server Return — see NetworkGateway's doc comment). It is namespaced (deployed to - galactic-system) and tenant-writable; vpcRef is an opaque string identifier - because this kind carries identifiers from the VPC API in - api/cloud/v1alpha1 without a Kubernetes object reference. An admission webhook (implemented by the consuming controller) must - verify the requester is authorized for vpcRef before a service is accepted — - see the Accepted condition. + galactic-system) and written by the platform API that serves tenants, which + verifies the tenant owns vpcRef before it writes the service; RBAC on the + namespace decides who else may write it. vpcRef is an opaque string + identifier because this kind carries identifiers from the VPC API in + api/cloud/v1alpha1 without a Kubernetes object reference. Accepted is set + once a gateway node is registered in the namespace and is not an ownership + check. Unlike the earlier Full-NAT design this type originally described, there is no primary/secondary gateway node for a service: every NetworkGateway @@ -234,9 +236,8 @@ spec: description: |- VPCRef is the opaque identifier of the target VPC this service applies to. This repo does not own the VPC API and does not validate the - identifier beyond non-emptiness; the admission webhook of the - consuming controller is responsible for verifying the requester is - authorized for this VPC before the service is accepted. + identifier beyond non-emptiness. The platform API that serves tenants + verifies the tenant owns this VPC before it writes the service. minLength: 1 type: string required: diff --git a/docs/agents/ARCHITECTURE-GATEWAY.md b/docs/agents/ARCHITECTURE-GATEWAY.md index 2a98d6fad..3c55a9391 100644 --- a/docs/agents/ARCHITECTURE-GATEWAY.md +++ b/docs/agents/ARCHITECTURE-GATEWAY.md @@ -1037,7 +1037,7 @@ that tag into `config/galactic-gateway/base`. ## Known Constraints - **E2E coverage is lab-only.** `task verify:gateway-ingress` and `task verify:gateway-ingress-ipv4` in `deploy/containerlab/` send real traffic through every lab gateway node (see [Testing](#testing)). Before it, the `gatewayDatapathKeepAlive` incident described in [Entry Points](#cmd-galactic-gatewaygateway-go--datapath-setup) above was only discovered because ingress traffic silently stopped being intercepted. Nothing runs that check in CI, since it needs the containerlab lab. -- **Galactic does not check VPC ownership on `NetworkService`.** `NetworkService` is internal: the platform API that serves tenants verifies the tenant owns `vpcRef` before it writes the rule, and RBAC on `galactic-system` decides who else can write one. `updateAcceptedCondition` sets `Accepted=True` once gateway nodes exist for the namespace; it is not an ownership result. galactic-router used to carry an allow-all admission webhook for this, never deployed, removed in #366. The `api/network/v1alpha1` doc comments still call the CRD tenant-writable and define `OwnershipVerified`/`OwnershipDenied` reasons nothing sets. +- **Galactic does not check VPC ownership on `NetworkService`.** `NetworkService` is internal: the platform API that serves tenants verifies the tenant owns `vpcRef` before it writes the rule, and RBAC on `galactic-system` decides who else can write one. `updateAcceptedCondition` sets `Accepted=True` once gateway nodes exist for the namespace; it is not an ownership result. galactic-router used to carry an allow-all admission webhook for this, never deployed, removed in #366. The `OwnershipVerified`/`OwnershipDenied` reasons in `api/network/v1alpha1` are reserved, and nothing sets them. - **The uSID backend resolver's tenant-ownership check depends on `BGPVRFInstance` naming staying deterministic.** `verifyTenantOwnership` closes the ambiguous-match gap an earlier version of this resolver had, but it is only as strong as `crdnames.BGPVRFInstanceName(vpc, nodeName)` staying the exact name `galactic-bgp` writes — a divergence between the two would fail closed (a real backend never resolving) rather than open (a wrong-tenant resolve), which is the safer failure direction but still worth knowing about when either side of that naming contract changes. - **The derived SRv6 encap source is read once, at startup.** Changing a gateway node's `BGPRouter` locator or node ID does not move its encapsulation source until `galactic-gateway` restarts. See [SRv6 encap-source address](#srv6-encap-source-address) above. - **`edge_return` sends no ICMP for an oversized reply.** `edge_lb` answers a packet too big for the fabric once encapsulated: an IPv6 client with a Packet Too Big (`send_too_big6`), an IPv4 client that set Don't Fragment with a Fragmentation Needed (`send_frag_needed4`, for a header without options, which is all a fixed-size quote covers). An IPv4 packet without Don't Fragment, or with options, is counted as `fib_frag_needed` and dropped: a router would fragment the first, which XDP cannot. `edge_return` drops an oversized reply the same way for both families; the backend's MSS clamp keeps TCP replies under the fabric MTU. ICMP a client sends to a VIP is not claimed, so path MTU discovery from the client toward a backend is not relayed. diff --git a/docs/api/network-gateway.md b/docs/api/network-gateway.md index c744941ef..24664b157 100644 --- a/docs/api/network-gateway.md +++ b/docs/api/network-gateway.md @@ -220,14 +220,14 @@ existence-implies-enabled, not a per-flow rule — because the destination of an egress flow is an arbitrary internet address, not a pre-configured backend list. -It is namespaced (deployed to galactic-system) and tenant-writable; like -NetworkService's vpcRef, vpcRef/vpcAttachmentRef are opaque string identifiers -because this kind carries identifiers from the VPC API in -api/cloud/v1alpha1 without a Kubernetes object reference. An admission webhook (implemented by the consuming controller) must -verify the requester is authorized for vpcRef/vpcAttachmentRef before a -policy is accepted — see the Accepted condition. - -Presence of an accepted NetworkEgressPolicy resolves only *enablement* +It is namespaced (deployed to galactic-system), and RBAC on the namespace +decides who may write it. Like NetworkService's vpcRef, vpcRef and +vpcAttachmentRef are opaque string identifiers because this kind carries +identifiers from the VPC API in api/cloud/v1alpha1 without a Kubernetes +object reference. Galactic does not check that the writer is authorized for +them, and nothing in this repository sets the Accepted condition. + +Presence of a NetworkEgressPolicy resolves only *enablement* (should this tenant's VRF get an egress route toward the shared translation tier at all) — unlike this type's original design (superseded), there is no single "assigned gateway node" to compute or pin: any EgressShard may @@ -268,8 +268,8 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | -| `vpcRef` _string_ | VPCRef is the opaque identifier of the target VPC this policy applies
to. This repo does not own the VPC API and does not validate the
identifier beyond non-emptiness; the admission webhook of the
consuming controller is responsible for verifying the requester is
authorized for this VPC before the policy is accepted. | | MinLength: 1
Required: \{\}
| -| `vpcAttachmentRef` _string_ | VPCAttachmentRef is the opaque identifier of the target
VPCAttachment this policy applies to. Like VPCRef, this is an opaque
string reference validated by the admission webhook, not by this API. | | MinLength: 1
Required: \{\}
| +| `vpcRef` _string_ | VPCRef is the opaque identifier of the target VPC this policy applies
to. This repo does not own the VPC API and does not validate the
identifier beyond non-emptiness, or check that the writer is
authorized for this VPC. | | MinLength: 1
Required: \{\}
| +| `vpcAttachmentRef` _string_ | VPCAttachmentRef is the opaque identifier of the target
VPCAttachment this policy applies to. Like VPCRef, this is an opaque
string reference that this API checks only for non-emptiness. | | MinLength: 1
Required: \{\}
| #### NetworkEgressPolicyStatus @@ -287,7 +287,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | | `observedGeneration` _integer_ | ObservedGeneration is the .metadata.generation this status was computed from. | | | -| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#condition-v1-meta) array_ | Conditions contains the standard conditions for this resource,
including Accepted (see AcceptedReasonOwnershipVerified /
AcceptedReasonOwnershipDenied in rule_types.go, reused as-is here). | | | +| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#condition-v1-meta) array_ | Conditions contains the standard conditions for this resource. Nothing
in this repository sets them. Accepted, when set, uses the ownership
reasons shared with NetworkService (see AcceptedReasonOwnershipVerified). | | | #### NetworkGateway @@ -368,11 +368,13 @@ _Appears in:_ NetworkService defines ingress load-balancing for a single tenant VPC, served by every NetworkGateway node identically (anycast Direct Server Return — see NetworkGateway's doc comment). It is namespaced (deployed to -galactic-system) and tenant-writable; vpcRef is an opaque string identifier -because this kind carries identifiers from the VPC API in -api/cloud/v1alpha1 without a Kubernetes object reference. An admission webhook (implemented by the consuming controller) must -verify the requester is authorized for vpcRef before a service is accepted — -see the Accepted condition. +galactic-system) and written by the platform API that serves tenants, which +verifies the tenant owns vpcRef before it writes the service; RBAC on the +namespace decides who else may write it. vpcRef is an opaque string +identifier because this kind carries identifiers from the VPC API in +api/cloud/v1alpha1 without a Kubernetes object reference. Accepted is set +once a gateway node is registered in the namespace and is not an ownership +check. Unlike the earlier Full-NAT design this type originally described, there is no primary/secondary gateway node for a service: every NetworkGateway @@ -447,7 +449,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | -| `vpcRef` _string_ | VPCRef is the opaque identifier of the target VPC this service applies
to. This repo does not own the VPC API and does not validate the
identifier beyond non-emptiness; the admission webhook of the
consuming controller is responsible for verifying the requester is
authorized for this VPC before the service is accepted. | | MinLength: 1
Required: \{\}
| +| `vpcRef` _string_ | VPCRef is the opaque identifier of the target VPC this service applies
to. This repo does not own the VPC API and does not validate the
identifier beyond non-emptiness. The platform API that serves tenants
verifies the tenant owns this VPC before it writes the service. | | MinLength: 1
Required: \{\}
| | `vipAddresses` _string array_ | VIPAddresses is the list of ingress VIP addresses this service provisions
on the gateway nodes: at most one IPv6 and at most one IPv4 address.
A backend node rewrites a reply's source from the backend's address, port
and protocol back to a single VIP of the client's family, so a backend
cannot answer for a second VIP of one family. Another VIP of a family
needs its own service whose backends listen on a different BackendPort.
An IPv4 VIP is written in dotted form; the IPv4-mapped IPv6 form is
refused.
Workloads are IPv6 only, so both VIPs are served by the selected
attachments' IPv6 addresses. A backend node translates the IPv4 VIP's
flows statelessly: the backend sees an IPv4 client a.b.c.d as
64:ff9b::a.b.c.d (RFC 6052) and replies to that address, and its node
sends the reply back to the client as IPv4 from the VIP. A gateway node
serves the IPv4 VIP only while it has IPv4 VIPs turned on, and
load-balances it only over the backends whose ServiceVIPBinding for it
reports Bound. It advertises the IPv4 VIP while at least one such
backend exists, and reports the outcome in its "/IPv4Served"
condition. The IPv6 VIP is served independently of the IPv4 one.
An existing service whose list breaks these limits keeps validating while
the list is unchanged, since the API server ratchets validation of an
unchanged field on Kubernetes 1.30 and later; any edit to the list must
bring it within them, and an older API server refuses any update to such
a service. | | MaxItems: 8
MinItems: 1
Required: \{\}
items:MaxLength: 45
| | `protocol` _[NetworkServiceProtocol](#networkserviceprotocol)_ | Protocol is the IP protocol this service load-balances on VIPAddresses.
The API admits tcp, udp, sctp, esp, gre and icmp, and the gateway
datapath serves tcp and udp. A service with any other admitted value is
refused with a message saying its protocol is not served yet. sctp has
ports and needs Port and BackendPort. esp, gre and icmp have no ports
and must set neither; a backend for them is chosen from the client and
VIP addresses alone. The set of values is open-ended, so a client must
accept and preserve a value it does not recognise, as
NetworkServiceProtocol describes. | | Enum: [tcp udp sctp esp gre icmp]
Required: \{\}
| | `port` _integer_ | Port is the ingress port on VIPAddresses that this service load-balances,
1-65535. It is required for a protocol with ports (tcp, udp and sctp)
and must be unset for one without (esp, gre and icmp). Zero means unset
and is omitted when encoding, and an explicit 0 is refused. | | Maximum: 65535
Minimum: 1
|