java icon indicating copy to clipboard operation
java copied to clipboard

Failed to generate spec from crd

Open kinderyj opened this issue 4 years ago • 9 comments

Steps to reproduce:

git clone https://github.com/kubernetes-client/java.git cd java/client-java-contrib docker build . docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v "$(pwd)":"$(pwd)" -it --network host 2f1a4715f0e7 /generate.sh -u https://github.com/kinderyj/presto-operator/releases/download/0.1/crd.yaml
-n io.prestosql
-p io.prestosql
-o "$(pwd)"

When I generated the code from Crd, I only got the V1beta1PrestoClusterList.java, there is no Spec files such as V1beta1PrestoClusterSpec.java, How should I update my crd to generate the V1beta1PrestoClusterSpec.java ? Thanks.

My Crd is as below,

apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: prestoclusters.operator.prestosql.io spec: group: operator.prestosql.io version: v1alpha1 names: kind: PrestoCluster singular: prestocluster plural: prestoclusters scope: Namespaced validation: openAPIV3Schema: properties: spec: properties: workers: type: integer minimum: 1 maximum: 10 additionalPrinterColumns: - name: DESIRED type: integer description: The desired number of worker nodes JSONPath: .spec.workers - name: CURRENT type: integer description: The current number of worker nodes JSONPath: .status.availableWorkers

kinderyj avatar Sep 10 '20 14:09 kinderyj

can you follow our latest document https://github.com/kubernetes-client/java/blob/master/docs/generate-model-from-third-party-resources.md? there was a few updated content recently.

apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: prestoclusters.operator.prestosql.io spec: group: operator.prestosql.io version: v1alpha1 names: kind: PrestoCluster singular: prestocluster plural: prestoclusters scope: Namespaced validation: openAPIV3Schema: properties: spec: properties: workers: type: integer minimum: 1 maximum: 10 additionalPrinterColumns: - name: DESIRED type: integer description: The desired number of worker nodes JSONPath: .spec.workers - name: CURRENT type: integer description: The current number of worker nodes JSONPath: .status.availableWorkers

at a glance, i think you didn't enable the CRD pruning in this CRD's spec by setting .spec.preserveUnknownFields to false. can you retry?

yue9944882 avatar Sep 10 '20 15:09 yue9944882

Adding .spec.preserveUnknownFields=false in the YAML seems to work. The canonical example from the docs doesn't have that flag though (https://gist.githubusercontent.com/yue9944882/266fee8e95c2f15a93778263633e72ed/raw/be12c13379eeed13d2532cb65da61fffb19ee3e7/crontab-crd.yaml). Maybe something needs to be added to the documentation?

dsyer avatar Dec 04 '20 15:12 dsyer

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale

fejta-bot avatar Mar 04 '21 16:03 fejta-bot

/remove-lifecycle stale

Please

dsyer avatar Mar 04 '21 17:03 dsyer

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale

fejta-bot avatar Jun 02 '21 18:06 fejta-bot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten

fejta-bot avatar Jul 02 '21 18:07 fejta-bot

/remove-lifecycle rotten

dsyer avatar Jul 02 '21 21:07 dsyer

/lifecycle frozen

brendandburns avatar Jul 04 '21 14:07 brendandburns

operator.prestosql.io

change param -n io.prestosql.operator -p io.prestosql.operator maybe work.

I met the same error. Then I reverse the CRD group name, it worked.

dabaooline avatar Dec 22 '21 05:12 dabaooline