Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connectivity: misc conn-disrupt-test improvements #2474

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cli/connectivity.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ func newCmdConnectivityTest(hooks api.Hooks) *cobra.Command {
cmd.Flags().StringVar(&params.CurlImage, "curl-image", defaults.ConnectivityCheckAlpineCurlImage, "Image path to use for curl")
cmd.Flags().StringVar(&params.JSONMockImage, "json-mock-image", defaults.ConnectivityCheckJSONMockImage, "Image path to use for json mock")
cmd.Flags().StringVar(&params.DNSTestServerImage, "dns-test-server-image", defaults.ConnectivityDNSTestServerImage, "Image path to use for CoreDNS")
cmd.Flags().StringVar(&params.TestConnDisruptImage, "test-conn-disrupt-image", defaults.ConnectivityTestConnDisruptImage, "Image path to use for connection disruption tests")

cmd.Flags().UintVar(&params.Retry, "retry", defaults.ConnectRetry, "Number of retries on connection failure to external targets")
cmd.Flags().DurationVar(&params.RetryDelay, "retry-delay", defaults.ConnectRetryDelay, "Delay between retries for external targets")
Expand Down
1 change: 1 addition & 0 deletions connectivity/check/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type Parameters struct {
CurlImage string
PerformanceImage string
JSONMockImage string
TestConnDisruptImage string
AgentDaemonSetName string
DNSTestServerImage string
IncludeUnsafeTests bool
Expand Down
16 changes: 12 additions & 4 deletions connectivity/check/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"context"
"fmt"
"sort"
"strconv"
"strings"
"sync"
"time"
Expand All @@ -17,6 +16,7 @@ import (
corev1 "k8s.io/api/core/v1"
networkingv1 "k8s.io/api/networking/v1"
k8sErrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/intstr"
Expand Down Expand Up @@ -79,6 +79,7 @@ type deploymentParameters struct {
Affinity *corev1.Affinity
NodeSelector map[string]string
ReadinessProbe *corev1.Probe
Resources corev1.ResourceRequirements
Labels map[string]string
Annotations map[string]string
HostNetwork bool
Expand Down Expand Up @@ -146,6 +147,7 @@ func newDeployment(p deploymentParameters) *appsv1.Deployment {
ImagePullPolicy: corev1.PullIfNotPresent,
Command: p.Command,
ReadinessProbe: p.ReadinessProbe,
Resources: p.Resources,
SecurityContext: &corev1.SecurityContext{
Capabilities: &corev1.Capabilities{
Add: []corev1.Capability{"NET_RAW"},
Expand Down Expand Up @@ -430,12 +432,15 @@ func (ct *ConnectivityTest) deploy(ctx context.Context) error {
testConnDisruptServerDeployment := newDeployment(deploymentParameters{
Name: testConnDisruptServerDeploymentName,
Kind: KindTestConnDisrupt,
Image: "quay.io/cilium/test-connection-disruption:v0.0.13",
Image: ct.params.TestConnDisruptImage,
Replicas: 3,
Labels: map[string]string{"app": "test-conn-disrupt-server"},
Command: []string{"tcd-server", "8000"},
Port: 8000,
ReadinessProbe: readinessProbe,
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{corev1.ResourceCPU: *resource.NewMilliQuantity(100, resource.DecimalSI)},
},
})
_, err = ct.clients.src.CreateServiceAccount(ctx, ct.params.TestNamespace, k8s.NewServiceAccount(testConnDisruptServerDeploymentName), metav1.CreateOptions{})
if err != nil {
Expand Down Expand Up @@ -482,15 +487,18 @@ func (ct *ConnectivityTest) deploy(ctx context.Context) error {
testConnDisruptClientDeployment := newDeployment(deploymentParameters{
Name: testConnDisruptClientDeploymentName,
Kind: KindTestConnDisrupt,
Image: "quay.io/cilium/test-connection-disruption:v0.0.13",
Image: ct.params.TestConnDisruptImage,
Replicas: 5,
Labels: map[string]string{"app": "test-conn-disrupt-client"},
Command: []string{
"tcd-client",
"--dispatch-interval", strconv.Itoa(int(ct.params.ConnDisruptDispatchInterval.Milliseconds())),
"--dispatch-interval", ct.params.ConnDisruptDispatchInterval.String(),
fmt.Sprintf("test-conn-disrupt.%s.svc.cluster.local.:8000", ct.params.TestNamespace),
},
ReadinessProbe: readinessProbe,
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{corev1.ResourceCPU: *resource.NewMilliQuantity(100, resource.DecimalSI)},
},
})

_, err = ct.clients.dst.CreateServiceAccount(ctx, ct.params.TestNamespace, k8s.NewServiceAccount(testConnDisruptClientDeploymentName), metav1.CreateOptions{})
Expand Down
2 changes: 2 additions & 0 deletions defaults/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ const (
ConnectivityCheckJSONMockImage = "quay.io/cilium/json-mock:v1.3.8@sha256:5aad04835eda9025fe4561ad31be77fd55309af8158ca8663a72f6abb78c2603"
// renovate: datasource=docker
ConnectivityDNSTestServerImage = "docker.io/coredns/coredns:1.11.1@sha256:1eeb4c7316bacb1d4c8ead65571cd92dd21e27359f0d4917f1a5822a73b75db1"
// renovate: datasource=docker
ConnectivityTestConnDisruptImage = "quay.io/cilium/test-connection-disruption:v0.0.14@sha256:8b489a89c38ae2be4f93bdeb354a8f85a6ce204f5e104915a2d6fe99f7f5997e"

ConfigMapName = "cilium-config"

Expand Down
Loading