mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Fix nodeport repair for ESIPP services
This commit is contained in:
parent
5782d476c5
commit
c05e89d0e5
@ -204,5 +204,10 @@ func collectServiceNodePorts(service *api.Service) []int {
|
|||||||
servicePorts = append(servicePorts, int(servicePort.NodePort))
|
servicePorts = append(servicePorts, int(servicePort.NodePort))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if service.Spec.HealthCheckNodePort != 0 {
|
||||||
|
servicePorts = append(servicePorts, int(service.Spec.HealthCheckNodePort))
|
||||||
|
}
|
||||||
|
|
||||||
return servicePorts
|
return servicePorts
|
||||||
}
|
}
|
||||||
|
@ -164,6 +164,12 @@ func TestRepairWithExisting(t *testing.T) {
|
|||||||
Ports: []api.ServicePort{{NodePort: 111}},
|
Ports: []api.ServicePort{{NodePort: 111}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
&api.Service{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{Namespace: "six", Name: "six"},
|
||||||
|
Spec: api.ServiceSpec{
|
||||||
|
HealthCheckNodePort: 144,
|
||||||
|
},
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
registry := &mockRangeRegistry{
|
registry := &mockRangeRegistry{
|
||||||
@ -183,10 +189,10 @@ func TestRepairWithExisting(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if !after.Has(111) || !after.Has(122) || !after.Has(133) {
|
if !after.Has(111) || !after.Has(122) || !after.Has(133) || !after.Has(144) {
|
||||||
t.Errorf("unexpected portallocator state: %#v", after)
|
t.Errorf("unexpected portallocator state: %#v", after)
|
||||||
}
|
}
|
||||||
if free := after.Free(); free != 98 {
|
if free := after.Free(); free != 97 {
|
||||||
t.Errorf("unexpected portallocator state: %d free", free)
|
t.Errorf("unexpected portallocator state: %d free", free)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user