Hide Forgot
When new CustomResourceDefinitions or APIServices are added to the cluster (for instance by installing an Operator), their JSONSchema will be added to the /openapi/v2 endpoint. Console will register the new models using API discovery, but does not refresh the OpenAPI definitions in localStorage (used for YAML editor autocomplete, etc). This document is only refreshed once per day because it is very large to download. Solution is to refresh the openapi/v2 endpoint whenever new models are added (can compare GroupVersionKinds for registered models versus stored OpenAPI definitions).
Will address next sprint.
OpenAPI definitions are no longer stored in local storage as of https://github.com/openshift/console/pull/6227. We now rely on browser cache for optimization.
This should still be an issue since we keep the definitions in memory and only refresh on console load. We'll need to fetch the document again after running API discovery.
My mistake. At first glance at your PR, it looked like it would fix this, but now I see that it still only gets updated when `fetchSwagger` is called.
Briefly looked into this, but haven't had a chance to dig in to it. Will address in upcoming sprint.
Still haven't gotten to this yet. Did a little bit of exploration for possible approaches. Essentially, I think we are going to need a global watch to make sure that the schema definitions stay up to date.
Still haven't had a chance to research a solution for this yet.
(In reply to Jon Jackson from comment #7) > Still haven't gotten to this yet. Did a little bit of exploration for > possible approaches. Essentially, I think we are going to need a global > watch to make sure that the schema definitions stay up to date. Hey, Jon. We do have a global watch on API services that triggers an update to API discovery: https://github.com/spadgett/console/blob/d3fa4db55a58c1e4dbfc5d2c59b3b073653dbcfd/frontend/public/actions/k8s.ts#L281-L315 We might just want to refresh the OpenAPI doc whenever we call `getResources`. The endpoint uses ETags and browser caching, so there should be no significant overhead when the document hasn't changed.
(In reply to Samuel Padgett from comment #9) > (In reply to Jon Jackson from comment #7) > > Still haven't gotten to this yet. Did a little bit of exploration for > > possible approaches. Essentially, I think we are going to need a global > > watch to make sure that the schema definitions stay up to date. > > Hey, Jon. We do have a global watch on API services that triggers an update > to API discovery: > > https://github.com/spadgett/console/blob/ > d3fa4db55a58c1e4dbfc5d2c59b3b073653dbcfd/frontend/public/actions/k8s.ts#L281- > L315 > > We might just want to refresh the OpenAPI doc whenever we call > `getResources`. The endpoint uses ETags and browser caching, so there should > be no significant overhead when the document hasn't changed. Great, thanks for the pointer.
PR pending
Checked on ocp 4.7 with payload: 4.7.0-0.nightly-2020-11-11-033756. Install etcd operator in project, then there is new api: EtcdCluster, EtcdBackup, EtcdRestore. In yaml creation, try to set kind using auto complete, but it doesn't show the new api in suggestion list. Refer to the screenshot. @Jon, if my steps are correct to check the bug?
Created attachment 1728278 [details] auto-complete-suggestion
Created attachment 1729883 [details] Mock CRD with structural schema
(In reply to Yanping Zhang from comment #13) > Checked on ocp 4.7 with payload: 4.7.0-0.nightly-2020-11-11-033756. > Install etcd operator in project, then there is new api: EtcdCluster, > EtcdBackup, EtcdRestore. In yaml creation, try to set kind using auto > complete, but it doesn't show the new api in suggestion list. Refer to the > screenshot. > @Jon, if my steps are correct to check the bug? Yanping, I've attached a YAML file with a CRD that has a valid structural schema. You should be able to create this resource, then after a 10 second delay, it should populate in the suggestions for "kind" as "MockResource". The etcd CRDs do not have valid structural schemas, which is why they were not showing up.
Thanks, Jon, the file works. Checked on ocp 4.7 cluster with payload 4.7.0-0.nightly-2020-11-12-200927. Created CRD "mock-resources.test.tectonic.com" with yaml in attachment, then create yaml, for "kind", input "Mo", and use ctrl+space key to show suggestion, there is "MockResource" shown in the list. The bug is fixed.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: OpenShift Container Platform 4.7.0 security, bug fix, and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2020:5633