// MsgProcess process from metaManager and start a proxy server
MsgProcess process from metaManager and start a proxy server
// MsgProcess process from metaManager and start a proxy server
func MsgProcess(msg model.Message) {
	svcs := filterResourceType(msg)
	if len(svcs) == 0 {
		return
	}
	klog.Infof("[L4 Proxy] proxy process svcs : %d resource: %s\n", len(svcs), msg.Router.Resource)
	for _, svc := range svcs {
		svcName := svc.Namespace + "." + svc.Name
		if !IsL4Proxy(&svc) {
			delServer(svcName)
			continue
		}
		klog.Infof("[L4 Proxy] proxy process svc : %s,%s", msg.GetOperation(), svcName)
		port := make([]int32, 0)
		targetPort := make([]int32, 0)
		for _, p := range svc.Spec.Ports {
			if p.Protocol == "TCP" {
				port = append(port, p.Port)
				targetPort = append(targetPort, p.TargetPort.IntVal)
			}
		}
		if len(port) == 0 || len(targetPort) == 0 {
			continue
		}
		switch msg.GetOperation() {
		case "insert":
			addServer(svcName, port)
		case "delete":
			delServer(svcName)
		case "update":
			updateServer(svcName, port)
		default:
			klog.Infof("[L4 proxy] Unknown operation")
		}
		st := addrByService.getAddrTable(svcName)
		if st != nil {
			st.targetPort = targetPort
		}
	}
}
func MsgProcess ( msg model . Message ) { svcs := filterResourceType ( msg ) if len ( svcs ) == 0 { return } klog . Infof ( " \n " , len ( svcs ) , msg . Router . Resource ) for _ , svc := range svcs { svcName := svc . Namespace + " " + svc . Name if ! IsL4Proxy ( & svc ) { delServer ( svcName ) continue } klog . Infof ( " " , msg . GetOperation ( ) , svcName ) port := make ( [ ] int32 , 0 ) targetPort := make ( [ ] int32 , 0 ) for _ , p := range svc . Spec . Ports { if p . Protocol == " " { port = append ( port , p . Port ) targetPort = append ( targetPort , p . TargetPort . IntVal ) } } if len ( port ) == 0 || len ( targetPort ) == 0 { continue } switch msg . GetOperation ( ) { case " " : addServer ( svcName , port ) case " " : delServer ( svcName ) case " " : updateServer ( svcName , port ) default : klog . Infof ( " " ) } st := addrByService . getAddrTable ( svcName ) if st != nil { st . targetPort = targetPort } } }
MsgProcess process from metaManager and start a proxy server
MsgProcess process from metaManager and start a proxy server
// when server protocol update to http // this version will support TCP only // this version will not support string type