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: merge OpenAPI specs once after cache sync #75399

Open
wants to merge 1 commit into
base: master
from

Conversation

@sttts
Copy link
Contributor

sttts commented Mar 15, 2019

Without this PR we wait for informer events and then update CRD by CRD on the initial list during startup.

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

k8s-ci-robot commented Mar 15, 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.

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

k8s-ci-robot commented Mar 15, 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

This comment has been minimized.

Copy link
Contributor Author

sttts commented Mar 15, 2019

@sttts sttts force-pushed the sttts:sttts-initial-bulk-openapi-merge branch from 4f92d2e to 8d0e514 Mar 15, 2019

@roycaihw
Copy link
Member

roycaihw left a comment

looks good in general. I left a few nits

@@ -89,6 +90,30 @@ func (c *Controller) Run(staticSpec *spec.Swagger, openAPIService *handler.OpenA
return
}

// create initial spec to avoid merging once per CRD on startup
crds, err := c.crdLister.List(labels.Everything())
if err != nil && !errors.IsNotFound(err) {

This comment has been minimized.

@roycaihw

roycaihw Mar 15, 2019

Member

crdLister.List doesn't return NotFound error

nit: it could be weird if crds and err were both set, but in current implementation I think no error will be returned for labels.Everything()

}
newSpecs, changed, err := buildVersionSpecs(crd, nil)
if err != nil {
klog.Warningf("failed to build OpenAPI spec of CRD %s: %v", crd.Name, err)

This comment has been minimized.

@roycaihw

roycaihw Mar 15, 2019

Member

use utilruntime.HandleError instead of klog to be consistent with the handling used by sync

nit: could be weird if changed and err were both set. Maybe add continue here as well?

This comment has been minimized.

@roycaihw

roycaihw Mar 18, 2019

Member

feel free to tag this PR if klog is preferable to utilruntime.HandleError

@caesarxuchao

This comment has been minimized.

Copy link
Member

caesarxuchao commented Mar 18, 2019

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.