cdk8s-team / cdk8s-cli

Apache License 2.0
38 stars 23 forks source link

Import CRD fails with "Error: unsupported array type undefined" #93

Open jfreuter-finnet opened 2 years ago

jfreuter-finnet commented 2 years ago

Description of the bug:

When importing the CRDs from the argo-workflows project, cdk8s import errors out.

Reproduction Steps:

  1. Run the following command: cdk8s import https://raw.githubusercontent.com/argoproj/argo-workflows/v2.12.9/manifests/base/crds/full/argoproj.io_clusterworkflowtemplates.yaml

Error Log:

Importing resources, this may take a few moments...
argoproj.io
  argoproj.io/clusterworkflowtemplate
Error: unsupported array type undefined
    at TypeGenerator.typeForArray (/usr/local/lib/node_modules/cdk8s-cli/node_modules/json2jsii/lib/type-generator.js:397:19)
    at TypeGenerator.emitArray (/usr/local/lib/node_modules/cdk8s-cli/node_modules/json2jsii/lib/type-generator.js:257:25)
    at TypeGenerator.emitTypeInternal (/usr/local/lib/node_modules/cdk8s-cli/node_modules/json2jsii/lib/type-generator.js:183:29)
    at TypeGenerator.typeForProperty (/usr/local/lib/node_modules/cdk8s-cli/node_modules/json2jsii/lib/type-generator.js:376:21)
    at TypeGenerator.typeForArray (/usr/local/lib/node_modules/cdk8s-cli/node_modules/json2jsii/lib/type-generator.js:399:21)
    at TypeGenerator.emitArray (/usr/local/lib/node_modules/cdk8s-cli/node_modules/json2jsii/lib/type-generator.js:257:25)
    at TypeGenerator.emitTypeInternal (/usr/local/lib/node_modules/cdk8s-cli/node_modules/json2jsii/lib/type-generator.js:183:29)
    at TypeGenerator.typeForProperty (/usr/local/lib/node_modules/cdk8s-cli/node_modules/json2jsii/lib/type-generator.js:376:21)
    at TypeGenerator.emitProperty (/usr/local/lib/node_modules/cdk8s-cli/node_modules/json2jsii/lib/type-generator.js:319:35)
    at /usr/local/lib/node_modules/cdk8s-cli/node_modules/json2jsii/lib/type-generator.js:299:22

Environment:


This is :bug: Bug Report

iliapolo commented 2 years ago

@JFReuter-Fin Does this issue still persist? Can you share which Node version you are using?

ajkaanbal commented 2 years ago

I had the same issue and found out that this happens because of this property in the crd:

...
                  steps:
                    items:
                      type: array
                    type: array

https://github.com/argoproj/argo-workflows/blob/v2.12.9/manifests/base/crds/full/argoproj.io_clusterworkflowtemplates.yaml#L5280-L5283

iliapolo commented 2 years ago

@ajkaanbal Thanks, we will take a look 👍

github-actions[bot] commented 2 years ago

This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon.

iliapolo commented 2 years ago

Keep

github-actions[bot] commented 2 years ago

This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon. If you wish to exclude this issue from being marked as stale, add the "backlog" label.

github-actions[bot] commented 2 years ago

Closing this issue as it hasn't seen activity for a while. Please add a comment @mentioning a maintainer to reopen. If you wish to exclude this issue from being marked as stale, add the "backlog" label.

adrianord commented 2 years ago

I ran into this problem today using node v16.14.1 and cdk8s-cli 1.0.161 with the argo workflows CRDs

https://raw.githubusercontent.com/argoproj/argo-workflows/master/manifests/base/crds/full/argoproj.io_workflows.yaml

iliapolo commented 1 year ago

We should probably fallback to any in json2jsii for scenarios like these.

darklore commented 1 year ago

Same error using node v18.10.0 and cdk8s-cli 2.1.4.

cdk8s.yaml

language: go
app: go run .
imports:
  - https://raw.githubusercontent.com/argoproj/argo-workflows/v3.4.1/manifests/base/crds/full/argoproj.io_clusterworkflowtemplates.yaml
github-actions[bot] commented 11 months ago

This issue has not received any attention in 1 year and will be closed soon. If you want to keep it open, please leave a comment below @mentioning a maintainer.

vinayak-kukreja commented 11 months ago

Keep open.