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

Add snapshot parameter flag #236

Merged

Conversation

wnxn
Copy link
Contributor

@wnxn wnxn commented Oct 31, 2019

Signed-off-by: Xin Wang wileywang@yunify.com

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #235

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Add '--csi.testsnapshotparameters' flag

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. labels Oct 31, 2019
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 31, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @wnxn. Thanks for your PR.

I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 31, 2019
@wnxn
Copy link
Contributor Author

wnxn commented Oct 31, 2019

/assign @pohly PTAL

@wnxn
Copy link
Contributor Author

wnxn commented Oct 31, 2019

/assign @pohly

Copy link
Contributor

@pohly pohly left a comment

Choose a reason for hiding this comment

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

Looks straight-forward, sorry for not getting to it earlier. Mostly looks good.

}
err = yaml.Unmarshal(yamlFile, &reqConfig.TestVolumeParameters)
if err != nil {
panic(fmt.Sprintf("error unmarshaling yaml: %v", err))
}
}

snapParamPath := reqConfig.TestSnapshotParametersFile
if len(snapParamPath) != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead copying the unmarshaling code from the reqConfig.TestVolumeParametersFile handling above, can you move it into a helper function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your review. I will amend my commit.

TestVolumeExpandSize int64
TestVolumeParametersFile string
TestVolumeParameters map[string]string
TestSnapshotParametersFile string
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add the new fields in a separate block (i.e. don't mix with TestVolumeExpand*) and add documentation? I know it's missing also for the other fields, but that's not a good example to follow 🤷‍♂️

@wnxn wnxn force-pushed the add-snapshot-parameter-flag branch from 6f14761 to b1cb447 Compare November 6, 2019 10:35
@@ -357,6 +354,22 @@ func loadSecrets(path string) (*CSISecrets, error) {
return &creds, nil
}

// loadMap reads a map from given file path.
func loadMap(path string) map[string]string {
Copy link
Contributor

@pohly pohly Nov 6, 2019

Choose a reason for hiding this comment

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

I think you can make this more generic:

func loadFromFile(from string, to interface{}) {
    if from != "" {
...
        err = yaml.Unmarshal(yamlFile, to)
...
    }
}

Then call it with:

loadFromFile(reqConfig.TestSnapshotParametersFile, &reqConfig.TestSnapshotParameters)

Untested, but I think it'll work, and then we have something that could also become useful for populating other data structures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I will update and test it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @pohly , The method is worked and I updated this PR. Would you please review again?

Signed-off-by: Xin Wang <wileywang@yunify.com>
@wnxn wnxn force-pushed the add-snapshot-parameter-flag branch from b1cb447 to e0947e1 Compare November 6, 2019 12:59
Copy link
Contributor

@pohly pohly left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

Thanks for taking the time to enhance csi-test!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 6, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pohly, wnxn

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 6, 2019
@k8s-ci-robot k8s-ci-robot merged commit d305288 into kubernetes-csi:master Nov 6, 2019
stmcginnis pushed a commit to stmcginnis/csi-test that referenced this pull request Oct 9, 2024
…driver-host-path_version

Bump csi-driver-host-path version up to v1.12.0
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/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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 snapshot parameters file flag
3 participants