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

Update the run containers to be a generic list of containers. #267

Merged
merged 5 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
51 changes: 9 additions & 42 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 containers. The container for the test driver is always
// the first container on the list.
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
// the actual test.
Run Run `json:"run"`
// Run describes a list of run containers. The container for the test server is always
// the first container on the list.
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
// the actual test.
Run Run `json:"run"`
// Run describes a list of run containers. The container for the test client is always
// the first container on the list.
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
5 changes: 3 additions & 2 deletions config/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ const (
RoleLabel = "loadtest-role"

// RunContainerName holds the name of the main container where the test is
// executed.
RunContainerName = "run"
// executed. The runtime for the test may contain multiple run containers.
// The main container is always the first container on the list.
RunContainerName = "main"

// ScenariosFileEnv specifies the name of an env variable that specifies the
// path to a JSON file with scenarios.
Expand Down
Loading