console
console copied to clipboard
Introduce package kube-types: add generators for OpenShift and KubeVirt TypeScript definitions
This PR adds complete types with documentation for all Kubernetes/OpenShift/KubeVirt objects (please see old #1773 for more details).
The types are generated from OpenAPI specification taken from
- openshift(https://github.com/openshift/origin/tree/master/api/swagger-spec)
- kubevirt (https://github.com/kubevirt/kubevirt/tree/master/api/openapi-spec)
This PR uses openapi-generator instead of autorest which was mentioned in the last PR.
I found many problems with autorest:
- unstable (crashes on quite a lot of nodejs versions)
- slow
- incorrect parsing of kubevirt's
swagger.json.
openapi-generator worked quite well for me, but I still had to do few necessary changes in post processing phase.
Algorithm:
- download current API Spec file (or add a custom URL to
ENVvariable) - process the spec file (remove
pathskey to inhibit API generation ) - run
openapi-generatorwhich should generate just the models - for each generated file:
- remove unnecessary functions (like
IoK8sApiCoreV1SecretFromJSON) - remove unnecessary imports (like
import { exists, mapValues } from '../runtime';) for these functions - import each file specifically instead of from
'./'to prevent circular dependencies - replace occurrences for example of
IoK8sApiCoreV1PodwithV1Pod
- remove unnecessary functions (like
- run ESLint to enforce our formatting rules onto the generated files
@spadgett @alecmerdler @christianvogt @vojtechszocs
Hi @suomiy. Thanks for your PR.
I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test label.
I understand the commands that are listed here.
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.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: suomiy
To complete the pull request process, please assign alecmerdler
You can assign the PR to them by writing /assign @alecmerdler in a comment when ready.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
/assign @alecmerdler
/test e2e-aws-console-olm
@alecmerdler can you please take a look?
Things to consider:
-
we could generate the types just for development and not commit them into the repo. We would generate them each time
yarn installoryarn devis called. The generated files could be cached by comparing the commit hash ofswagger.json. Main disadvantages:- our build depends on other repo (GH availability ) and location of certain file
- we should lock our build to a release branch/tag of openshift/kubevirt to prevent building with potential breaking changes of the API. New versions still would have to be updated manually.
- longer build time; +25s on my machine
-
currently, I am linting the generated files, but this step could be skipped by adding
packages/kube-typesinto.eslintignore
/retest
In general, I like the idea of having comprehensive & updated types. Thanks for working on that. My concerns are just related to maintainability.
our build depends on other repo (GH availability ) and location of certain file
Exactly. I think it's better to keep the generated files or source for their generation in the repo. And commit changes wisely. In addition, it must be straightforward to do a build in an offline environment (which is already resolved for npm).
we should lock our build to a release branch/tag of openshift/kubevirt to prevent building with potential breaking changes of the API. New versions still would have to be updated manually.
IMO, this complexity out-weights benefits in the long-term.
currently, I am linting the generated files, but this step could be skipped by adding
I agree we do not need to care much about syntax in the generated code as long as the process for its creation is clear.
@alecmerdler can we proceed with this now for 4.3 ?
Issues go stale after 90d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.
If this issue is safe to close now please do so with /close.
/lifecycle stale
/lifecycle frozen
@suomiy: The following tests failed, say /retest to rerun all failed tests:
| Test name | Commit | Details | Rerun command |
|---|---|---|---|
| ci/prow/e2e-gcp-console | edc9f92e82afb8f7aa841d39fa927d248dfd374e | link | /test e2e-gcp-console |
| ci/prow/e2e-gcp | edc9f92e82afb8f7aa841d39fa927d248dfd374e | link | /test e2e-gcp |
| ci/prow/analyze | edc9f92e82afb8f7aa841d39fa927d248dfd374e | link | /test analyze |
| ci/prow/kubevirt-plugin | edc9f92e82afb8f7aa841d39fa927d248dfd374e | link | /test kubevirt-plugin |
Full PR test history. Your PR dashboard.
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.
@atiratree: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:
| Test name | Commit | Details | Required | Rerun command |
|---|---|---|---|---|
| ci/prow/kubevirt-plugin | edc9f92e82afb8f7aa841d39fa927d248dfd374e | link | /test kubevirt-plugin |
|
| ci/prow/ceph-storage-plugin | edc9f92e82afb8f7aa841d39fa927d248dfd374e | link | /test ceph-storage-plugin |
|
| ci/prow/images | edc9f92e82afb8f7aa841d39fa927d248dfd374e | link | true | /test images |
| ci/prow/okd-scos-images | edc9f92e82afb8f7aa841d39fa927d248dfd374e | link | true | /test okd-scos-images |
| ci/prow/e2e-gcp-console | edc9f92e82afb8f7aa841d39fa927d248dfd374e | link | true | /test e2e-gcp-console |
| ci/prow/analyze | edc9f92e82afb8f7aa841d39fa927d248dfd374e | link | true | /test analyze |
| ci/prow/frontend | edc9f92e82afb8f7aa841d39fa927d248dfd374e | link | true | /test frontend |
| ci/prow/backend | edc9f92e82afb8f7aa841d39fa927d248dfd374e | link | true | /test backend |
Full PR test history. Your PR dashboard.
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-sigs/prow repository. I understand the commands that are listed here.
PR needs rebase.
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-sigs/prow repository.
stale