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

[bug]: omegaconf migration flag does not work from inventory with reclass #1285

Open
3 tasks
jmmclean opened this issue Jan 9, 2025 · 0 comments
Open
3 tasks
Labels

Comments

@jmmclean
Copy link

jmmclean commented Jan 9, 2025

Description of the bug

couple issues:

  1. it seems omegaconf is much pickier than reclass for .yml v .yaml file extension; if .yaml is used within the inventory, errors will be thrown
  2. the --migrate flag does not convert reclass variable reference (ie ${external_dns:component_name}) to omegaconf (ie ${external_dns.component_name})

Steps to reproduce

1. create an inventory that is reclass compatible with variable reference (something like `${external_dns:component_name}`) - ensure a kapitan compile works
2. try to run the omegaconf migration using `kapitan compile --inventory-backend omegaconf --migrate`. This will trigger an error

What happened?

an error, similar to the below will be seen

> kapitan compile --inventory-backend omegaconf --migrate
azr-westus-dca-wl-prd-001: could not render due to error Unsupported interpolation type cert_manager
    full_key: kapitan.compile[0].output_path
    object_type=dict
aws-us-east-1-dca-wl-lab-002: could not render due to error Unsupported interpolation type cert_manager
    full_key: kapitan.compile[0].output_path
    object_type=dict
aws-us-west-2-dca-wl-prd-002: could not render due to error Unsupported interpolation type cert_manager
    full_key: kapitan.compile[0].output_path
    object_type=dict
aws-us-west-2-dca-wl-prd-001: could not render due to error Unsupported interpolation type cert_manager
    full_key: kapitan.compile[0].output_path
    object_type=dict
Error while loading the OmegaConf inventory
Traceback (most recent call last):
  File "/opt/venv/bin/kapitan", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/kapitan/cli.py", line 639, in main
    args.func(args)
  File "/opt/venv/lib/python3.11/site-packages/kapitan/cli.py", line 76, in trigger_compile
    compile_targets(
  File "/opt/venv/lib/python3.11/site-packages/kapitan/targets.py", line 42, in compile_targets
    inventory = get_inventory(inventory_path)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/kapitan/resources.py", line 345, in get_inventory
    inventory_backend = backend(
                        ^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/kapitan/inventory/backends/omegaconf/__init__.py", line 69, in __init__
    super().__init__(*args, **kwargs, target_class=OmegaConfTarget)
  File "/opt/venv/lib/python3.11/site-packages/kapitan/inventory/inventory.py", line 51, in __init__
    self.__initialise(ignore_class_not_found=ignore_class_not_found)
  File "/opt/venv/lib/python3.11/site-packages/kapitan/inventory/inventory.py", line 92, in __initialise
    self.render_targets(self.targets, ignore_class_not_found=ignore_class_not_found)
  File "/opt/venv/lib/python3.11/site-packages/kapitan/inventory/backends/omegaconf/__init__.py", line 84, in render_targets
    raise OmegaConfRenderingError("Error while loading the OmegaConf inventory")
kapitan.inventory.backends.omegaconf.OmegaConfRenderingError: Error while loading the OmegaConf inventory

Additional context

More information can be found within this discussion - https://github.com/orgs/kapicorp/discussions/1007

Manually changing the reclass notation to omegaconf notation made the compile work, however I would have expected the --migrate flag to handle this

I created a function to wrap kapitan, below

> which kapitan
kapitan () {
	docker run -t --rm -u $(id -u) -v $(pwd):/src:delegated kapicorp/kapitan:0.34.4-linux-arm64 $@
}

Version (kapitan)

master

Version (kapitan)

I use kapitan directly (pip, docker)

Python virtual environment

  • pyenv
  • venv
  • no environment

OS information

No response

Relevant log output

No response

@jmmclean jmmclean added the bug label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant