Skip to content

Commit 0adb24e

Browse files
committed
Create IR struct to hold specs for extension features.
1 parent c626d14 commit 0adb24e

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

pkg/i2gw/provider.go

+84
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,90 @@ type GatewayResources struct {
101101
ReferenceGrants map[types.NamespacedName]gatewayv1beta1.ReferenceGrant
102102
}
103103

104+
// IR contains all Gateway-API objects, and Intermediate Representation(IR) to
105+
// hold specicifications on Gateway Objects for supporting Ingress extension
106+
// features. An feature on IR can be mapped to changes on Gateway-API objects,
107+
// or provider-specific Gateway extensions.
108+
type IR struct {
109+
Gateways map[types.NamespacedName]GatewayContext
110+
HTTPRoutes map[types.NamespacedName]HTTPRouteContext
111+
Services map[types.NamespacedName]ServiceIR
112+
113+
GatewayClasses map[types.NamespacedName]gatewayv1.GatewayClass
114+
TLSRoutes map[types.NamespacedName]gatewayv1alpha2.TLSRoute
115+
TCPRoutes map[types.NamespacedName]gatewayv1alpha2.TCPRoute
116+
UDPRoutes map[types.NamespacedName]gatewayv1alpha2.UDPRoute
117+
118+
ReferenceGrants map[types.NamespacedName]gatewayv1beta1.ReferenceGrant
119+
}
120+
121+
// GatewayContext contains the Gateway-API Gateway object, along with a
122+
// dedicated field for each provider to specify their extension features on
123+
// Gateway.
124+
// The IR will contain necessary information to construct the Gateway
125+
// extensions, but not the extensions themselves.
126+
type GatewayContext struct {
127+
gatewayv1.Gateway
128+
129+
Apisix *ApisixGatewayIR
130+
GCE *GceGatewayIR
131+
IngressNginx *IngressNginxGatewayIR
132+
Istio *IstioGatewayIR
133+
Kong *KongGatewayIR
134+
Openapi3 *Openapi3GatewayIR
135+
}
136+
137+
// HTTPRouteContext contains the Gateway-API HTTPRoute object, along with a
138+
// dedicated field for each provider to specify their extension features on
139+
// HTTPRoute.
140+
// The IR will contain necessary information to construct the HTTPRoute
141+
// extensions, but not the extensions themselves.
142+
type HTTPRouteContext struct {
143+
gatewayv1.HTTPRoute
144+
145+
Apisix *ApisixHTTPRouteIR
146+
Gce *GceHTTPRouteIR
147+
IngressNginx *IngressNginxHTTPRouteIR
148+
Istio *IstioHTTPRouteIR
149+
Kong *KongHTTPRouteIR
150+
Openapi3 *Openapi3HTTPRouteIR
151+
}
152+
153+
// ServiceIR contains a dedicated field for each provider to specify their
154+
// extension features on Service.
155+
type ServiceIR struct {
156+
Apisix *ApisixServiceIR
157+
Gce *GceServiceIR
158+
IngressNginx *IngressNginxServiceIR
159+
Istio *IstioServiceIR
160+
Kong *KongServiceIR
161+
Openapi3 *Openapi3ServiceIR
162+
}
163+
164+
type ApisixGatewayIR struct{}
165+
type ApisixHTTPRouteIR struct{}
166+
type ApisixServiceIR struct{}
167+
168+
type GceGatewayIR struct{}
169+
type GceHTTPRouteIR struct{}
170+
type GceServiceIR struct{}
171+
172+
type IngressNginxGatewayIR struct{}
173+
type IngressNginxHTTPRouteIR struct{}
174+
type IngressNginxServiceIR struct{}
175+
176+
type IstioGatewayIR struct{}
177+
type IstioHTTPRouteIR struct{}
178+
type IstioServiceIR struct{}
179+
180+
type KongGatewayIR struct{}
181+
type KongHTTPRouteIR struct{}
182+
type KongServiceIR struct{}
183+
184+
type Openapi3GatewayIR struct{}
185+
type Openapi3HTTPRouteIR struct{}
186+
type Openapi3ServiceIR struct{}
187+
104188
// FeatureParser is a function that reads the Ingresses, and applies
105189
// the appropriate modifications to the GatewayResources.
106190
//

0 commit comments

Comments
 (0)