Skip to content

Commit

Permalink
Update the run containers to be a generic list of containers.
Browse files Browse the repository at this point in the history
  • Loading branch information
wanlin31 committed Feb 3, 2022
1 parent e481794 commit 3f6dd0c
Show file tree
Hide file tree
Showing 17 changed files with 3,457 additions and 664 deletions.
47 changes: 7 additions & 40 deletions api/v1/loadtest_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,39 +79,6 @@ type Build struct {
Env []corev1.EnvVar `json:"env,omitempty"`
}

// Run defines expectations regarding the runtime environment for the
// test component itself.
type Run struct {
// Image is the name of the container image that provides the
// runtime for the test component.
//
// This field is optional when a Language is specified on the
// Component. For example, a developer may specify a "python3"
// client. This field will be implicitly set to the most recent
// supported python3 image.
// +optional
Image *string `json:"image,omitempty"`

// Command is the path to the executable that will run the component
// of the test. When unset, the entrypoint of the container image
// will be used.
// +optional
Command []string `json:"command,omitempty"`

// Args provide command line arguments to the command.
// +optional
Args []string `json:"args,omitempty"`

// Env are environment variables that should be set within the
// running container.
// +optional
Env []corev1.EnvVar `json:"env,omitempty"`

// VolumeMounts permit sharing directories across containers.
// +optional
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
}

// Driver defines a component that orchestrates the server and clients in the
// test.
type Driver struct {
Expand Down Expand Up @@ -159,9 +126,9 @@ type Driver struct {
// +optional
Build *Build `json:"build,omitempty"`

// Run describes the run container, which is the runtime of the driver for
// the actual test.
Run Run `json:"run"`
// Run describes a list of run container, where the first container is the
// runtime of the driver for the actual test.
Run []corev1.Container `json:"run"`
}

// Server defines a component that receives traffic from a set of client
Expand Down Expand Up @@ -211,9 +178,9 @@ type Server struct {
// +optional
Build *Build `json:"build,omitempty"`

// Run describes the run container, which is the runtime of the server for
// Run describes a list of run container, , which is the runtime of the server for
// the actual test.
Run Run `json:"run"`
Run []corev1.Container `json:"run"`
}

// Client defines a component that sends traffic to a server component.
Expand Down Expand Up @@ -265,9 +232,9 @@ type Client struct {
// +optional
Build *Build `json:"build,omitempty"`

// Run describes the run container, which is the runtime of the client for
// Run describes a list of run container, , which is the runtime of the client for
// the actual test.
Run Run `json:"run"`
Run []corev1.Container `json:"run"`
}

// Results defines where and how test results and artifacts should be
Expand Down
68 changes: 21 additions & 47 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions cmd/client_test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ func main() {
Command: []string{"go"},
Args: []string{"build", "-o", "/src/workspace/bin/worker", "./benchmark/worker"},
},
Run: grpcv1.Run{
Run: []corev1.Container{{
Command: []string{"/src/workspace/bin/worker"},
},
}},
},
},
Clients: []grpcv1.Client{
Expand All @@ -130,9 +130,9 @@ func main() {
Command: []string{"go"},
Args: []string{"build", "-o", "/src/workspace/bin/worker", "./benchmark/worker"},
},
Run: grpcv1.Run{
Run: []corev1.Container{{
Command: []string{"/src/workspace/bin/worker"},
},
}},
},
},
TimeoutSeconds: 900,
Expand Down
10 changes: 7 additions & 3 deletions config/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ const (
// example, "loadtest-role=server" indicates a server component.
RoleLabel = "loadtest-role"

// RunContainerName holds the name of the main container where the test is
// executed.
RunContainerName = "run"
// RunContainerListName holds the name of the list of containers that run
// simultaneously after the init containers.
RunContainerListName = "run"

// ScenariosFileEnv specifies the name of an env variable that specifies the
// path to a JSON file with scenarios.
Expand All @@ -122,6 +122,10 @@ const (
// the init containers and containers for a driver or worker pod.
WorkspaceVolumeName = "workspace"

// WorkerContainerName holds the name of the worker container where the test is
// executed.
WorkerContainerName = "worker"

// KillAfterEnv specifies the name of the env variable that sets the allowed response time for a pod after timeout.
KillAfterEnv = "KILL_AFTER"

Expand Down
Loading

0 comments on commit 3f6dd0c

Please sign in to comment.