Skip to content

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

Merged
merged 1 commit into from
Oct 12, 2020

Conversation

mattcary
Copy link
Contributor

@mattcary mattcary commented Oct 3, 2020

/kind cleanup

What this PR does / why we need it:
Add regional PD to tests.

Fixes #408

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 3, 2020
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 3, 2020
@mattcary
Copy link
Contributor Author

mattcary commented Oct 3, 2020

/assign @verult

@@ -30,6 +30,10 @@ func gkeLocationArgs(gceZone, gceRegion string) (locationArg, locationVal string
return
}

func isRegionalGKECluster(gzeZone, gceRegion string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: "gzeZone"

Copy link
Contributor Author

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 {
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea will do.

Copy link
Contributor Author

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)

continue
}
if scFile == regionalPDStorageClass && !*isRegionalCluster {
continue // Regional PDs cannot be used in a zonal cluster.
Copy link
Contributor

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?

Copy link
Contributor Author

@mattcary mattcary Oct 6, 2020

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.

--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 \
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great point, thanks.

Copy link
Contributor

@verult verult left a 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 {
Copy link
Contributor

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

@mattcary
Copy link
Contributor Author

mattcary commented Oct 7, 2020

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?

@verult
Copy link
Contributor

verult commented Oct 8, 2020

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

@mattcary
Copy link
Contributor Author

mattcary commented Oct 8, 2020

I ran what I could through local testing (--is-regional, etc).

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 11, 2020
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 12, 2020
@verult
Copy link
Contributor

verult commented Oct 12, 2020

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 12, 2020
@mattcary
Copy link
Contributor Author

secrets flake.

/test pull-gcp-compute-persistent-disk-csi-driver-kubernetes-integration

@k8s-ci-robot k8s-ci-robot merged commit 12ea362 into kubernetes-sigs:master Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add another storageclass test config to use Regional PDs in our external e2e
3 participants