Documentation ¶
Index ¶
- Constants
- func CheckPodsRunningReady(c ctrlclient.Client, ns string, podNames []string, timeout time.Duration) bool
- func CreateLogger(debug bool) *zap.SugaredLogger
- func ExtractNodePorts(svc *corev1.Service) sets.Int32
- func ExtractPorts(svc *corev1.Service) sets.Int32
- func FindExposingNodePort(svc *corev1.Service, targetPort int32) int32
- func GetClientsOrDie() (ctrlclient.Client, rest.Interface, *rest.Config)
- func PodRunningReady(p *corev1.Pod) (bool, error)
- func WaitForPodCondition(c ctrlclient.Client, ns, podName, desc string, timeout time.Duration, ...) error
- func WaitForPodsCreated(c ctrlclient.Client, replicas int, namespace string, ...) ([]string, error)
- type Deployer
- type NetworkingTestConfig
- type ServiceJig
Constants ¶
const (
AgnhostImage = "k8s.gcr.io/e2e-test-images/agnhost:2.21"
)
TODO(irozzo) make registries configurable
Variables ¶
This section is empty.
Functions ¶
func CheckPodsRunningReady ¶
func CheckPodsRunningReady(c ctrlclient.Client, ns string, podNames []string, timeout time.Duration) bool
CheckPodsRunningReady returns whether all pods whose names are listed in podNames in namespace ns are running and ready, using c and waiting at most timeout.
func CreateLogger ¶
func CreateLogger(debug bool) *zap.SugaredLogger
CreateLogger creates a new Logger.
func ExtractNodePorts ¶
ExtractNodePorts returns the set of node ports extracted from the given Service.
func ExtractPorts ¶
ExtractPorts returns the set of ports extracted from the given Service.
func FindExposingNodePort ¶
FindExposingNodePort returns the node port associated to the given target port.
func GetClientsOrDie ¶
GetClientsOrDie returns the clients used for testing.
func PodRunningReady ¶
PodRunningReady checks whether pod p's phase is running and it has a ready condition of status true.
func WaitForPodCondition ¶
func WaitForPodCondition(c ctrlclient.Client, ns, podName, desc string, timeout time.Duration, condition podCondition) error
WaitForPodCondition waits a pods to be matched to the given condition.
func WaitForPodsCreated ¶
func WaitForPodsCreated(c ctrlclient.Client, replicas int, namespace string, matchLabels map[string]string) ([]string, error)
WaitForPodsCreated waits for the given replicas number of pods matching the given set of labels to be created, and returns the names of the matched pods.
Types ¶
type Deployer ¶
type Deployer struct { Log *zap.SugaredLogger Namespace string Versions kubermatic.Versions Client ctrlclient.Client // contains filtered or unexported fields }
Deployer helps setting up nodeport proxy for testing.
func (*Deployer) GetLbService ¶
GetLbService returns the service used to expose the nodeport proxy pods.
type NetworkingTestConfig ¶
type NetworkingTestConfig struct { Log *zap.SugaredLogger Namespace string Client ctrlclient.Client PodRestClient rest.Interface Config *rest.Config // HostTestContainerPod is a pod running using the hostexec image. HostTestContainerPod *corev1.Pod }
func (*NetworkingTestConfig) CleanUp ¶
func (n *NetworkingTestConfig) CleanUp() error
CleanUp deletes the resources.
func (*NetworkingTestConfig) DeployTestPod ¶
func (n *NetworkingTestConfig) DeployTestPod() error
DeployTestPod deploys the pod to be used to shoot the requests to the nodeport proxy service.
func (*NetworkingTestConfig) DialFromNode ¶
func (n *NetworkingTestConfig) DialFromNode(targetIP string, targetPort, maxTries, minTries int, expectedEps sets.String, https bool, args ...string) sets.String
Based on: https://github.com/mgdevstack/kubernetes/blob/9eced040142454a20255ae323279a38dc6b2bc1a/test/e2e/framework/network/utils.go#L347 DialFromNode executes a tcp request based on protocol via kubectl exec in a test container running with host networking.
- minTries is the minimum number of curl attempts required before declaring success. Set to 0 if you'd like to return as soon as all endpoints respond at least once.
- maxTries is the maximum number of curl attempts. If this many attempts pass and we don't see all expected endpoints, the test fails.
maxTries == minTries will confirm that we see the expected endpoints and no more for maxTries. Use this if you want to eg: fail a readiness check on a pod and confirm it doesn't show up as an endpoint.
type ServiceJig ¶
type ServiceJig struct { Log *zap.SugaredLogger Client ctrlclient.Client Namespace string Services []*corev1.Service ServicePods map[string][]string }
Based on: https://github.com/mgdevstack/kubernetes/blob/9eced040142454a20255ae323279a38dc6b2bc1a/test/e2e/framework/service/jig.go#L60 ServiceJig is a jig to help service testing.
func (*ServiceJig) CreateServiceWithPods ¶
func (n *ServiceJig) CreateServiceWithPods(svc *corev1.Service, numPods int32, https bool) (*corev1.Service, error)
CreateServiceWithPods deploys a service and the associated pods.