tokers commented on a change in pull request #576:
URL:
https://github.com/apache/apisix-ingress-controller/pull/576#discussion_r665302140
##########
File path: pkg/kube/translation/apisix_route.go
##########
@@ -133,6 +134,150 @@ func (t *translator) translateHTTPRouteNotStrictly(ctx
*TranslateContext, ar *co
return nil
}
+func (t *translator) TranslateRouteV2beta1(ar *configv2beta1.ApisixRoute)
(*TranslateContext, error) {
+ ctx := &TranslateContext{
+ upstreamMap: make(map[string]struct{}),
+ }
+
+ if err := t.translateHTTPRouteV2beta1(ctx, ar); err != nil {
+ return nil, err
+ }
+ if err := t.translateStreamRoute(ctx, ar); err != nil {
+ return nil, err
+ }
+ return ctx, nil
+}
+
+func (t *translator) TranslateRouteV2beta1NotStrictly(ar
*configv2beta1.ApisixRoute) (*TranslateContext, error) {
+ ctx := &TranslateContext{
+ upstreamMap: make(map[string]struct{}),
+ }
+
+ if err := t.translateHTTPRouteV2beta1NotStrictly(ctx, ar); err != nil {
+ return nil, err
+ }
+ if err := t.translateStreamRouteNotStrictly(ctx, ar); err != nil {
+ return nil, err
+ }
+ return ctx, nil
+}
+
+func (t *translator) translateHTTPRouteV2beta1(ctx *TranslateContext, ar
*configv2beta1.ApisixRoute) error {
+ ruleNameMap := make(map[string]struct{})
+ for _, part := range ar.Spec.HTTP {
+ if _, ok := ruleNameMap[part.Name]; ok {
Review comment:
Can we encapsulate this logic? It's so similar to the one in `v2alpha1`.
##########
File path: pkg/kube/apisix/apis/config/v2beta1/types.go
##########
@@ -53,14 +55,14 @@ type ApisixRouteHTTP struct {
Priority int `json:"priority,omitempty"
yaml:"priority,omitempty"`
Match ApisixRouteHTTPMatch `json:"match,omitempty"
yaml:"match,omitempty"`
// Deprecated: Backend will be removed in the future, use Backends
instead.
- Backend ApisixRouteHTTPBackend `json:"backend" yaml:"backend"`
+ Backend v2alpha1.ApisixRouteHTTPBackend `json:"backend" yaml:"backend"`
Review comment:
Looks strange, if we use data structures in `v2alpha1`. Why not just
implement them here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]