Skip to content

Commit

Permalink
change the prtocol string to const (#1887)
Browse files Browse the repository at this point in the history
  • Loading branch information
pengbinbin1 committed Sep 5, 2022
1 parent 7e56931 commit b148503
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pkg/controller/service_lb.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,11 @@ func (c *Controller) updatePodAttachNets(pod *corev1.Pod, svc *corev1.Service) e
var protocol string
switch port.Protocol {
case corev1.ProtocolTCP:
protocol = "tcp"
protocol = util.ProtocolTCP
case corev1.ProtocolUDP:
protocol = "udp"
protocol = util.ProtocolTCP
case corev1.ProtocolSCTP:
protocol = "sctp"
protocol = util.ProtocolSCTP
}

var rules []string
Expand Down
5 changes: 3 additions & 2 deletions pkg/util/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ const (
VpcDnsNameLabel = "ovn.kubernetes.io/vpc-dns"
NetworkPolicyLogAnnotation = "ovn.kubernetes.io/enable_log"

ProtocolTCP = "tcp"
ProtocolUDP = "udp"
ProtocolTCP = "tcp"
ProtocolUDP = "udp"
ProtocolSCTP = "sctp"

NetworkTypeVlan = "vlan"
NetworkTypeGeneve = "geneve"
Expand Down

0 comments on commit b148503

Please sign in to comment.