-
Notifications
You must be signed in to change notification settings - Fork 199
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
feat(inventory): introduce OmegaConf as optional inventory backend #995
Conversation
@MatteoVoges this is very exciting, thanks! Will review in the new couple of days. |
This is very exciting indeed. I haven't heard of OmegaConf before. Great find!! reclass is great but after you use it for a while you find lots of small things that could be improved and it's a bit sad that it's not longer being maintained. So having an alternative is great. However, reclass is everywhere in the kapitan code. So my suggestion is to open a separate PR where you just make kapitan code more generic and ready to accept a different type of inventory, without adding OmegaConf just yet. For example the changes you have in this PR to rename I believe there are lots of other places (in addition to For example:
|
Yeah, I will do that. But I leave the changes in here as well, to see the full view of the change. |
There is some error in the |
Since the list merge in Omegaconf now works, I included the module locally and was able to test it successfully. Migrating the inventory only works with ruamel.yaml at the moment, as this is the only way to preserve comments. Also the local module has to be replaced by the PyPi module again, if it is released. If you compile the inventory this is the only change: ( - KUBECTL="kubectl -n None" #(2)!
+ KUBECTL="kubectl -n minikube-nginx-helm" #(2)! So the namespace is now correct. I think that this change was even a bug in reclass and so this is fixed now. But maybe it could be intentional... |
d68cc97
to
7dc7585
Compare
@ademariag @ramaro |
@@ -51,6 +51,7 @@ jsonschema = "^4.17.3" | |||
kadet = "^0.2.2" | |||
python-gnupg = "^0.4.7" | |||
pyyaml = "^6.0" | |||
omegaconf = { git = "https://github.com/neXenio/omegaconf.git", branch = "dev" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we have to use dev branch?
args = list(cached.args.values())[0] | ||
use_omegaconf = args.omegaconf | ||
try: | ||
migrate_omegaconf = args.migrate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really use why we need to do this inside a try?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use perhaps:
migrate_omegaconf = args.get("migrate", False)
# inv_start = time.time() | ||
inv = inventory_omegaconf(inventory_path, ignore_class_notfound, targets) | ||
# logger.info("REAL_TIME (%.2fs)", time.time() - inv_start) | ||
except Exception as e: | ||
if not migrate_omegaconf: | ||
logger.warning("Make sure to migrate your inventory using --migrate") | ||
raise InventoryError(e) | ||
else: | ||
logger.debug("Using reclass as inventory backend") | ||
# inv_start = time.time() | ||
inv = inventory_reclass(inventory_path, ignore_class_notfound) | ||
# logger.info("REAL_TIME (%.2fs)", time.time() - inv_start) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove the commented code?
@@ -0,0 +1,163 @@ | |||
#!/usr/bin/env python3 | |||
|
|||
# Copyright 2023 nexenio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately we need to remove this. We need this instead:
# Copyright 2023 The Kapitan Authors
# SPDX-FileCopyrightText: 2020 The Kapitan Authors <kapitan-admins@googlegroups.com>
#
# SPDX-License-Identifier: Apache-2.0
@@ -0,0 +1,198 @@ | |||
#!/usr/bin/env python3 | |||
|
|||
# Copyright 2023 nexenio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same copyright msg here too
|
||
pull_oc: | ||
rm -rf omegaconf | ||
git clone --branch 1080-add-list-deep-merging https://github.com/nexenio/omegaconf.git oc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MatteoVoges this is not needed anymore now that it has been merged right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ramaro and @ademariag ,
This is an outdated version of the implementation. I'm now working on a nexenio/dev branch to work more independently, because some of my PR's depend on each other and we at nexenio wanted to have a kapitan branch with all of my (upcoming) features.
Of course I will continue sending parts to this upstream, but I think this will happen less frequently.
I can show you my progress on friday and then you can review it properly.
Fixes #990
Proposed Changes
kapicorp/nexenio-dev
,neXenio/dev
docs/pages/inventory/omegaconf.md
To do
.
to using theaccess
resolveruser_resolver_path
should be controlled by a flagglobal_inventory
in multiprocessingContributed by