diff --git a/components/schemas/containers/config/ContainerNetwork.yml b/components/schemas/containers/config/ContainerNetwork.yml index 51b85429..f40bdc31 100644 --- a/components/schemas/containers/config/ContainerNetwork.yml +++ b/components/schemas/containers/config/ContainerNetwork.yml @@ -24,7 +24,7 @@ properties: - "null" description: Custom network routes applied to the container's instances. items: - $ref: ./network/NetworkRoute.yml + $ref: ./network/NetworkRouteConfig.yml hostname: type: string description: The hostname for the given container. diff --git a/components/schemas/containers/config/network/NetworkRoute.yml b/components/schemas/containers/config/network/NetworkRoute.yml deleted file mode 100644 index 38d3ebcd..00000000 --- a/components/schemas/containers/config/network/NetworkRoute.yml +++ /dev/null @@ -1,18 +0,0 @@ -title: NetworkRoute -type: object -description: A single network route directing traffic for a destination network. -required: - - destination - - gateway -properties: - destination: - description: The destination network, in CIDR notation, that this route matches. - oneOf: - - $ref: ../../../Cidr.yml - - type: "null" - gateway: - description: The IP address that traffic matching the destination is forwarded to. - $ref: ../../../IpAddress.yml - interface: - type: string - description: The name of the network interface this route is bound to. diff --git a/components/schemas/containers/config/network/NetworkRouteConfig.yml b/components/schemas/containers/config/network/NetworkRouteConfig.yml new file mode 100644 index 00000000..680b08d4 --- /dev/null +++ b/components/schemas/containers/config/network/NetworkRouteConfig.yml @@ -0,0 +1,44 @@ +title: NetworkRouteConfig +type: object +description: A single network route directing traffic for a destination network. +required: + - destination + - source + - ensure_source_exists + - gateway +properties: + destination: + description: The destination network, in CIDR notation, that this route matches. + oneOf: + - $ref: ../../../Cidr.yml + - type: "null" + source: + description: >- + The source network, in CIDR notation, that this route applies to. + oneOf: + - $ref: ../../../Cidr.yml + - type: "null" + ensure_source_exists: + type: boolean + description: >- + When true, the source address is verified to exist on the host before + this route is applied. + family: + description: The IP protocol family this route applies to. + oneOf: + - type: string + enum: + - ipv4 + - ipv6 + - type: "null" + gateway: + description: The IP address that traffic matching the destination is forwarded to. + $ref: ../../../IpAddress.yml + nexthops: + type: array + description: Additional next hops for this route, used for multipath (ECMP) routing. + items: + $ref: ./NetworkRouteConfigNexthop.yml + interface: + type: string + description: The name of the network interface this route is bound to. diff --git a/components/schemas/containers/config/network/NetworkRouteConfigNexthop.yml b/components/schemas/containers/config/network/NetworkRouteConfigNexthop.yml new file mode 100644 index 00000000..94b80890 --- /dev/null +++ b/components/schemas/containers/config/network/NetworkRouteConfigNexthop.yml @@ -0,0 +1,17 @@ +title: NetworkRouteConfigNexthop +type: object +description: A single next hop for a multipath network route. +required: + - gateway +properties: + gateway: + description: The IP address of this next hop's gateway. + $ref: ../../../IpAddress.yml + hop_weight: + description: >- + The relative weight of this next hop when distributing traffic across + multiple next hops. + oneOf: + - type: integer + format: int64 + - type: "null" diff --git a/stackspec/schema/StackSpecContainerConfigNetwork.yml b/stackspec/schema/StackSpecContainerConfigNetwork.yml index 271ff39c..2300505b 100644 --- a/stackspec/schema/StackSpecContainerConfigNetwork.yml +++ b/stackspec/schema/StackSpecContainerConfigNetwork.yml @@ -38,11 +38,61 @@ properties: - $ref: ../../components/schemas/Cidr.yml - type: "null" - $ref: StackVariable.yml + source: + description: >- + The source network, in CIDR notation, that this route applies to. + Used for source-based (policy) routing. + oneOf: + - $ref: ../../components/schemas/Cidr.yml + - type: "null" + - $ref: StackVariable.yml + ensure_source_exists: + description: >- + When true, the source address is verified to exist on the host + before this route is applied. + oneOf: + - type: boolean + - $ref: StackVariable.yml + family: + description: The IP protocol family this route applies to. + oneOf: + - type: string + enum: + - ipv4 + - ipv6 + - type: "null" + - $ref: StackVariable.yml gateway: description: The IP address that traffic matching the destination is forwarded to. oneOf: - $ref: ../../components/schemas/IpAddress.yml - $ref: StackVariable.yml + nexthops: + description: Additional next hops for this route, used for multipath routing. + oneOf: + - type: array + items: + title: NetworkRouteNexthop + type: object + description: A single next hop for a multipath network route. + required: + - gateway + properties: + gateway: + description: The IP address of this next hop's gateway. + oneOf: + - $ref: ../../components/schemas/IpAddress.yml + - $ref: StackVariable.yml + hop_weight: + description: >- + The relative weight of this next hop when distributing + traffic across multiple next hops. + oneOf: + - type: integer + format: int64 + - type: "null" + - $ref: StackVariable.yml + - $ref: StackVariable.yml interface: description: The name of the network interface this route is bound to. oneOf: