mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
address comments
This commit is contained in:
parent
e0d125b046
commit
136849728c
@ -140,7 +140,7 @@ func (c *Repair) runOnce() error {
|
|||||||
case nil:
|
case nil:
|
||||||
if stored.Has(port) {
|
if stored.Has(port) {
|
||||||
// remove it from the old set, so we can find leaks
|
// remove it from the old set, so we can find leaks
|
||||||
_ = stored.Release(port)
|
stored.Release(port)
|
||||||
} else {
|
} else {
|
||||||
// doesn't seem to be allocated
|
// doesn't seem to be allocated
|
||||||
c.recorder.Eventf(svc, corev1.EventTypeWarning, "PortNotAllocated", "Port %d is not allocated; repairing", port)
|
c.recorder.Eventf(svc, corev1.EventTypeWarning, "PortNotAllocated", "Port %d is not allocated; repairing", port)
|
||||||
|
@ -223,6 +223,28 @@ func TestCollectServiceNodePorts(t *testing.T) {
|
|||||||
},
|
},
|
||||||
expected: []int{111, 112, 113},
|
expected: []int{111, 112, 113},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "duplicated nodePort with TCP protocol",
|
||||||
|
serviceSpec: corev1.ServiceSpec{
|
||||||
|
Ports: []corev1.ServicePort{
|
||||||
|
{NodePort: 111, Protocol: corev1.ProtocolTCP},
|
||||||
|
{NodePort: 111, Protocol: corev1.ProtocolTCP},
|
||||||
|
{NodePort: 112, Protocol: corev1.ProtocolUDP},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expected: []int{111, 111, 112},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "duplicated nodePort with UDP protocol",
|
||||||
|
serviceSpec: corev1.ServiceSpec{
|
||||||
|
Ports: []corev1.ServicePort{
|
||||||
|
{NodePort: 111, Protocol: corev1.ProtocolUDP},
|
||||||
|
{NodePort: 111, Protocol: corev1.ProtocolUDP},
|
||||||
|
{NodePort: 112, Protocol: corev1.ProtocolTCP},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expected: []int{111, 111, 112},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "duplicated nodePort with different protocol",
|
name: "duplicated nodePort with different protocol",
|
||||||
serviceSpec: corev1.ServiceSpec{
|
serviceSpec: corev1.ServiceSpec{
|
||||||
@ -257,7 +279,7 @@ func TestCollectServiceNodePorts(t *testing.T) {
|
|||||||
expected: []int{111, 112},
|
expected: []int{111, 112},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "nodePort has same protocol with duplicated health check port",
|
name: "nodePort has same protocol as duplicated health check port",
|
||||||
serviceSpec: corev1.ServiceSpec{
|
serviceSpec: corev1.ServiceSpec{
|
||||||
Ports: []corev1.ServicePort{
|
Ports: []corev1.ServicePort{
|
||||||
{NodePort: 111, Protocol: corev1.ProtocolUDP},
|
{NodePort: 111, Protocol: corev1.ProtocolUDP},
|
||||||
|
Loading…
Reference in New Issue
Block a user