func (j *TestJig) ChangeServiceNodePort(initial int) (*v1.Service, error) {
	var err error
	var service *v1.Service
	for i := 1; i < NodePortRange.Size; i++ {
		offs1 := initial - NodePortRange.Base
		offs2 := (offs1 + i) % NodePortRange.Size
		newPort := NodePortRange.Base + offs2
		service, err = j.UpdateService(func(s *v1.Service) {
			s.Spec.Ports[0].NodePort = int32(newPort)
		})
		if err != nil && strings.Contains(err.Error(), errAllocated.Error()) {
			framework.Logf("tried nodePort %d, but it is in use, will try another", newPort)
			continue
		}
		// Otherwise err was nil or err was a real error
		break
	}
	return service, err
}
// ChangeServiceNodePort changes node ports of the given service.
ChangeServiceNodePort changes node ports of the given service.
// ChangeServiceNodePort changes node ports of the given service .
func (j *TestJig) ChangeServiceNodePort(initial int) (*v1.Service, error) {
	var err error
	var service *v1.Service
	for i := 1; i < NodePortRange.Size; i++ {
		offs1 := initial - NodePortRange.Base
		offs2 := (offs1 + i) % NodePortRange.Size
		newPort := NodePortRange.Base + offs2
		service, err = j.UpdateService(func(s *v1.Service) {
			s.Spec.Ports[0].NodePort = int32(newPort)
		})
		if err != nil && strings.Contains(err.Error(), errAllocated.Error()) {
			framework.Logf("tried nodePort %d, but it is in use, will try another", newPort)
			continue
		}
		break
	}
	return service, err
}
func ( j * TestJig ) ChangeServiceNodePort ( initial int ) ( * v1 . Service , error ) { var err error var service * v1 . Service for i := 1 ; i < NodePortRange . Size ; i ++ { offs1 := initial - NodePortRange . Base offs2 := ( offs1 + i ) % NodePortRange . Size newPort := NodePortRange . Base + offs2 service , err = j . UpdateService ( func ( s * v1 . Service ) { s . Spec . Ports [ 0 ] . NodePort = int32 ( newPort ) } ) if err != nil && strings . Contains ( err . Error ( ) , errAllocated . Error ( ) ) { framework . Logf ( " " , newPort ) continue } break } return service , err }
ChangeServiceNodePort changes node ports of the given service.
ChangeServiceNodePort changes node ports of the given service .
// Otherwise err was nil or err was a real error