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

Generate singleton lists as embedded objects #387

Merged
merged 13 commits into from
May 8, 2024

Commits on May 7, 2024

  1. Generate singleton lists as embedded objects

    - Terraform configuration blocks, even if they have a MaxItems
      constraint of 1, are (almost) always generated as lists. We
      now generate the lists with a MaxItems constraint of 1 as
      embedded objects in our MR APIs.
    - This also helps when updating or patching via SSA the
      (previously list) objects. The merging strategy implemented
      by SSA requires configuration for associative lists and
      converting the singleton lists into embedded objects removes
      the configuration need.
    - A schema traverser is introduced, which can decouple the Terraform
      schema traversal logic from the actions (such as code generation,
      inspection, or singleton-list-to-embedded-object conversion)
      taken while traversing the schema.
    
    Signed-off-by: Alper Rifat Ulucinar <[email protected]>
    ulucinar committed May 7, 2024
    Configuration menu
    Copy the full SHA
    7e87a7f View commit details
    Browse the repository at this point in the history
  2. Make singleton-list-to-embedded-object API conversions optional

    Signed-off-by: Alper Rifat Ulucinar <[email protected]>
    ulucinar committed May 7, 2024
    Configuration menu
    Copy the full SHA
    fb97ee5 View commit details
    Browse the repository at this point in the history
  3. Add a config.Resource configuration option to be able to mark

    the generated CRD API version as the storage version.
    
    Signed-off-by: Alper Rifat Ulucinar <[email protected]>
    ulucinar committed May 7, 2024
    Configuration menu
    Copy the full SHA
    668de34 View commit details
    Browse the repository at this point in the history
  4. Add conversion.singletonConverter conversion function for CRD API con…

    …versions between
    
    singleton list & embedded object API versions.
    
    - Export conversion.Convert to be reused in embedded singleton list webhook API conversions.
    
    Signed-off-by: Alper Rifat Ulucinar <[email protected]>
    ulucinar committed May 7, 2024
    Configuration menu
    Copy the full SHA
    9e917b3 View commit details
    Browse the repository at this point in the history
  5. Add config.Resource.crd{Storage,Hub}Version to be able to configure

    the storage & hub API versions independently.
    
    - The default values for both of the storage & hub versions is
      the version being generated, i.e., Resource.Version.
    - Replace pipeline.ConversionHubGenerator & pipeline.ConversionSpokeGenerator
      with a common pipeline.ConversionNodeGenerator implementation
    - Now the hub generator can also inspect the generated files to regenerate
      the hub versions according to the latest resource configuration and
      we have removed the assumption that the hub version is always the
      latest version generated.
    - Fix duplicated GKVs issue in zz_register.go.
    
    Signed-off-by: Alper Rifat Ulucinar <[email protected]>
    ulucinar committed May 7, 2024
    Configuration menu
    Copy the full SHA
    8031da8 View commit details
    Browse the repository at this point in the history
  6. Fix the error messages in the template implementations of conversion.…

    …Converter
    
    Signed-off-by: Alper Rifat Ulucinar <[email protected]>
    ulucinar committed May 7, 2024
    Configuration menu
    Copy the full SHA
    914df98 View commit details
    Browse the repository at this point in the history
  7. Add conversion.identityConversion API converter and allow excluding f…

    …ield paths
    
    when the conversion.RoundTrip copies the fields, from src to dst, with the same name.
    
    Signed-off-by: Alper Rifat Ulucinar <[email protected]>
    ulucinar committed May 7, 2024
    Configuration menu
    Copy the full SHA
    a87bc73 View commit details
    Browse the repository at this point in the history
  8. Fix slice value length assertion in conversion.Convert

    Signed-off-by: Alper Rifat Ulucinar <[email protected]>
    ulucinar committed May 7, 2024
    Configuration menu
    Copy the full SHA
    136fabd View commit details
    Browse the repository at this point in the history
  9. Initialize config.Resource.OverrideFieldNames with an empty map

    Signed-off-by: Alper Rifat Ulucinar <[email protected]>
    ulucinar committed May 7, 2024
    Configuration menu
    Copy the full SHA
    5a6fd95 View commit details
    Browse the repository at this point in the history
  10. Fix connection details state value map conversion

    - Fix runtime conversion for expanded field paths of length
      greater than 1.
    
    Signed-off-by: Alper Rifat Ulucinar <[email protected]>
    ulucinar committed May 7, 2024
    Configuration menu
    Copy the full SHA
    cf00700 View commit details
    Browse the repository at this point in the history
  11. Call hub & spoke generation pipelines after the CRD generation pipeline

    - Prevent execution of these pipelines multiple times for each available
      versions of an API group.
    - Improve conversion.RoundTrip paved conversion error message
    
    Signed-off-by: Alper Rifat Ulucinar <[email protected]>
    ulucinar committed May 7, 2024
    Configuration menu
    Copy the full SHA
    e82d624 View commit details
    Browse the repository at this point in the history
  12. Add unit tests for runtime API conversions

    Signed-off-by: Alper Rifat Ulucinar <[email protected]>
    ulucinar committed May 7, 2024
    Configuration menu
    Copy the full SHA
    26df74c View commit details
    Browse the repository at this point in the history
  13. Add tests for config.SingletonListEmbedder

    Signed-off-by: Alper Rifat Ulucinar <[email protected]>
    ulucinar committed May 7, 2024
    Configuration menu
    Copy the full SHA
    44c139e View commit details
    Browse the repository at this point in the history