diff --git a/.github/workflows/build-windows.yaml b/.github/workflows/build-windows.yaml index 29e74be47e0..ab0615fb29b 100644 --- a/.github/workflows/build-windows.yaml +++ b/.github/workflows/build-windows.yaml @@ -115,7 +115,7 @@ jobs: # python: Rename build related code to ovs_build_helpers. Invoke-WebRequest -Uri "https://github.com/kubeovn/ovn/commit/9d961aec6fd7ef3e3002bc34e285833279e989c2.patch" -OutFile ..\ovn-00.patch # change hash type from dp_hash to hash with field src_ip - Invoke-WebRequest -Uri "https://github.com/kubeovn/ovn/commit/5a04402c01df1463b9e1edcbc1c5634793687140.patch" -OutFile ..\ovn-01.patch + Invoke-WebRequest -Uri "https://github.com/kubeovn/ovn/commit/75876f75203bbf06a8f5ffb5628eca98bef03407.patch" -OutFile ..\ovn-01.patch # add support for windows Invoke-WebRequest -Uri "https://github.com/kubeovn/ovn/commit/2be843b9fc7cba253fb27fc57c384034e97db148.patch" -OutFile ..\ovn-02.patch # set br-int controller to TCP 127.0.0.1:6653 diff --git a/charts/README.md b/charts/README.md index 72dbb577230..bd0d5c6c4aa 100644 --- a/charts/README.md +++ b/charts/README.md @@ -5,16 +5,16 @@ Currently supported version: 1.9 Installation : ```bash -$ kubectl label no -lbeta.kubernetes.io/os=linux kubernetes.io/os=linux --overwrite -$ kubectl label no -lnode-role.kubernetes.io/control-plane kube-ovn/role=master --overwrite -$ kubectl label no -lovn.kubernetes.io/ovs_dp_type!=userspace ovn.kubernetes.io/ovs_dp_type=kernel --overwrite +$ kubectl label node -lbeta.kubernetes.io/os=linux kubernetes.io/os=linux --overwrite +$ kubectl label node -lnode-role.kubernetes.io/control-plane kube-ovn/role=master --overwrite +$ kubectl label node -lovn.kubernetes.io/ovs_dp_type!=userspace ovn.kubernetes.io/ovs_dp_type=kernel --overwrite # standard install -$ helm install --debug kubeovn ./kubeovn-helm --set MASTER_NODES=${Node0}, +$ helm install --debug kubeovn ./charts --set MASTER_NODES=${Node0}, # high availability install -$ helm install --debug kubeovn ./kubeovn-helm --set MASTER_NODES=${Node0},${Node1},${Node2}, --set replicaCount=3 +$ helm install --debug kubeovn ./charts --set MASTER_NODES=${Node0},${Node1},${Node2}, --set replicaCount=3 # upgrade to this version -$ helm upgrade --debug kubeovn ./kubeovn-helm --set MASTER_NODES=${Node0},${Node1},${Node2}, --set replicaCount=3 +$ helm upgrade --debug kubeovn ./charts --set MASTER_NODES=${Node0},${Node1},${Node2}, --set replicaCount=3 ``` diff --git a/cmd/cmdmain.go b/cmd/cmdmain.go index 90ba28cd155..c7b79e3b8a0 100644 --- a/cmd/cmdmain.go +++ b/cmd/cmdmain.go @@ -1,8 +1,15 @@ package main import ( + "fmt" "os" + "os/signal" "path/filepath" + "runtime/pprof" + "syscall" + "time" + + "k8s.io/klog/v2" "github.com/kubeovn/kube-ovn/cmd/controller" "github.com/kubeovn/kube-ovn/cmd/controller_health_check" @@ -24,18 +31,65 @@ const ( CmdOvnLeaderChecker = "kube-ovn-leader-checker" ) +const timeFormat = "2006-01-02_15:04:05" + +func dumpProfile() { + ch1 := make(chan os.Signal, 1) + ch2 := make(chan os.Signal, 1) + signal.Notify(ch1, syscall.SIGUSR1) + signal.Notify(ch2, syscall.SIGUSR2) + go func() { + for { + <-ch1 + name := fmt.Sprintf("cpu-profile-%s.pprof", time.Now().Format(timeFormat)) + f, err := os.Create(filepath.Join(os.TempDir(), name)) // #nosec G303,G304 + if err != nil { + klog.Errorf("failed to create cpu profile file: %v", err) + return + } + defer f.Close() + if err = pprof.StartCPUProfile(f); err != nil { + klog.Errorf("failed to start cpu profile: %v", err) + return + } + time.Sleep(30 * time.Second) + pprof.StopCPUProfile() + } + }() + go func() { + for { + <-ch2 + name := fmt.Sprintf("mem-profile-%s.pprof", time.Now().Format(timeFormat)) + f, err := os.Create(filepath.Join(os.TempDir(), name)) // #nosec G303,G304 + if err != nil { + klog.Errorf("failed to create memory profile file: %v", err) + return + } + defer f.Close() + if err = pprof.WriteHeapProfile(f); err != nil { + klog.Errorf("failed to write memory profile file: %v", err) + } + } + }() +} + func main() { cmd := filepath.Base(os.Args[0]) switch cmd { case CmdController: + dumpProfile() controller.CmdMain() case CmdDaemon: + dumpProfile() daemon.CmdMain() case CmdMonitor: + dumpProfile() ovn_monitor.CmdMain() case CmdPinger: + dumpProfile() pinger.CmdMain() case CmdSpeaker: + dumpProfile() speaker.CmdMain() case CmdControllerHealthCheck: controller_health_check.CmdMain() diff --git a/dist/images/Dockerfile.base b/dist/images/Dockerfile.base index b98e31ce1ff..62aa0ac1133 100644 --- a/dist/images/Dockerfile.base +++ b/dist/images/Dockerfile.base @@ -32,7 +32,7 @@ RUN cd /usr/src/ && git clone -b branch-22.12 --depth=1 https://github.com/ovn-o # python: Rename build related code to ovs_build_helpers. curl -s https://github.com/kubeovn/ovn/commit/9d961aec6fd7ef3e3002bc34e285833279e989c2.patch | git apply && \ # change hash type from dp_hash to hash with field src_ip - curl -s https://github.com/kubeovn/ovn/commit/daa09e380eec61620d4ee317e3265c44366d1147.patch | git apply && \ + curl -s https://github.com/kubeovn/ovn/commit/4ad8763f707ff4088ae61396c7931e8735f71f22.patch | git apply && \ # set ether dst addr for dnat on logical switch curl -s https://github.com/kubeovn/ovn/commit/44875725ad6ce3cb38e4d471d540fe69ed204bff.patch | git apply && \ # modify src route priority diff --git a/dist/images/kubectl-ko b/dist/images/kubectl-ko index 608c83e8efe..e9236643f1d 100755 --- a/dist/images/kubectl-ko +++ b/dist/images/kubectl-ko @@ -27,11 +27,11 @@ showHelp(){ echo " dpctl {nodeName} [ovs-dpctl options ...] invoke ovs-dpctl on the specified node" echo " appctl {nodeName} [ovs-appctl options ...] invoke ovs-appctl on the specified node" echo " tcpdump {namespace/podname} [tcpdump options ...] capture pod traffic" - echo " trace/ovn-trace ... trace ovn microflow of specific packet" - echo " trace/ovn-trace {namespace/podname} {target ip address} [target mac address] {icmp|tcp|udp} [target tcp/udp port] trace ICMP/TCP/UDP" - echo " trace/ovn-trace {namespace/podname} {target ip address} [target mac address] arp {request|reply} trace ARP request/reply" - echo " trace/ovn-trace {node//nodename} {target ip address} [target mac address] {icmp|tcp|udp} [target tcp/udp port] trace ICMP/TCP/UDP" - echo " trace/ovn-trace {node//nodename} {target ip address} [target mac address] arp {request|reply} trace ARP request/reply" + echo " {trace|ovn-trace} ... trace ovn microflow of specific packet" + echo " {trace|ovn-trace} {namespace/podname} {target ip address} [target mac address] {icmp|tcp|udp} [target tcp/udp port] trace ICMP/TCP/UDP" + echo " {trace|ovn-trace} {namespace/podname} {target ip address} [target mac address] arp {request|reply} trace ARP request/reply" + echo " {trace|ovn-trace} {node//nodename} {target ip address} [target mac address] {icmp|tcp|udp} [target tcp/udp port] trace ICMP/TCP/UDP" + echo " {trace|ovn-trace} {node//nodename} {target ip address} [target mac address] arp {request|reply} trace ARP request/reply" echo " diagnose {all|node|subnet|IPPorts} [nodename|subnetName|{proto1}-{IP1}-{Port1},{proto2}-{IP2}-{Port2}] diagnose connectivity of all nodes or a specific node or specify subnet's ds pod or IPPorts like 'tcp-172.18.0.2-53,udp-172.18.0.3-53'" echo " env-check check the environment configuration" echo " tuning {install-fastpath|local-install-fastpath|remove-fastpath|install-stt|local-install-stt|remove-stt} {centos7|centos8}} [kernel-devel-version] deploy kernel optimisation components to the system" diff --git a/dist/images/start-ovs.sh b/dist/images/start-ovs.sh index b57ee432f22..db9f30de9f9 100755 --- a/dist/images/start-ovs.sh +++ b/dist/images/start-ovs.sh @@ -18,10 +18,11 @@ echo "OVN_REMOTE_OPENFLOW_INTERVAL is set to $OVN_REMOTE_OPENFLOW_INTERVAL" # Check required kernel module modinfo openvswitch modinfo geneve -modinfo ip_tables # CentOS 8 might not load iptables module by default, which will hurt nat function -modprobe ip_tables +if modinfo ip_tables; then + modprobe ip_tables +fi # https://bugs.launchpad.net/neutron/+bug/1776778 if grep -q "3.10.0-862" /proc/version diff --git a/pkg/controller/endpoint.go b/pkg/controller/endpoint.go index ed34ac6d282..60a2b43fe14 100644 --- a/pkg/controller/endpoint.go +++ b/pkg/controller/endpoint.go @@ -134,7 +134,10 @@ func (c *Controller) handleUpdateEndpoint(key string) error { if vip, ok = svc.Annotations[util.SwitchLBRuleVipsAnnotation]; ok { lbVips = []string{vip} - ignoreHealthCheck = false + // TODO: IPv6 + if util.CheckProtocol(vip) == kubeovnv1.ProtocolIPv4 { + ignoreHealthCheck = false + } } else if lbVips = util.ServiceClusterIPs(*svc); len(lbVips) == 0 { return nil }