Update the related tests

1. add AllocateLoadBalancerNodePorts fields in specs for validation test cases
2. update fuzzer
3. in resource quota e2e, allocate node port for loadbalancer type service and
   exceed the node port quota

Signed-off-by: Hanlin Shi <shihanlin9@gmail.com>
This commit is contained in:
Hanlin Shi
2021-03-19 19:33:56 +00:00
parent 05c6eaf0d1
commit 24592ca989
5 changed files with 117 additions and 30 deletions

View File

@@ -19,6 +19,7 @@ package testing
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
utilpointer "k8s.io/utils/pointer"
api "k8s.io/kubernetes/pkg/apis/core"
)
@@ -88,6 +89,16 @@ func SetTypeExternalName(svc *api.Service) {
svc.Spec.ClusterIPs = nil
}
// SetTypeExternalNameTrue sets the allocate LB node port to true.
func SetAllocateLBNodePortTrue(svc *api.Service) {
svc.Spec.AllocateLoadBalancerNodePorts = utilpointer.BoolPtr(true)
}
// SetTypeExternalNameFalse sets the allocate LB node port to false.
func SetAllocateLBNodePortFalse(svc *api.Service) {
svc.Spec.AllocateLoadBalancerNodePorts = utilpointer.BoolPtr(false)
}
// SetPorts sets the service ports list.
func SetPorts(ports ...api.ServicePort) Tweak {
return func(svc *api.Service) {