-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Raul Sevilla <[email protected]>
- Loading branch information
1 parent
842a364
commit 9d1bc90
Showing
6 changed files
with
190 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package drivers | ||
|
||
import ( | ||
"bytes" | ||
|
||
"github.com/cloud-bulldozer/k8s-netperf/pkg/config" | ||
"github.com/cloud-bulldozer/k8s-netperf/pkg/sample" | ||
apiv1 "k8s.io/api/core/v1" | ||
"k8s.io/client-go/kubernetes" | ||
"k8s.io/client-go/rest" | ||
) | ||
|
||
type Driver interface { | ||
IsTestSupported(string) bool | ||
Run(c *kubernetes.Clientset, rc rest.Config, nc config.Config, client apiv1.PodList, serverIP string) (bytes.Buffer, error) | ||
ParseResults(stdout *bytes.Buffer) (sample.Sample, error) | ||
} | ||
|
||
type netperf struct { | ||
driverName string | ||
} | ||
|
||
type iperf3 struct { | ||
driverName string | ||
} | ||
|
||
type uperf struct { | ||
driverName string | ||
} | ||
|
||
// NewDriver creates a new driver based on the provided driver name. | ||
// | ||
// It takes a string parameter `driverName` and returns a Driver. | ||
func NewDriver(driverName string) Driver { | ||
switch driverName { | ||
case "iperf3": | ||
return &iperf3{ | ||
driverName: driverName, | ||
} | ||
case "uperf": | ||
return &uperf{ | ||
driverName: driverName, | ||
} | ||
default: | ||
return &netperf{ | ||
driverName: driverName, | ||
} | ||
} | ||
} |
Oops, something went wrong.