mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
kube-proxy: log service and endpoint updates
This commit is contained in:
parent
37da906db2
commit
341022f8d1
@ -176,6 +176,10 @@ func (ect *EndpointChangeTracker) Update(previous, current *v1.Endpoints) bool {
|
|||||||
// there will be no network programming for them and thus no network programming latency metric
|
// there will be no network programming for them and thus no network programming latency metric
|
||||||
// should be exported.
|
// should be exported.
|
||||||
delete(ect.lastChangeTriggerTimes, namespacedName)
|
delete(ect.lastChangeTriggerTimes, namespacedName)
|
||||||
|
} else {
|
||||||
|
for spn, eps := range change.current {
|
||||||
|
klog.V(2).Infof("Service port %s updated: %d endpoints", spn, len(eps))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
metrics.EndpointChangesPending.Set(float64(len(ect.items)))
|
metrics.EndpointChangesPending.Set(float64(len(ect.items)))
|
||||||
|
@ -2427,23 +2427,23 @@ COMMIT
|
|||||||
:KUBE-NODEPORTS - [0:0]
|
:KUBE-NODEPORTS - [0:0]
|
||||||
:KUBE-POSTROUTING - [0:0]
|
:KUBE-POSTROUTING - [0:0]
|
||||||
:KUBE-MARK-MASQ - [0:0]
|
:KUBE-MARK-MASQ - [0:0]
|
||||||
:KUBE-SVC-AHZNAGK3SCETOS2T - [0:0]
|
:KUBE-SVC-AQI2S6QIMU7PVVRP - [0:0]
|
||||||
:KUBE-SEP-PXD6POUVGD2I37UY - [0:0]
|
:KUBE-SEP-3JOIVZTXZZRGORX4 - [0:0]
|
||||||
:KUBE-SEP-SOKZUIT7SCEVIP33 - [0:0]
|
:KUBE-SEP-IO5XOSKPAXIFQXAJ - [0:0]
|
||||||
:KUBE-SEP-WVE3FAB34S7NZGDJ - [0:0]
|
:KUBE-SEP-XGJFVO3L2O5SRFNT - [0:0]
|
||||||
-A KUBE-POSTROUTING -m comment --comment "kubernetes service traffic requiring SNAT" -m mark --mark -j MASQUERADE
|
-A KUBE-POSTROUTING -m comment --comment "kubernetes service traffic requiring SNAT" -m mark --mark -j MASQUERADE
|
||||||
-A KUBE-MARK-MASQ -j MARK --set-xmark
|
-A KUBE-MARK-MASQ -j MARK --set-xmark
|
||||||
-A KUBE-SERVICES -m comment --comment "ns1/svc1: cluster IP" -m tcp -p tcp -d 172.20.1.1/32 --dport 0 ! -s 10.0.0.0/24 -j KUBE-MARK-MASQ
|
-A KUBE-SERVICES -m comment --comment "ns1/svc1 cluster IP" -m tcp -p tcp -d 172.20.1.1/32 --dport 0 ! -s 10.0.0.0/24 -j KUBE-MARK-MASQ
|
||||||
-A KUBE-SERVICES -m comment --comment "ns1/svc1: cluster IP" -m tcp -p tcp -d 172.20.1.1/32 --dport 0 -j KUBE-SVC-AHZNAGK3SCETOS2T
|
-A KUBE-SERVICES -m comment --comment "ns1/svc1 cluster IP" -m tcp -p tcp -d 172.20.1.1/32 --dport 0 -j KUBE-SVC-AQI2S6QIMU7PVVRP
|
||||||
-A KUBE-SVC-AHZNAGK3SCETOS2T -m comment --comment ns1/svc1: -m statistic --mode random --probability 0.3333333333 -j KUBE-SEP-PXD6POUVGD2I37UY
|
-A KUBE-SVC-AQI2S6QIMU7PVVRP -m comment --comment ns1/svc1 -m statistic --mode random --probability 0.3333333333 -j KUBE-SEP-3JOIVZTXZZRGORX4
|
||||||
-A KUBE-SEP-PXD6POUVGD2I37UY -m comment --comment ns1/svc1: -s 10.0.1.1/32 -j KUBE-MARK-MASQ
|
-A KUBE-SEP-3JOIVZTXZZRGORX4 -m comment --comment ns1/svc1 -s 10.0.1.1/32 -j KUBE-MARK-MASQ
|
||||||
-A KUBE-SEP-PXD6POUVGD2I37UY -m comment --comment ns1/svc1: -m tcp -p tcp -j DNAT --to-destination 10.0.1.1:80
|
-A KUBE-SEP-3JOIVZTXZZRGORX4 -m comment --comment ns1/svc1 -m tcp -p tcp -j DNAT --to-destination 10.0.1.1:80
|
||||||
-A KUBE-SVC-AHZNAGK3SCETOS2T -m comment --comment ns1/svc1: -m statistic --mode random --probability 0.5000000000 -j KUBE-SEP-SOKZUIT7SCEVIP33
|
-A KUBE-SVC-AQI2S6QIMU7PVVRP -m comment --comment ns1/svc1 -m statistic --mode random --probability 0.5000000000 -j KUBE-SEP-IO5XOSKPAXIFQXAJ
|
||||||
-A KUBE-SEP-SOKZUIT7SCEVIP33 -m comment --comment ns1/svc1: -s 10.0.1.2/32 -j KUBE-MARK-MASQ
|
-A KUBE-SEP-IO5XOSKPAXIFQXAJ -m comment --comment ns1/svc1 -s 10.0.1.2/32 -j KUBE-MARK-MASQ
|
||||||
-A KUBE-SEP-SOKZUIT7SCEVIP33 -m comment --comment ns1/svc1: -m tcp -p tcp -j DNAT --to-destination 10.0.1.2:80
|
-A KUBE-SEP-IO5XOSKPAXIFQXAJ -m comment --comment ns1/svc1 -m tcp -p tcp -j DNAT --to-destination 10.0.1.2:80
|
||||||
-A KUBE-SVC-AHZNAGK3SCETOS2T -m comment --comment ns1/svc1: -j KUBE-SEP-WVE3FAB34S7NZGDJ
|
-A KUBE-SVC-AQI2S6QIMU7PVVRP -m comment --comment ns1/svc1 -j KUBE-SEP-XGJFVO3L2O5SRFNT
|
||||||
-A KUBE-SEP-WVE3FAB34S7NZGDJ -m comment --comment ns1/svc1: -s 10.0.1.3/32 -j KUBE-MARK-MASQ
|
-A KUBE-SEP-XGJFVO3L2O5SRFNT -m comment --comment ns1/svc1 -s 10.0.1.3/32 -j KUBE-MARK-MASQ
|
||||||
-A KUBE-SEP-WVE3FAB34S7NZGDJ -m comment --comment ns1/svc1: -m tcp -p tcp -j DNAT --to-destination 10.0.1.3:80
|
-A KUBE-SEP-XGJFVO3L2O5SRFNT -m comment --comment ns1/svc1 -m tcp -p tcp -j DNAT --to-destination 10.0.1.3:80
|
||||||
-A KUBE-SERVICES -m comment --comment "kubernetes service nodeports; NOTE: this must be the last rule in this chain" -m addrtype --dst-type LOCAL -j KUBE-NODEPORTS
|
-A KUBE-SERVICES -m comment --comment "kubernetes service nodeports; NOTE: this must be the last rule in this chain" -m addrtype --dst-type LOCAL -j KUBE-NODEPORTS
|
||||||
COMMIT
|
COMMIT
|
||||||
`
|
`
|
||||||
|
@ -263,6 +263,8 @@ func (sct *ServiceChangeTracker) Update(previous, current *v1.Service) bool {
|
|||||||
// if change.previous equal to change.current, it means no change
|
// if change.previous equal to change.current, it means no change
|
||||||
if reflect.DeepEqual(change.previous, change.current) {
|
if reflect.DeepEqual(change.previous, change.current) {
|
||||||
delete(sct.items, namespacedName)
|
delete(sct.items, namespacedName)
|
||||||
|
} else {
|
||||||
|
klog.V(2).Infof("Service %s updated: %d ports", namespacedName, len(change.current))
|
||||||
}
|
}
|
||||||
metrics.ServiceChangesPending.Set(float64(len(sct.items)))
|
metrics.ServiceChangesPending.Set(float64(len(sct.items)))
|
||||||
return len(sct.items) > 0
|
return len(sct.items) > 0
|
||||||
|
@ -49,7 +49,14 @@ type ServicePortName struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (spn ServicePortName) String() string {
|
func (spn ServicePortName) String() string {
|
||||||
return fmt.Sprintf("%s:%s", spn.NamespacedName.String(), spn.Port)
|
return fmt.Sprintf("%s%s", spn.NamespacedName.String(), fmtPortName(spn.Port))
|
||||||
|
}
|
||||||
|
|
||||||
|
func fmtPortName(in string) string {
|
||||||
|
if in == "" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return fmt.Sprintf(":%s", in)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServicePort is an interface which abstracts information about a service.
|
// ServicePort is an interface which abstracts information about a service.
|
||||||
|
Loading…
Reference in New Issue
Block a user