cdk8s-team / cdk8s-cli

Apache License 2.0
38 stars 23 forks source link

CRD version priority not respected when generating API objects #2340

Open zhelyan opened 11 months ago

zhelyan commented 11 months ago

Description of the bug:

Looks like cdk8s CRD imports don't respect the k8s CRD version priority when generating the "stable" non-versioned classes of the API objects.

Reproduction Steps:

cdk8s import https://raw.githubusercontent.com/external-secrets/external-secrets/v0.9.5/deploy/crds/bundle.yaml -o imports/

then

from imports.io.external_secrets import  SecretStore

app = App()
chart = Chart(app, "foo")

store = SecretStore(chart, "bar")
assert store.api_version == "external-secrets.io/v1beta1" # <-- fails, returns external-secrets.io/v1alpha1

Error Log:

Environment:

Other:


This is :bug: Bug Report

iliapolo commented 3 months ago

Agreed. This is because we used to not even render all versions, just the first one (bug). When we added handling for multiple versions, we preserved the previous behavior for backwards compatibility.

Fixing this properly would require a breaking change, but perhaps thats something we need to go ahead and do.

srgvg commented 3 months ago

Fixing this properly would require a breaking change, but perhaps thats something we need to go ahead and do.

+1