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

apiextensions: allow "required" at root with status subresource #63533

Merged
merged 1 commit into from May 9, 2018

Conversation

Projects
None yet
5 participants
@sttts
Contributor

sttts commented May 8, 2018

In the subresources alpha we intentionally disallowed anything than properties at the root of the validation schema in order to allow us to project it to the .status subtree. By doing this we also disallowed required at the root which is necessary to enforce e.g. a spec to be set. This PR fixes this.

Moreover, it fixes that the restriction is only enforced when the status subresource is actually enabled. Before this PR we were enforcing the restriction as soon as the feature gate was enabled, leading to a backwards incompatible change.

Allow "required" and "description" to be used at the CRD OpenAPI validation schema root when the /status subresource is enabled.

There was an issue reporting the bug. But cannot find it.

@xmudrii

This comment has been minimized.

Member

xmudrii commented May 8, 2018

LGTM.

allErrs = append(allErrs, field.Invalid(fldPath.Child("openAPIV3Schema"), *schema, fmt.Sprintf("if subresources for custom resources are enabled, only properties can be used at the root of the schema")))
return allErrs
if name := v.Type().Field(i).Name; name != "Properties" && name != "Required" {
allErrs = append(allErrs, field.Invalid(fldPath.Child("openAPIV3Schema"), *schema, fmt.Sprintf(`if subresources for custom resources are enabled, only "properties" and "required" can be used at the root of the schema`)))

This comment has been minimized.

@nikhita

nikhita May 9, 2018

Member

Since we are only allowing this for status, I think the error message should be something like "if status subresource is enabled..."

This comment has been minimized.

@sttts

sttts May 9, 2018

Contributor

updated

@nikhita

This comment has been minimized.

Member

nikhita commented May 9, 2018

There is an integration test which checks that nothing other than properties should be present at the root, this is failing now. I guess we can remove that test.

Apart from these, lgtm. 👍

@sttts

This comment has been minimized.

Contributor

sttts commented May 9, 2018

Test fixed.

@sttts

This comment has been minimized.

Contributor

sttts commented May 9, 2018

Volume flake.

/retest

@sttts

This comment has been minimized.

Contributor

sttts commented May 9, 2018

/retest
/lgtm

@k8s-ci-robot

This comment has been minimized.

Contributor

k8s-ci-robot commented May 9, 2018

@sttts: you cannot LGTM your own PR.

In response to this:

/retest
/lgtm

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

This comment has been minimized.

Contributor

k8s-ci-robot commented May 9, 2018

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sttts

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

@sttts sttts added the lgtm label May 9, 2018

@k8s-merge-robot

This comment has been minimized.

Contributor

k8s-merge-robot commented May 9, 2018

Automatic merge from submit-queue (batch tested with PRs 59034, 63565, 63533). If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-merge-robot k8s-merge-robot merged commit ca76734 into kubernetes:master May 9, 2018

16 checks passed

Submit Queue Queued to run github e2e tests a second time.
Details
cla/linuxfoundation sttts authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-cross Skipped
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gke Skipped
pull-kubernetes-e2e-kops-aws Job succeeded.
Details
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce Job succeeded.
Details
pull-kubernetes-local-e2e Skipped
pull-kubernetes-local-e2e-containerized Skipped
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details

@nikhita nikhita referenced this pull request Jun 5, 2018

Open

Umbrella issue for CRDs moving to GA #58682

17 of 53 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment