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

[V2] chore: add BYO storage class for pod-failover tests #1440

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 test/podFailover/automation-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,5 @@ spec:
- "--test-name=$(TEST_NAME)"
- "--auth-enabled=$(AUTH_ENABLED)"
- "--all-pods-on-one-node=$(BOOL_ALL_PODS_ON_SAME_NODE)"
- "--storage-class-name=$(STORAGE_CLASS_NAME)"
restartPolicy: Never
14 changes: 10 additions & 4 deletions test/podFailover/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ var (
delayBeforeFailover = flag.Int("delay-before-failover", 0, "Time in seconds for which the controller should wait before failing the pod")
deployAllPodsOnOneNode = flag.Bool("all-pods-on-one-node", false, "Specify whether to deploy all the pods on the same node")
testName = flag.String("test-name", "default-test-run", "The name of the test to be used as metrics label to distinguish metrics sent from multiple test runs")
storageClassName = flag.String("storage-class-name", "", "Name of storage class if provisioning beforehand")
)

func main() {
Expand All @@ -89,10 +90,15 @@ func main() {
if deleteNamespace {
defer deleteTestNamespace(ctx, clientset)
}
scName, err := createStorageClass(ctx, clientset, *maxShares)
if err != nil {
klog.Errorf("Error occurred while creating storageClass: %v", err)
return
var scName string
if *storageClassName != "" {
scName = *storageClassName
} else {
scName, err = createStorageClass(ctx, clientset, *maxShares)
if err != nil {
klog.Errorf("Error occurred while creating storageClass: %v", err)
return
}
}
defer deleteStorageClass(ctx, clientset, scName)

Expand Down