Skip to content

Commit

Permalink
fix: listener filter protocol
Browse files Browse the repository at this point in the history
Signed-off-by: Lin Yang <[email protected]>
  • Loading branch information
reaver-flomesh committed Sep 16, 2024
1 parent 706905c commit a8f6027
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
25 changes: 12 additions & 13 deletions pkg/gateway/processor/v2/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"sigs.k8s.io/yaml"

"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/ptr"
gwv1 "sigs.k8s.io/gateway-api/apis/v1"

extv1alpha1 "github.com/flomesh-io/fsm/pkg/apis/extension/v1alpha1"
Expand Down Expand Up @@ -82,18 +81,18 @@ func (c *ConfigGenerator) resolveFilterConfig(ref *gwv1.LocalObjectReference) ma
return map[string]interface{}{}
}

func toFilterProtocol(protocol gwv1.ProtocolType) *extv1alpha1.FilterProtocol {
switch protocol {
case gwv1.HTTPProtocolType, gwv1.HTTPSProtocolType, gwv1.TLSProtocolType:
return ptr.To(extv1alpha1.FilterProtocolHTTP)
case gwv1.TCPProtocolType:
return ptr.To(extv1alpha1.FilterProtocolTCP)
case gwv1.UDPProtocolType:
return ptr.To(extv1alpha1.FilterProtocolUDP)
default:
return nil
}
}
//func toFilterProtocol(protocol gwv1.ProtocolType) *extv1alpha1.FilterProtocol {
// switch protocol {
// case gwv1.HTTPProtocolType, gwv1.HTTPSProtocolType, gwv1.TLSProtocolType:
// return ptr.To(extv1alpha1.FilterProtocolHTTP)
// case gwv1.TCPProtocolType:
// return ptr.To(extv1alpha1.FilterProtocolTCP)
// case gwv1.UDPProtocolType:
// return ptr.To(extv1alpha1.FilterProtocolUDP)
// default:
// return nil
// }
//}

func toMap(key string, spec interface{}) map[string]interface{} {
bytes, err := yaml.Marshal(spec)
Expand Down
18 changes: 9 additions & 9 deletions pkg/gateway/processor/v2/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,15 @@ func (c *ConfigGenerator) processListenerFilters(l gwtypes.Listener, v2l *fgwv2.
}

filterProtocol := ptr.Deref(definition.Spec.Protocol, extv1alpha1.FilterProtocolHTTP)
listenerProtocol := toFilterProtocol(l.Protocol)

if listenerProtocol == nil {
continue
}

if *listenerProtocol != filterProtocol {
continue
}
//listenerProtocol := toFilterProtocol(l.Protocol)
//
//if listenerProtocol == nil {
// continue
//}
//
//if *listenerProtocol != filterProtocol {
// continue
//}

filterType := definition.Spec.Type

Expand Down

0 comments on commit a8f6027

Please sign in to comment.