From 398678ba4bf809b6d3903271caafb3b7911c3549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raphael=20Tom=C3=A9=20Santana?= Date: Wed, 22 Oct 2025 15:43:11 -0300 Subject: [PATCH 1/2] add constants for Route conditions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphael Tomé Santana --- .../src/apis/experimental/constants.rs | 29 ++++++++++++++++ gateway-api/src/apis/standard/constants.rs | 33 +++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/gateway-api/src/apis/experimental/constants.rs b/gateway-api/src/apis/experimental/constants.rs index 65653d9..5304179 100644 --- a/gateway-api/src/apis/experimental/constants.rs +++ b/gateway-api/src/apis/experimental/constants.rs @@ -91,3 +91,32 @@ impl std::fmt::Display for ListenerConditionReason { write!(f, "{:?}", self) } } + +#[derive(Debug, PartialEq, Eq)] +pub enum RouteConditionType { + Accepted, + ResolvedRefs, +} +impl std::fmt::Display for RouteConditionType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "{:?}", self) + } +} + +#[derive(Debug, PartialEq, Eq)] +pub enum RouteConditionReason { + Accepted, + NotAllowedByListeners, + NoMatchingListenerHostname, + UnsupportedValue, + Pending, + ResolvedRefs, + RefNotPermitted, + InvalidKind, + BackendNotFound, +} +impl std::fmt::Display for RouteConditionReason { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "{:?}", self) + } +} diff --git a/gateway-api/src/apis/standard/constants.rs b/gateway-api/src/apis/standard/constants.rs index 0403176..ecb0768 100644 --- a/gateway-api/src/apis/standard/constants.rs +++ b/gateway-api/src/apis/standard/constants.rs @@ -88,3 +88,36 @@ impl std::fmt::Display for ListenerConditionReason { write!(f, "{:?}", self) } } + +#[derive(Debug, PartialEq, Eq)] +pub enum RouteConditionType { + Accepted, + ResolvedRefs, + PartiallyInvalid, +} +impl std::fmt::Display for RouteConditionType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "{:?}", self) + } +} + +#[derive(Debug, PartialEq, Eq)] +pub enum RouteConditionReason { + Accepted, + NotAllowedByListeners, + NoMatchingListenerHostname, + NoMatchingParent, + UnsupportedValue, + Pending, + IncompatibleFilters, + ResolvedRefs, + RefNotPermitted, + InvalidKind, + BackendNotFound, + UnsupportedProtocol, +} +impl std::fmt::Display for RouteConditionReason { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "{:?}", self) + } +} From c220cc8337bb6d72c4f3b707443707285a637344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raphael=20Tom=C3=A9=20Santana?= Date: Wed, 22 Oct 2025 15:50:55 -0300 Subject: [PATCH 2/2] feat: add constants generator for Route conditions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphael Tomé Santana --- update.sh | 6 ++++++ xtask/src/main.rs | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/update.sh b/update.sh index 0852e28..0afe3d6 100755 --- a/update.sh +++ b/update.sh @@ -84,10 +84,13 @@ GATEWAY_CONDITION_CONSTANTS="GatewayConditionType=Programmed,Accepted,Ready" GATEWAY_REASON_CONSTANTS="GatewayConditionReason=Programmed,Invalid,NoResources,AddressNotAssigned,AddressNotUsable,Accepted,ListenersNotValid,Pending,UnsupportedAddress,InvalidParameters,Ready,ListenersNotReady" LISTENER_CONDITION_CONSTANTS="ListenerConditionType=Conflicted,Accepted,ResolvedRefs,Programmed,Ready" LISTENER_REASON_CONSTANTS="ListenerConditionReason=HostnameConflict,ProtocolConflict,NoConflicts,Accepted,PortUnavailable,UnsupportedProtocol,ResolvedRefs,InvalidCertificateRef,InvalidRouteKinds,RefNotPermitted,Programmed,Invalid,Pending,Ready" +ROUTE_CONDITION_CONSTANTS="RouteConditionType=Accepted,ResolvedRefs,PartiallyInvalid" +ROUTE_REASON_CONSTANTS="RouteConditionReason=Accepted,NotAllowedByListeners,NoMatchingListenerHostname,NoMatchingParent,UnsupportedValue,Pending,IncompatibleFilters,ResolvedRefs,RefNotPermitted,InvalidKind,BackendNotFound,UnsupportedProtocol" GATEWAY_CLASS_CONDITION_CONSTANTS=${GATEWAY_CLASS_CONDITION_CONSTANTS} GATEWAY_CLASS_REASON_CONSTANTS=${GATEWAY_CLASS_REASON_CONSTANTS} \ GATEWAY_CONDITION_CONSTANTS=${GATEWAY_CONDITION_CONSTANTS} GATEWAY_REASON_CONSTANTS=${GATEWAY_REASON_CONSTANTS} \ LISTENER_CONDITION_CONSTANTS=${LISTENER_CONDITION_CONSTANTS} LISTENER_REASON_CONSTANTS=${LISTENER_REASON_CONSTANTS} \ + ROUTE_CONDITION_CONSTANTS=${ROUTE_CONDITION_CONSTANTS} ROUTE_REASON_CONSTANTS=${ROUTE_REASON_CONSTANTS} \ cargo xtask gen_condition_constants >> $APIS_DIR/standard/constants.rs echo "pub mod constants;" >> $APIS_DIR/standard/mod.rs @@ -122,10 +125,13 @@ echo "mod enum_defaults;" >> $APIS_DIR/experimental/mod.rs # GatewayClass conditions vary between standard and experimental GATEWAY_CLASS_CONDITION_CONSTANTS="${GATEWAY_CLASS_CONDITION_CONSTANTS},SupportedVersion" GATEWAY_CLASS_REASON_CONSTANTS="${GATEWAY_CLASS_REASON_CONSTANTS},SupportedVersion,UnsupportedVersion" +ROUTE_CONDITION_CONSTANTS="RouteConditionType=Accepted,ResolvedRefs" +ROUTE_REASON_CONSTANTS="RouteConditionReason=Accepted,NotAllowedByListeners,NoMatchingListenerHostname,UnsupportedValue,Pending,ResolvedRefs,RefNotPermitted,InvalidKind,BackendNotFound" GATEWAY_CLASS_CONDITION_CONSTANTS=${GATEWAY_CLASS_CONDITION_CONSTANTS} GATEWAY_CLASS_REASON_CONSTANTS=${GATEWAY_CLASS_REASON_CONSTANTS} \ GATEWAY_CONDITION_CONSTANTS=${GATEWAY_CONDITION_CONSTANTS} GATEWAY_REASON_CONSTANTS=${GATEWAY_REASON_CONSTANTS} \ LISTENER_CONDITION_CONSTANTS=${LISTENER_CONDITION_CONSTANTS} LISTENER_REASON_CONSTANTS=${LISTENER_REASON_CONSTANTS} \ + ROUTE_CONDITION_CONSTANTS=${ROUTE_CONDITION_CONSTANTS} ROUTE_REASON_CONSTANTS=${ROUTE_REASON_CONSTANTS} \ cargo xtask gen_condition_constants >> $APIS_DIR/experimental/constants.rs echo "pub mod constants;" >> $APIS_DIR/experimental/mod.rs diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 875b406..aef81cc 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -31,6 +31,8 @@ fn gen_condition_constants() -> Result<(), DynError> { let gateway_reason_types = env::var("GATEWAY_REASON_CONSTANTS")?; let listener_condition_types = env::var("LISTENER_CONDITION_CONSTANTS")?; let listener_reason_types = env::var("LISTENER_REASON_CONSTANTS")?; + let route_condition_types = env::var("ROUTE_CONDITION_CONSTANTS")?; + let route_reason_types = env::var("ROUTE_REASON_CONSTANTS")?; let mut scope = Scope::new(); gen_const_enums(&mut scope, gateway_class_condition_types); @@ -39,6 +41,8 @@ fn gen_condition_constants() -> Result<(), DynError> { gen_const_enums(&mut scope, gateway_reason_types); gen_const_enums(&mut scope, listener_condition_types); gen_const_enums(&mut scope, listener_reason_types); + gen_const_enums(&mut scope, route_condition_types); + gen_const_enums(&mut scope, route_reason_types); println!("{}", gen_generated_file_warning()); println!("{}", scope.to_string()); Ok(())