mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Remove some helpers associated with ESIPP.
This commit is contained in:
@@ -183,7 +183,7 @@ func (rs *REST) Delete(ctx genericapirequest.Context, id string) (runtime.Object
|
||||
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.ExternalTrafficLocalOnly) &&
|
||||
apiservice.NeedsHealthCheck(service) {
|
||||
nodePort := apiservice.GetServiceHealthCheckNodePort(service)
|
||||
nodePort := service.Spec.HealthCheckNodePort
|
||||
if nodePort > 0 {
|
||||
err := rs.serviceNodePorts.Release(int(nodePort))
|
||||
if err != nil {
|
||||
@@ -238,7 +238,7 @@ func externalTrafficPolicyUpdate(oldService, service *api.Service) {
|
||||
}
|
||||
if neededExternalTraffic && !needsExternalTraffic {
|
||||
// Clear ExternalTrafficPolicy to prevent confusion from ineffective field.
|
||||
apiservice.ClearExternalTrafficPolicy(service)
|
||||
service.Spec.ExternalTrafficPolicy = api.ServiceExternalTrafficPolicyType("")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,10 +246,10 @@ func externalTrafficPolicyUpdate(oldService, service *api.Service) {
|
||||
// and adjusts HealthCheckNodePort during service update if needed.
|
||||
func (rs *REST) healthCheckNodePortUpdate(oldService, service *api.Service) (bool, error) {
|
||||
neededHealthCheckNodePort := apiservice.NeedsHealthCheck(oldService)
|
||||
oldHealthCheckNodePort := apiservice.GetServiceHealthCheckNodePort(oldService)
|
||||
oldHealthCheckNodePort := oldService.Spec.HealthCheckNodePort
|
||||
|
||||
needsHealthCheckNodePort := apiservice.NeedsHealthCheck(service)
|
||||
newHealthCheckNodePort := apiservice.GetServiceHealthCheckNodePort(service)
|
||||
newHealthCheckNodePort := service.Spec.HealthCheckNodePort
|
||||
|
||||
switch {
|
||||
// Case 1: Transition from don't need HealthCheckNodePort to needs HealthCheckNodePort.
|
||||
@@ -272,7 +272,7 @@ func (rs *REST) healthCheckNodePortUpdate(oldService, service *api.Service) (boo
|
||||
}
|
||||
glog.Infof("Freed health check nodePort: %d", oldHealthCheckNodePort)
|
||||
// Clear the HealthCheckNodePort field.
|
||||
apiservice.SetServiceHealthCheckNodePort(service, 0)
|
||||
service.Spec.HealthCheckNodePort = 0
|
||||
|
||||
// Case 3: Remain in needs HealthCheckNodePort.
|
||||
// Reject changing the value of the HealthCheckNodePort field.
|
||||
@@ -475,7 +475,7 @@ func findRequestedNodePort(port int, servicePorts []api.ServicePort) int {
|
||||
|
||||
// allocateHealthCheckNodePort allocates health check node port to service.
|
||||
func (rs *REST) allocateHealthCheckNodePort(service *api.Service) error {
|
||||
healthCheckNodePort := apiservice.GetServiceHealthCheckNodePort(service)
|
||||
healthCheckNodePort := service.Spec.HealthCheckNodePort
|
||||
if healthCheckNodePort != 0 {
|
||||
// If the request has a health check nodePort in mind, attempt to reserve it.
|
||||
err := rs.serviceNodePorts.Allocate(int(healthCheckNodePort))
|
||||
@@ -490,7 +490,7 @@ func (rs *REST) allocateHealthCheckNodePort(service *api.Service) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to allocate a HealthCheck NodePort %v: %v", healthCheckNodePort, err)
|
||||
}
|
||||
apiservice.SetServiceHealthCheckNodePort(service, int32(healthCheckNodePort))
|
||||
service.Spec.HealthCheckNodePort = int32(healthCheckNodePort)
|
||||
glog.Infof("Reserved allocated nodePort: %d", healthCheckNodePort)
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -993,7 +993,7 @@ func TestServiceRegistryExternalTrafficHealthCheckNodePortAllocation(t *testing.
|
||||
if !service.NeedsHealthCheck(created_service) {
|
||||
t.Errorf("Expecting health check needed, returned health check not needed instead")
|
||||
}
|
||||
port := service.GetServiceHealthCheckNodePort(created_service)
|
||||
port := created_service.Spec.HealthCheckNodePort
|
||||
if port == 0 {
|
||||
t.Errorf("Failed to allocate health check node port and set the HealthCheckNodePort")
|
||||
} else {
|
||||
@@ -1031,7 +1031,7 @@ func TestServiceRegistryExternalTrafficHealthCheckNodePortUserAllocation(t *test
|
||||
if !service.NeedsHealthCheck(created_service) {
|
||||
t.Errorf("Expecting health check needed, returned health check not needed instead")
|
||||
}
|
||||
port := service.GetServiceHealthCheckNodePort(created_service)
|
||||
port := created_service.Spec.HealthCheckNodePort
|
||||
if port == 0 {
|
||||
t.Errorf("Failed to allocate health check node port and set the HealthCheckNodePort")
|
||||
}
|
||||
@@ -1098,7 +1098,7 @@ func TestServiceRegistryExternalTrafficGlobal(t *testing.T) {
|
||||
t.Errorf("Expecting health check not needed, returned health check needed instead")
|
||||
}
|
||||
// Make sure the service does not have the health check node port allocated
|
||||
port := service.GetServiceHealthCheckNodePort(created_service)
|
||||
port := created_service.Spec.HealthCheckNodePort
|
||||
if port != 0 {
|
||||
// Release the node port at the end of the test case.
|
||||
storage.serviceNodePorts.Release(int(port))
|
||||
|
||||
Reference in New Issue
Block a user