Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlowSchema has incorrect Subject parameters for 1.30 #2138

Open
jrcichra opened this issue Sep 5, 2024 · 5 comments
Open

FlowSchema has incorrect Subject parameters for 1.30 #2138

jrcichra opened this issue Sep 5, 2024 · 5 comments
Labels
bug Something isn't working @component/cdk8s-cli Issue related to cdk8s-cli effort/large 1+ weeks priority/p1 Should be on near term plans

Comments

@jrcichra
Copy link

jrcichra commented Sep 5, 2024

Description of the bug:

When creating a FlowSchema in cdk8s with the 1.30 imports it does not have the correct parameters for the Subject object under .spec.rules.subjects. It looks like it is reusing the RBAC Subjects field which does not have the same fields.

There should be a serviceAccount and user field. Instead it has name and namespace at the top level, which is not in kubectl explain flowschema.spec.rules.subjects. Using name and namespace as specified in the typescript schema does not apply to a 1.30.0 cluster.

Reproduction Steps:

Start a new cdk8s project.
Make a FlowSchema with at least one .spec.rules.subjects.
Attempt to apply the result to a 1.30 cluster.

Error Log:

FlowSchema in version "v1" cannot be handled as a FlowSchema: strict decoding error: unknown field "spec.rules[0].subjects[0].name", unknown field "spec.rules[0].subjects[0].namespace", unknown field "spec.rules[0].subjects[1].name", unknown field "spec.rules[0].subjects[1].namespace

Environment:

  • Framework Version: cdk8s 2.68.105, cdk8s-cli 2.198.208, cdk8s import [email protected]
  • OS: Debian Bookworm

Other:


This is 🐛 Bug Report

@jrcichra jrcichra added bug Something isn't working needs-triage Priority and effort undetermined yet labels Sep 5, 2024
@jrcichra
Copy link
Author

jrcichra commented Sep 5, 2024

@jrcichra
Copy link
Author

jrcichra commented Sep 5, 2024

The issue might be in the cdk8s import code when there are two Objects with the same name (Subject): https://github.com/cdk8s-team/cdk8s-cli/tree/2.x/src/import

@jrcichra
Copy link
Author

jrcichra commented Sep 5, 2024

v1beta3 seems to have the proper fields, using that as a workaround for now.

@iliapolo
Copy link
Member

Thanks for reporting this. Yeah this is because there is a basename collision between io.k8s.api.rbac.v1.Subject and io.k8s.api.flowcontrol.v1.Subject. I think we need to start adding the ApiGroup to generated classes/interfaces names...but that would be a breaking change.

Marking as p1.

@iliapolo iliapolo added effort/large 1+ weeks priority/p1 Should be on near term plans and removed needs-triage Priority and effort undetermined yet labels Sep 10, 2024
@iliapolo iliapolo transferred this issue from cdk8s-team/cdk8s Sep 10, 2024
@iliapolo
Copy link
Member

Another possibly non breaking solution is to provide an option to cdk8s import. something like cdk8s import --include-api-group

@iliapolo iliapolo transferred this issue from cdk8s-team/cdk8s-cli Sep 19, 2024
@iliapolo iliapolo added the @component/cdk8s-cli Issue related to cdk8s-cli label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working @component/cdk8s-cli Issue related to cdk8s-cli effort/large 1+ weeks priority/p1 Should be on near term plans
Projects
None yet
Development

No branches or pull requests

2 participants