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

Replacement transformer fails for list #534

Closed
hem2 opened this issue Apr 27, 2021 · 7 comments
Closed

Replacement transformer fails for list #534

hem2 opened this issue Apr 27, 2021 · 7 comments
Assignees
Labels
bug Something isn't working priority/low Items that are considered non-critical for functionality, such as quality of life improvements size s
Milestone

Comments

@hem2
Copy link
Contributor

hem2 commented Apr 27, 2021

Describe the bug
Replacement transformer fails for list with "Error: wrong Node Kind for expected: ScalarNode was SequenceNode: value: . " error.

Steps To Reproduce
Change L47 to a list https://github.com/airshipit/airshipctl/blob/master/krm-functions/replacement-transformer/local-resource/example-use.yaml and run "kustomize fn run local-resource/example-use.yaml" and it fails with the above error.

Expected behavior
Replacement transformer should be able to replace of type list.

Environment

  • airshipctl Version: latest on master
  • Operating System: NA
  • Kernel version: NA
  • Kubernetes Version: NA
  • Go version: go1.16.2
  • Hardware specs (e.g. 4 vCPUs, 16GB RAM, bare metal vs VM): NA
@hem2 hem2 added bug Something isn't working triage Needs evaluation by project members labels Apr 27, 2021
@jezogwza jezogwza added priority/low Items that are considered non-critical for functionality, such as quality of life improvements and removed triage Needs evaluation by project members labels Apr 28, 2021
@jezogwza jezogwza added this to the v2.1 milestone Apr 28, 2021
@lb4368 lb4368 modified the milestones: v2.1, Future May 6, 2021
@gnana03
Copy link

gnana03 commented May 11, 2021

I would like to pick this

@eak13
Copy link

eak13 commented May 11, 2021

@gnana03 - it's all yours. Thanks.

@michaelfix
Copy link

@gnana03 , what t-shirt size would you estimate this effort to be?

  • <=1 days | Small | refactor, 1 function, documentation
  • 2-5 days | Medium | moderate complexity, generic code, or enhancement to existing feature
  • 5-7+ days | Large | multiple functional areas; complex function or capability, or multiple PSs

@raliev12
Copy link
Contributor

This issue seems invalid. We don't have to change object types, source and target fields types must match, so transformer behavior looks expected in described case. This is kind of protection measure - mixing types can cause multiple issues. Also, static validation (which we have enabled) verifies object type and its value as well, in case of mismatch - the error will be thrown. OpenAPIv3 schema doesn't support multiple types for an object:
type - Value MUST be a string. Multiple types via an array are not supported. [1]

As a workaround, you can use smp or json patch to remove value first, then apply transformer. But I would not recommend doing this for schema-declared kinds. Since we don't have a defined OpenAPIv3 schema for VariableCatalogue, such workaround could be applied.

[1] https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schemaObject

@eak13
Copy link

eak13 commented May 12, 2021

@hem2 Reddy, can you take a look at Ruslan's comments & let us know if this is still an issue?

@hem2
Copy link
Contributor Author

hem2 commented May 13, 2021

@ak3216 I agree with Ruslan. Let's close this. Thank you.

@eak13
Copy link

eak13 commented May 13, 2021

@hem2 thanks! Closing per comments above.

@eak13 eak13 closed this as completed May 13, 2021
@eak13 eak13 added the size s label May 13, 2021
@lb4368 lb4368 modified the milestones: Future, v2.1 Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority/low Items that are considered non-critical for functionality, such as quality of life improvements size s
Projects
None yet
Development

No branches or pull requests

7 participants