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

Attach Detach Controller CRD validations #68406

Closed
wants to merge 9 commits into from
Closed

Attach Detach Controller CRD validations #68406

wants to merge 9 commits into from

Conversation

hoegaarden
Copy link
Contributor

@hoegaarden hoegaarden commented Sep 7, 2018

What this PR does / why we need it:

@liggitt pointed out lack of validation may cause issues with watchers and listers. So we validation should be added.

Which issue(s) this PR fixes:
Fixes #68260

Special notes for your reviewer:

We are not sure if those validations are narrow enough -- we don't set any of the fields as mandatory, we do no specify any REs, min/max lengths, ...

Release note:

Add validations to volume A/D controller CRDs

/assign @kubernetes/sig-storage-pr-reviews

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/storage Categorizes an issue or PR as relevant to SIG Storage. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 7, 2018
@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Sep 7, 2018
@liggitt
Copy link
Member

liggitt commented Sep 7, 2018

Thanks for the pull request.

The minimum required is that we check the types of all the fields defined in the go types to ensure we can decode into the go types successfully.

@lavalamp requested the CRD be defined in a yaml file in the original API PR, and I agree with that request. Reviewing and tracking changes to API type definitions made in code like this is difficult and error prone.

Additionally, that yaml file should be in a package covered by API review and approval

/assign @lavalamp

@liggitt
Copy link
Member

liggitt commented Sep 7, 2018

/cc @saad-ali

@hoegaarden
Copy link
Contributor Author

@liggitt -- Thanks for your comments!

The minimum required is that we check the types of all the fields defined in the go types to ensure we can decode into the go types successfully.

I believe we have done that -- but let's check (again) once we've moved the CRD definition into yaml.

@lavalamp requested the CRD be defined in a yaml file in the original API PR, and I agree with that request. Reviewing and tracking changes to API type definitions made in code like this is difficult and error prone.

OK. Sorry, we didn't see that. Could you point us to that request?

We try to change the PR so that it loads the CRD definition from a file.

Additionally, that yaml file should be in a package covered by API review and approval

I am not sure what that exactly means. Could you please add more details on what that means for our PR?

Thanks!

/cc @mariantalla

@k8s-ci-robot
Copy link
Contributor

@hoegaarden: GitHub didn't allow me to request PR reviews from the following users: mariantalla.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

@liggitt -- Thanks for your comments!

The minimum required is that we check the types of all the fields defined in the go types to ensure we can decode into the go types successfully.

I believe we have done that -- but let's check (again) once we've moved the CRD definition into yaml.

@lavalamp requested the CRD be defined in a yaml file in the original API PR, and I agree with that request. Reviewing and tracking changes to API type definitions made in code like this is difficult and error prone.

OK. Sorry, we didn't see that. Could you point us to that request?

We try to change the PR so that it loads the CRD definition from a file.

Additionally, that yaml file should be in a package covered by API review and approval

I am not sure what that exactly means. Could you please add more details on what that means for our PR?

Thanks!

/cc @mariantalla

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.

@liggitt
Copy link
Member

liggitt commented Sep 7, 2018

OK. Sorry, we didn't see that. Could you point us to that request?

#67803 (comment) and again at #68159 (comment)

I am not sure what that exactly means. Could you please add more details on what that means for our PR?

The api definitions should be in a folder with an OWNERS file that looks something like:

options:
  no_parent_owners: true
reviewers:
  - api-reviewers
  - … any sig-storage reviewers desired
approvers:
  - api-approvers

@guineveresaenger
Copy link
Contributor

@LiGgit @hoegaarden - since the related issue is in the 1.12 milestone, can you make sure the labels match? Otherwise this will hang in CI as we're in code freeze.
Specifically, we are missing:

  • milestone
  • priority

Copy link
Member

@neolit123 neolit123 left a comment

Choose a reason for hiding this comment

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

thanks for the PR! @hoegaarden
added some minor styling and copy edit comments.


if err == nil {
glog.Infof("CSIDrivers CRD created successfully: %#v",
res)
Copy link
Member

Choose a reason for hiding this comment

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

please move this on the previous line. [1]

res)
} else if apierrors.IsAlreadyExists(err) {
glog.Warningf("CSIDrivers CRD already exists: %#v, err: %#v",
res, err)
Copy link
Member

Choose a reason for hiding this comment

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

[1]
also, just %v is fine for error

res, err)
} else {
glog.Errorf("failed to create CSIDrivers CRD: %#v, err: %#v",
res, err)
Copy link
Member

Choose a reason for hiding this comment

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

[1]
also, just %v is fine for error

t.Fatal("Expected to find validator for 'spec.attachRequired'")
}
if attachRequired.Type != "boolean" {
t.Fatalf("Expected 'spec.attachRequired' to have a type validator for boolean, got %s", attachRequired.Type)
Copy link
Member

Choose a reason for hiding this comment

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

got -> got: [2]

t.Fatal("Expected to find validator for 'csiDrivers'")
}
if drivers.Type != "array" {
t.Fatalf("Expected 'csiDrivers' to have a type validator for array, got %s", drivers.Type)
Copy link
Member

Choose a reason for hiding this comment

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

[2]


driver := schema.Properties["driver"]
if driver.Type != "string" {
t.Fatalf("Expected 'csiDrivers[].driver' to have a type validator for string, got %s", driver.Type)
Copy link
Member

Choose a reason for hiding this comment

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

[2]


nodeID := schema.Properties["nodeID"]
if nodeID.Type != "string" {
t.Fatalf("Expected 'csiDrivers[].nodeID' to have a type validator for string, got %s", nodeID.Type)
Copy link
Member

Choose a reason for hiding this comment

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

[2]


topologyKeys := schema.Properties["topologyKeys"]
if topologyKeys.Type != "array" {
t.Fatalf("Expected 'csiDrivers[].topologyKeys' to have a type validator for array, got %s", topologyKeys.Type)
Copy link
Member

Choose a reason for hiding this comment

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

[2]

}
topologyKeysSchema := topologyKeys.Items.Schema
if topologyKeysSchema.Type != "string" {
t.Fatalf("Expected 'csiDrivers[].topologyKeys[]' to have a type validator for string, got %s", topologyKeysSchema.Type)
Copy link
Member

Choose a reason for hiding this comment

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

[2]

"attachRequired": apiextensionsv1beta1.JSONSchemaProps{
Description: "Indicates this CSI volume driver requires an attach operation," +
" and that Kubernetes should call attach and wait for any attach operation to" +
" complete before proceeding to mounting.",
Copy link
Member

Choose a reason for hiding this comment

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

complete before proceeding to mounting -> complete before proceeding to mount
?

@neolit123
Copy link
Member

neolit123 commented Sep 7, 2018

/kind bug

also, you can run ./hack/update-gofmt.sh to make the verify test happy.

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Sep 7, 2018
@guineveresaenger
Copy link
Contributor

/milestone v 1.12
/priority critical-urgent

@hoegaarden please verify and rebase. merging this would make me so happy. :)

@k8s-ci-robot
Copy link
Contributor

@guineveresaenger: The provided milestone is not valid for this repository. Milestones in this repository: [next-candidate, v1.10, v1.11, v1.12, v1.13, v1.4, v1.5, v1.6, v1.7, v1.8, v1.9]

Use /milestone clear to clear the milestone.

In response to this:

/milestone v 1.12
/priority critical-urgent

@hoegaarden please verify and rebase. merging this would make me so happy. :)

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 the priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. label Sep 10, 2018
@hoegaarden
Copy link
Contributor Author

@guineveresaenger
We are still trying to understand what "... requested the CRD be defined in a yaml file in the original API PR, and I agree with that request ..." really means (see also the other PR and sig-storage slack). We hope to get some input regarding that and then hopefully do the code change.

@mariantalla

@guineveresaenger
Copy link
Contributor

/milestone v1.12

(missed that earlier)

@hoegaarden ack - thank you!

@k8s-ci-robot k8s-ci-robot added this to the v1.12 milestone Sep 10, 2018
@saad-ali
Copy link
Member

Thanks for working on this @hoegaarden. Ping me on slack when it is ready to review.

@lavalamp requested the CRD be defined in a yaml file in the original API PR, and I agree with that request. Reviewing and tracking changes to API type definitions made in code like this is difficult and error prone.

Additionally, that yaml file should be in a package covered by API review and approval

A separate yaml file would be nice to have, but for the sake of release blocker bug, not a requirement (no user visible impact) -- if it is too much work, we can split the file out in the next release, if needed.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 11, 2018
@hoegaarden
Copy link
Contributor Author

/test pull-kubernetes-bazel-build
/test pull-kubernetes-verify

Copy link
Member

@saad-ali saad-ali 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

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

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hoegaarden, saad-ali
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: lavalamp

If they are not already assigned, you can assign the PR to them by writing /assign @lavalamp in a comment when ready.

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

// CSIDriver generates a CRD captureing information about a Container Storage Interface (CSI)
// volume driver deployed on the cluster.
func CSIDriver() *apiextensionsv1beta1.CustomResourceDefinition {
return &apiextensionsv1beta1.CustomResourceDefinition{
Copy link
Member

Choose a reason for hiding this comment

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

The source of this really needs to be YAML. I don't care for the moment if it's embedded in a go string or stored in a file. But it must be YAML for review.

Actually I think you need to go one step further: generate the YAML from a types.go file and check that in. Humans really need to review that source.

@saad-ali
Copy link
Member

Followed up with @lavalamp @verult @msau42 offline.

We decided that for both #68260 and #68490 we are just going to remove automatic CRD installation by Attach/Detach controller. For alpha, user will have to manually install the CRD. In the next release we will come up with a proper mechanism for installing CRDs

Details here: #68519 (comment)

@saad-ali saad-ali closed this Sep 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/storage Categorizes an issue or PR as relevant to SIG Storage. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Attach Detach Controller Install CRD does not specify validation schema
8 participants