Merge pull request #1255 from mrjana/lb
Change port names in agent proto
This commit is contained in:
commit
16b7b6f700
|
@ -98,13 +98,13 @@ type PortConfig struct {
|
||||||
// Protocol for the port which is exposed.
|
// Protocol for the port which is exposed.
|
||||||
Protocol PortConfig_Protocol `protobuf:"varint,2,opt,name=protocol,proto3,enum=libnetwork.PortConfig_Protocol" json:"protocol,omitempty"`
|
Protocol PortConfig_Protocol `protobuf:"varint,2,opt,name=protocol,proto3,enum=libnetwork.PortConfig_Protocol" json:"protocol,omitempty"`
|
||||||
// The port which the application is exposing and is bound to.
|
// The port which the application is exposing and is bound to.
|
||||||
Port uint32 `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"`
|
TargetPort uint32 `protobuf:"varint,3,opt,name=target_port,json=targetPort,proto3" json:"target_port,omitempty"`
|
||||||
// NodePort specifies the port on which the service is
|
// PublishedPort specifies the port on which the service is
|
||||||
// exposed on all nodes on the cluster. If not specified an
|
// exposed on all nodes on the cluster. If not specified an
|
||||||
// arbitrary port in the node port range is allocated by the
|
// arbitrary port in the node port range is allocated by the
|
||||||
// system. If specified it should be within the node port
|
// system. If specified it should be within the node port
|
||||||
// range and it should be available.
|
// range and it should be available.
|
||||||
NodePort uint32 `protobuf:"varint,4,opt,name=node_port,json=nodePort,proto3" json:"node_port,omitempty"`
|
PublishedPort uint32 `protobuf:"varint,4,opt,name=published_port,json=publishedPort,proto3" json:"published_port,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *PortConfig) Reset() { *m = PortConfig{} }
|
func (m *PortConfig) Reset() { *m = PortConfig{} }
|
||||||
|
@ -141,8 +141,8 @@ func (this *PortConfig) GoString() string {
|
||||||
s = append(s, "&libnetwork.PortConfig{")
|
s = append(s, "&libnetwork.PortConfig{")
|
||||||
s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n")
|
s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n")
|
||||||
s = append(s, "Protocol: "+fmt.Sprintf("%#v", this.Protocol)+",\n")
|
s = append(s, "Protocol: "+fmt.Sprintf("%#v", this.Protocol)+",\n")
|
||||||
s = append(s, "Port: "+fmt.Sprintf("%#v", this.Port)+",\n")
|
s = append(s, "TargetPort: "+fmt.Sprintf("%#v", this.TargetPort)+",\n")
|
||||||
s = append(s, "NodePort: "+fmt.Sprintf("%#v", this.NodePort)+",\n")
|
s = append(s, "PublishedPort: "+fmt.Sprintf("%#v", this.PublishedPort)+",\n")
|
||||||
s = append(s, "}")
|
s = append(s, "}")
|
||||||
return strings.Join(s, "")
|
return strings.Join(s, "")
|
||||||
}
|
}
|
||||||
|
@ -257,15 +257,15 @@ func (m *PortConfig) MarshalTo(data []byte) (int, error) {
|
||||||
i++
|
i++
|
||||||
i = encodeVarintAgent(data, i, uint64(m.Protocol))
|
i = encodeVarintAgent(data, i, uint64(m.Protocol))
|
||||||
}
|
}
|
||||||
if m.Port != 0 {
|
if m.TargetPort != 0 {
|
||||||
data[i] = 0x18
|
data[i] = 0x18
|
||||||
i++
|
i++
|
||||||
i = encodeVarintAgent(data, i, uint64(m.Port))
|
i = encodeVarintAgent(data, i, uint64(m.TargetPort))
|
||||||
}
|
}
|
||||||
if m.NodePort != 0 {
|
if m.PublishedPort != 0 {
|
||||||
data[i] = 0x20
|
data[i] = 0x20
|
||||||
i++
|
i++
|
||||||
i = encodeVarintAgent(data, i, uint64(m.NodePort))
|
i = encodeVarintAgent(data, i, uint64(m.PublishedPort))
|
||||||
}
|
}
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
@ -339,11 +339,11 @@ func (m *PortConfig) Size() (n int) {
|
||||||
if m.Protocol != 0 {
|
if m.Protocol != 0 {
|
||||||
n += 1 + sovAgent(uint64(m.Protocol))
|
n += 1 + sovAgent(uint64(m.Protocol))
|
||||||
}
|
}
|
||||||
if m.Port != 0 {
|
if m.TargetPort != 0 {
|
||||||
n += 1 + sovAgent(uint64(m.Port))
|
n += 1 + sovAgent(uint64(m.TargetPort))
|
||||||
}
|
}
|
||||||
if m.NodePort != 0 {
|
if m.PublishedPort != 0 {
|
||||||
n += 1 + sovAgent(uint64(m.NodePort))
|
n += 1 + sovAgent(uint64(m.PublishedPort))
|
||||||
}
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
@ -383,8 +383,8 @@ func (this *PortConfig) String() string {
|
||||||
s := strings.Join([]string{`&PortConfig{`,
|
s := strings.Join([]string{`&PortConfig{`,
|
||||||
`Name:` + fmt.Sprintf("%v", this.Name) + `,`,
|
`Name:` + fmt.Sprintf("%v", this.Name) + `,`,
|
||||||
`Protocol:` + fmt.Sprintf("%v", this.Protocol) + `,`,
|
`Protocol:` + fmt.Sprintf("%v", this.Protocol) + `,`,
|
||||||
`Port:` + fmt.Sprintf("%v", this.Port) + `,`,
|
`TargetPort:` + fmt.Sprintf("%v", this.TargetPort) + `,`,
|
||||||
`NodePort:` + fmt.Sprintf("%v", this.NodePort) + `,`,
|
`PublishedPort:` + fmt.Sprintf("%v", this.PublishedPort) + `,`,
|
||||||
`}`,
|
`}`,
|
||||||
}, "")
|
}, "")
|
||||||
return s
|
return s
|
||||||
|
@ -702,9 +702,9 @@ func (m *PortConfig) Unmarshal(data []byte) error {
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
if wireType != 0 {
|
if wireType != 0 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field TargetPort", wireType)
|
||||||
}
|
}
|
||||||
m.Port = 0
|
m.TargetPort = 0
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
if shift >= 64 {
|
if shift >= 64 {
|
||||||
return ErrIntOverflowAgent
|
return ErrIntOverflowAgent
|
||||||
|
@ -714,16 +714,16 @@ func (m *PortConfig) Unmarshal(data []byte) error {
|
||||||
}
|
}
|
||||||
b := data[iNdEx]
|
b := data[iNdEx]
|
||||||
iNdEx++
|
iNdEx++
|
||||||
m.Port |= (uint32(b) & 0x7F) << shift
|
m.TargetPort |= (uint32(b) & 0x7F) << shift
|
||||||
if b < 0x80 {
|
if b < 0x80 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
if wireType != 0 {
|
if wireType != 0 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field NodePort", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field PublishedPort", wireType)
|
||||||
}
|
}
|
||||||
m.NodePort = 0
|
m.PublishedPort = 0
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
if shift >= 64 {
|
if shift >= 64 {
|
||||||
return ErrIntOverflowAgent
|
return ErrIntOverflowAgent
|
||||||
|
@ -733,7 +733,7 @@ func (m *PortConfig) Unmarshal(data []byte) error {
|
||||||
}
|
}
|
||||||
b := data[iNdEx]
|
b := data[iNdEx]
|
||||||
iNdEx++
|
iNdEx++
|
||||||
m.NodePort |= (uint32(b) & 0x7F) << shift
|
m.PublishedPort |= (uint32(b) & 0x7F) << shift
|
||||||
if b < 0x80 {
|
if b < 0x80 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -865,29 +865,29 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
var fileDescriptorAgent = []byte{
|
var fileDescriptorAgent = []byte{
|
||||||
// 370 bytes of a gzipped FileDescriptorProto
|
// 384 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x90, 0xbf, 0x4e, 0x32, 0x41,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x90, 0x3f, 0x6f, 0xda, 0x40,
|
||||||
0x14, 0xc5, 0x59, 0xe0, 0x23, 0xec, 0x5d, 0x96, 0x8f, 0x4c, 0x8c, 0xd9, 0x60, 0x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, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,12 +55,12 @@ message PortConfig {
|
||||||
Protocol protocol = 2;
|
Protocol protocol = 2;
|
||||||
|
|
||||||
// The port which the application is exposing and is bound to.
|
// The port which the application is exposing and is bound to.
|
||||||
uint32 port = 3;
|
uint32 target_port = 3;
|
||||||
|
|
||||||
// NodePort specifies the port on which the service is
|
// PublishedPort specifies the port on which the service is
|
||||||
// exposed on all nodes on the cluster. If not specified an
|
// exposed on all nodes on the cluster. If not specified an
|
||||||
// arbitrary port in the node port range is allocated by the
|
// arbitrary port in the node port range is allocated by the
|
||||||
// system. If specified it should be within the node port
|
// system. If specified it should be within the node port
|
||||||
// range and it should be available.
|
// range and it should be available.
|
||||||
uint32 node_port = 4;
|
uint32 published_port = 4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -440,14 +440,14 @@ func programIngress(gwIP net.IP, ingressPorts []*PortConfig, isDelete bool) erro
|
||||||
for _, iPort := range ingressPorts {
|
for _, iPort := range ingressPorts {
|
||||||
if iptables.ExistChain(ingressChain, iptables.Nat) {
|
if iptables.ExistChain(ingressChain, iptables.Nat) {
|
||||||
rule := strings.Fields(fmt.Sprintf("-t nat %s %s -p %s --dport %d -j DNAT --to-destination %s:%d",
|
rule := strings.Fields(fmt.Sprintf("-t nat %s %s -p %s --dport %d -j DNAT --to-destination %s:%d",
|
||||||
addDelOpt, ingressChain, strings.ToLower(PortConfig_Protocol_name[int32(iPort.Protocol)]), iPort.NodePort, gwIP, iPort.NodePort))
|
addDelOpt, ingressChain, strings.ToLower(PortConfig_Protocol_name[int32(iPort.Protocol)]), iPort.PublishedPort, gwIP, iPort.PublishedPort))
|
||||||
if err := iptables.RawCombinedOutput(rule...); err != nil {
|
if err := iptables.RawCombinedOutput(rule...); err != nil {
|
||||||
return fmt.Errorf("setting up rule failed, %v: %v", rule, err)
|
return fmt.Errorf("setting up rule failed, %v: %v", rule, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := plumbProxy(iPort, isDelete); err != nil {
|
if err := plumbProxy(iPort, isDelete); err != nil {
|
||||||
return fmt.Errorf("failed to create proxy for port %d: %v", iPort.NodePort, err)
|
return fmt.Errorf("failed to create proxy for port %d: %v", iPort.PublishedPort, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,7 +482,7 @@ func plumbProxy(iPort *PortConfig, isDelete bool) error {
|
||||||
l io.Closer
|
l io.Closer
|
||||||
)
|
)
|
||||||
|
|
||||||
portSpec := fmt.Sprintf("%d/%s", iPort.NodePort, strings.ToLower(PortConfig_Protocol_name[int32(iPort.Protocol)]))
|
portSpec := fmt.Sprintf("%d/%s", iPort.PublishedPort, strings.ToLower(PortConfig_Protocol_name[int32(iPort.Protocol)]))
|
||||||
if isDelete {
|
if isDelete {
|
||||||
ingressProxyMu.Lock()
|
ingressProxyMu.Lock()
|
||||||
if listener, ok := ingressProxyTbl[portSpec]; ok {
|
if listener, ok := ingressProxyTbl[portSpec]; ok {
|
||||||
|
@ -497,9 +497,9 @@ func plumbProxy(iPort *PortConfig, isDelete bool) error {
|
||||||
|
|
||||||
switch iPort.Protocol {
|
switch iPort.Protocol {
|
||||||
case ProtocolTCP:
|
case ProtocolTCP:
|
||||||
l, err = net.ListenTCP("tcp", &net.TCPAddr{Port: int(iPort.NodePort)})
|
l, err = net.ListenTCP("tcp", &net.TCPAddr{Port: int(iPort.PublishedPort)})
|
||||||
case ProtocolUDP:
|
case ProtocolUDP:
|
||||||
l, err = net.ListenUDP("udp", &net.UDPAddr{Port: int(iPort.NodePort)})
|
l, err = net.ListenUDP("udp", &net.UDPAddr{Port: int(iPort.PublishedPort)})
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -600,11 +600,11 @@ func fwMarker() {
|
||||||
rules := [][]string{}
|
rules := [][]string{}
|
||||||
for _, iPort := range ingressPorts {
|
for _, iPort := range ingressPorts {
|
||||||
rule := strings.Fields(fmt.Sprintf("-t nat %s PREROUTING -p %s --dport %d -j REDIRECT --to-port %d",
|
rule := strings.Fields(fmt.Sprintf("-t nat %s PREROUTING -p %s --dport %d -j REDIRECT --to-port %d",
|
||||||
addDelOpt, strings.ToLower(PortConfig_Protocol_name[int32(iPort.Protocol)]), iPort.NodePort, iPort.Port))
|
addDelOpt, strings.ToLower(PortConfig_Protocol_name[int32(iPort.Protocol)]), iPort.PublishedPort, iPort.TargetPort))
|
||||||
rules = append(rules, rule)
|
rules = append(rules, rule)
|
||||||
|
|
||||||
rule = strings.Fields(fmt.Sprintf("-t mangle %s PREROUTING -p %s --dport %d -j MARK --set-mark %d",
|
rule = strings.Fields(fmt.Sprintf("-t mangle %s PREROUTING -p %s --dport %d -j MARK --set-mark %d",
|
||||||
addDelOpt, strings.ToLower(PortConfig_Protocol_name[int32(iPort.Protocol)]), iPort.NodePort, fwMark))
|
addDelOpt, strings.ToLower(PortConfig_Protocol_name[int32(iPort.Protocol)]), iPort.PublishedPort, fwMark))
|
||||||
rules = append(rules, rule)
|
rules = append(rules, rule)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue