-
Notifications
You must be signed in to change notification settings - Fork 160
Add test support for regional PD #621
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
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mattcary The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/assign @verult |
test/k8s-integration/cluster.go
Outdated
@@ -30,6 +30,10 @@ func gkeLocationArgs(gceZone, gceRegion string) (locationArg, locationVal string | |||
return | |||
} | |||
|
|||
func isRegionalGKECluster(gzeZone, gceRegion string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: "gzeZone"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -270,6 +272,14 @@ func handle() error { | |||
testDir = k8sDir | |||
} | |||
|
|||
if *deploymentStrat == "gke" { | |||
gkeRegional := isRegionalGKECluster(*gceZone, *gceRegion) | |||
if *isRegionalCluster && !gkeRegional { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we enforce that only one of gceZone
and gceRegion
could be set? Then we know the cluster is regional if len(*gceRegion) > 0
and we don't need the --is-regional-cluster
flag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need --is-regional-cluster for when you're using a pre-existing cluster---you don't set the region or zone in that case and just use your current kubeconfig.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we already check that only one of these is set in main.go:112
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha sounds good
nit: maybe make this field targeted to pre-existing clusters only, i.e. only make the flag settable if gceZone
and gceRegion
are unset, and update the flag description. Otherwise it could get confusing for someone new to understand when is-regional-cluster
should be set just from looking at the flag description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(added in the bringupCluster check)
test/k8s-integration/main.go
Outdated
continue | ||
} | ||
if scFile == regionalPDStorageClass && !*isRegionalCluster { | ||
continue // Regional PDs cannot be used in a zonal cluster. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to log a warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, especially considering the following comment about making the storage classes more precise when a regional cluster isn't being run.
test/run-k8s-integration-ci.sh
Outdated
--storageclass-files=sc-standard.yaml,sc-balanced.yaml,sc-ssd.yaml --snapshotclass-file=pd-volumesnapshotclass.yaml \ | ||
--do-driver-build=${do_driver_build} --teardown-driver=${teardown_driver} \ | ||
--boskos-resource-type=${boskos_resource_type} \ | ||
--storageclass-files=sc-standard.yaml,sc-balanced.yaml,sc-ssd.yaml,sc-regional.yaml \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Set this flag in the [ -z "$gce_region" ]
branch so it's more explicit that sc-regional.yaml
is only expected to work in regional clusters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great point, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, I could add the tag after the new commits come in
@@ -270,6 +272,14 @@ func handle() error { | |||
testDir = k8sDir | |||
} | |||
|
|||
if *deploymentStrat == "gke" { | |||
gkeRegional := isRegionalGKECluster(*gceZone, *gceRegion) | |||
if *isRegionalCluster && !gkeRegional { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha sounds good
nit: maybe make this field targeted to pre-existing clusters only, i.e. only make the flag settable if gceZone
and gceRegion
are unset, and update the flag description. Otherwise it could get confusing for someone new to understand when is-regional-cluster
should be set just from looking at the flag description
In the push above I changed the CI script to only use the regional SC on a regional cluster. I don't know if there's a good way to test that change? |
Yeah letting it run on CI might be the easiest, altho the other changes besides the script could be tested by updating one of the local scripts |
I ran what I could through local testing (--is-regional, etc). |
/lgtm |
secrets flake. /test pull-gcp-compute-persistent-disk-csi-driver-kubernetes-integration |
/kind cleanup
What this PR does / why we need it:
Add regional PD to tests.
Fixes #408