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

apiextensions: publish (only) structural OpenAPI schemas #77554

Merged
merged 3 commits into from May 21, 2019

Conversation

@sttts
Copy link
Contributor

commented May 7, 2019

This switch OpenAPI publishing over to structural schemas:

  1. only structural schemas published
  2. the go-openapi schema generation and OpenAPI v2 conversion goes through structural schema in order to simplify the logic and to remove go-openapi dependencies.

This is based on #77333. I.e. only the last commits are relevant here.

Publishing of CustomResourceDefinition validation schemas as part of /openapi/v2 (alpha feature, behind the CustomResourcePublishOpenAPI feature gate) is restricted to structural schemas only. CRDs with schemas which are not structural have the NonStructuralSchema condition set with the violations.
@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented May 7, 2019

@sttts: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

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.

@fejta-bot

This comment has been minimized.

Copy link

commented May 7, 2019

This PR may require API review.

If so, when the changes are ready, complete the pre-review checklist and request an API review.

Status of requested reviews is tracked in the API Review project.

@sttts sttts force-pushed the sttts:sttts-structural-publishing branch 3 times, most recently from 01e1455 to a48a7b6 May 7, 2019

@soltysh
soltysh approved these changes May 9, 2019
Copy link
Contributor

left a comment

One question, rest lgtm.

SchemaProps: spec.SchemaProps{Type: []string{"object"}},
}
// no, we cannot add more properties here, not even TypeMeta/ObjectMeta because kubectl will complain about
// unknown fields for anything else.
} else {
schema.SetProperty("metadata", *spec.RefSchema(objectMetaSchemaRef).
if v2 {

This comment has been minimized.

Copy link
@soltysh

soltysh May 9, 2019

Contributor

This is always true from what I'm seeing, why we need it like that right now? Or am I missing something?

This comment has been minimized.

Copy link
@sttts

sttts May 9, 2019

Author Contributor

We will publish v3 at some point. This is the start for that.

@sttts sttts force-pushed the sttts:sttts-structural-publishing branch 2 times, most recently from b806f34 to 05b9d37 May 9, 2019

@sttts sttts force-pushed the sttts:sttts-structural-publishing branch from 07632a1 to b92fc78 May 17, 2019

@sttts sttts force-pushed the sttts:sttts-structural-publishing branch 2 times, most recently from 3c4301c to 203a52d May 17, 2019

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented May 17, 2019

[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 force-pushed the sttts:sttts-structural-publishing branch from 203a52d to 086950b May 17, 2019

@sttts sttts force-pushed the sttts:sttts-structural-publishing branch from 086950b to d01e942 May 18, 2019

@roycaihw
Copy link
Member

left a comment

looks pretty good. I left some questions

}

if s.AnyOf == nil {
s.AnyOf = []NestedValueValidation{

This comment has been minimized.

Copy link
@roycaihw

roycaihw May 20, 2019

Member

currently for publishing v2 schema, the unfolded validation is dropped later by v3 -> v2 conversion?

This comment has been minimized.

Copy link
@sttts

sttts May 20, 2019

Author Contributor

yes, I keep them complete here, with v3 publishing in mind we might want to add in 1.16.

@@ -160,6 +160,7 @@ func TestCRDOpenAPI(t *testing.T) {
},
Validation: &apiextensionsv1beta1.CustomResourceValidation{
OpenAPIV3Schema: &apiextensionsv1beta1.JSONSchemaProps{
Type: "object",

This comment has been minimized.

Copy link
@roycaihw

roycaihw May 20, 2019

Member

is the root type still optional? or is there any new validation?

This comment has been minimized.

Copy link
@sttts

sttts May 20, 2019

Author Contributor

it's needed now for structural schemas, yes. We require structural schemas for publishing.

{"with extensions as v3 schema",
`
{
"type":"object",

This comment has been minimized.

Copy link
@roycaihw

roycaihw May 20, 2019

Member

nit: extra trailing white space (also in L64)

@roycaihw

This comment has been minimized.

Copy link
Member

commented May 20, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm label May 20, 2019

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented May 20, 2019

@sttts: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-local-e2e 05b9d37 link /test pull-kubernetes-local-e2e

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@fejta-bot

This comment has been minimized.

Copy link

commented May 21, 2019

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@k8s-ci-robot k8s-ci-robot merged commit 9380416 into kubernetes:master May 21, 2019

20 checks passed

cla/linuxfoundation sttts authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-conformance-image-test Skipped.
pull-kubernetes-cross Skipped.
pull-kubernetes-dependencies Job succeeded.
Details
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-csi-serial Skipped.
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gce-storage-slow Skipped.
pull-kubernetes-godeps Skipped.
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-local-e2e Skipped.
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
pull-publishing-bot-validate Skipped.
tide In merge pool.
Details
@roycaihw

This comment has been minimized.

Copy link
Member

commented Sep 17, 2019

/area custom-resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.