in pkg/gateway/model_build_rule.go [100:145]
func (t *latticeServiceModelBuildTask) updateRuleSpecForHttpRoute(m *core.HTTPRouteMatch, ruleSpec *model.RuleSpec) error {
hasPath := m.Path() != nil
hasType := hasPath && m.Path().Type != nil
if hasPath && !hasType {
return errors.New("type is required on path match")
}
if hasPath {
t.log.Debugf(context.TODO(), "Examining pathmatch type %s value %s for for httproute %s-%s ",
*m.Path().Type, *m.Path().Value, t.route.Name(), t.route.Namespace())
switch *m.Path().Type {
case gwv1.PathMatchExact:
t.log.Debugf(context.TODO(), "Using PathMatchExact for httproute %s-%s ",
t.route.Name(), t.route.Namespace())
ruleSpec.PathMatchExact = true
case gwv1.PathMatchPathPrefix:
t.log.Debugf(context.TODO(), "Using PathMatchPathPrefix for httproute %s-%s ",
t.route.Name(), t.route.Namespace())
ruleSpec.PathMatchPrefix = true
default:
t.log.Debugf(context.TODO(), "Unsupported path match type %s for httproute %s-%s",
*m.Path().Type, t.route.Name(), t.route.Namespace())
return errors.New(LATTICE_UNSUPPORTED_PATH_MATCH_TYPE)
}
ruleSpec.PathMatchValue = *m.Path().Value
}
// method based match
if m.Method() != nil {
t.log.Infof(context.TODO(), "Examining http method %s for httproute %s-%s",
*m.Method(), t.route.Name(), t.route.Namespace())
ruleSpec.Method = string(*m.Method())
}
// controller does not support query matcher type today
if m.QueryParams() != nil {
t.log.Infof(context.TODO(), "Unsupported match type for httproute %s, namespace %s",
t.route.Name(), t.route.Namespace())
return errors.New(LATTICE_UNSUPPORTED_MATCH_TYPE)
}
return nil
}