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

Kapitan Release 0.34.2 #1263

Merged
merged 4 commits into from
Nov 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rearrange inventory modules
Alessandro De Maria committed Nov 8, 2024
commit 065dfe2c5ab85de3b74c36f5501f4108ccd01e5a
8 changes: 4 additions & 4 deletions docs/pages/inventory/reclass-rs.md
Original file line number Diff line number Diff line change
@@ -39,8 +39,8 @@ The example inventory renders to a total of 25MB of YAML.
$ time kapitan inventory -v --inventory-backend=reclass > inv.yml
[ ... some output omitted ... ]
kapitan.resources DEBUG Using reclass as inventory backend
kapitan.inventory.inv_reclass DEBUG Inventory reclass: No config file found. Using reclass inventory config defaults
kapitan.inventory.inv_reclass DEBUG Inventory rendering with reclass took 0:01:06.037057
kapitan.inventory.backends.reclass DEBUG Inventory reclass: No config file found. Using reclass inventory config defaults
kapitan.inventory.backends.reclass DEBUG Inventory rendering with reclass took 0:01:06.037057

real 1m23.840s
user 1m23.520s
@@ -56,11 +56,11 @@ The rest of the runtime (roughly 18 seconds) is spent in writing the resulting 2
$ time kapitan inventory -v --inventory-backend=reclass-rs > inv-rs.yml
[ ... some output omitted ... ]
kapitan.resources DEBUG Using reclass-rs as inventory backend
kapitan.inventory.inv_reclass DEBUG Inventory reclass: No config file found. Using reclass inventory config defaults
kapitan.inventory.backends.reclass DEBUG Inventory reclass: No config file found. Using reclass inventory config defaults
reclass-config.yml entry 'storage_type=yaml_fs' not implemented yet, ignoring...
reclass-config.yml entry 'inventory_base_uri=./inventory' not implemented yet, ignoring...
reclass-config.yml entry 'allow_none_override=true' not implemented yet, ignoring...
kapitan.inventory.inv_reclass_rs DEBUG Inventory rendering with reclass-rs took 0:00:01.717107
kapitan.inventory.backends.reclass_rs DEBUG Inventory rendering with reclass-rs took 0:00:01.717107
real 0m19.921s
user 0m35.586s
8 changes: 4 additions & 4 deletions kapitan/inventory/__init__.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

from kapitan.utils import StrEnum

from .inventory import Inventory
from .inventory import Inventory, InventoryError, InventoryTarget


class InventoryBackends(StrEnum):
@@ -20,7 +20,7 @@ def load_reclass_backend():
"""
Enable the reclass inventory backend.
"""
from .inv_reclass import ReclassInventory
from .backends.reclass import ReclassInventory

return ReclassInventory

@@ -29,7 +29,7 @@ def load_reclass_rs_backend():
"""
Enable the reclass-rs inventory backend.
"""
from .inv_reclass_rs import ReclassRsInventory
from .backends.reclass_rs import ReclassRsInventory

return ReclassRsInventory

@@ -38,7 +38,7 @@ def load_omegaconf_backend():
"""
Enable the omegaconf inventory backend.
"""
from .inv_omegaconf.inv_omegaconf import OmegaConfInventory
from .backends.omegaconf import OmegaConfInventory

return OmegaConfInventory

Original file line number Diff line number Diff line change
@@ -16,9 +16,9 @@
from kadet import Dict
from omegaconf import ListMergeMode, OmegaConf

from kapitan.inventory import Inventory, InventoryError, InventoryTarget
from kapitan.inventory.model import KapitanInventoryMetadata, KapitanInventoryParameters

from ..inventory import Inventory, InventoryError, InventoryTarget
from .migrate import migrate
from .resolvers import register_resolvers

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -8,8 +8,7 @@
from reclass.errors import NotFoundError, ReclassException

from kapitan.errors import InventoryError

from .inventory import Inventory, InventoryTarget
from kapitan.inventory import Inventory, InventoryTarget

logger = logging.getLogger(__name__)

Original file line number Diff line number Diff line change
@@ -4,9 +4,8 @@
import reclass_rs

from kapitan.errors import InventoryError

from .inv_reclass import get_reclass_config
from .inventory import Inventory, InventoryTarget
from kapitan.inventory import Inventory
from kapitan.inventory.backends.reclass import get_reclass_config

logger = logging.getLogger(__name__)

Empty file.
4 changes: 2 additions & 2 deletions tests/test_compile.py
Original file line number Diff line number Diff line change
@@ -257,9 +257,9 @@ def setUp(self):
self.inventory_path = self.temp_dir
super().setUp()
self.extraArgv = ["--inventory-backend=omegaconf"]
from kapitan.inventory.inv_omegaconf import migrate
from kapitan.inventory.backends.omegaconf import migrate

migrate.migrate(self.temp_dir)
migrate(self.temp_dir)

@unittest.skip("Already tested")
def test_compile_not_enough_args(self):
4 changes: 2 additions & 2 deletions tests/test_inventory.py
Original file line number Diff line number Diff line change
@@ -72,10 +72,10 @@ def setUp(self) -> None:
shutil.copytree(TEST_KUBERNETES_INVENTORY, self.temp_dir, dirs_exist_ok=True)
self.backend_id = InventoryBackends.OMEGACONF
self.expected_targets_count = 10
from kapitan.inventory.inv_omegaconf import migrate
from kapitan.inventory.backends.omegaconf import migrate

self.inventory_path = os.path.join(self.temp_dir, "inventory")
migrate.migrate(self.inventory_path)
migrate(self.inventory_path)
super().setUp()

def tearDown(self) -> None:
4 changes: 2 additions & 2 deletions tests/test_omegaconf.py
Original file line number Diff line number Diff line change
@@ -28,10 +28,10 @@ def setUp(self) -> None:
inventory_backend = get_inventory_backend("omegaconf")
self.inventory_path = self.temp_dir
self.extraArgv = ["--inventory-backend=omegaconf"]
from kapitan.inventory.inv_omegaconf import migrate
from kapitan.inventory.backends.omegaconf import migrate

inventory_path = os.path.join(self.temp_dir, "inventory")
migrate.migrate(inventory_path)
migrate(inventory_path)
self.inventory_backend = inventory_backend(inventory_path=inventory_path, initialise=False)

def test_load_and_resolve_single_target(self):
1 change: 1 addition & 0 deletions tests/test_resources/compiled/reveal-output/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"$?{gpg:targets/nginx-ingress/electionID:44da4b47}"