Skip to content

Commit

Permalink
Add fields yaml_multiline_string_style and `yaml_dump_null_as_empty…
Browse files Browse the repository at this point in the history
…` to mock Kapitan argument cache

The fields got introduced in
kapicorp/kapitan#861 and are read by Kapitan's
customized PyYAML representer functions for strings and None values
respectively.

We currently just set the fields to their defaults of `""` and `False`,
but we could consider changing them to use a nicer multi-line string
format for Commodore's output in the future, and to emit `None` entries
in YAML streams as an empty string instead of `null` which would fix
intermittent issues with ArgoCD choking on Helm template outputs, if
`null` documents aren't removed from the output.
  • Loading branch information
simu committed Jan 27, 2023
1 parent 2ee95e5 commit 0eb7be7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions commodore/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@
from commodore.config import Config


ArgumentCache = collections.namedtuple("ArgumentCache", ["inventory_path"])
ArgumentCache = collections.namedtuple(
"ArgumentCache",
[
"inventory_path",
"yaml_multiline_string_style",
"yaml_dump_null_as_empty",
],
)


class FakeVaultBackend(VaultBackend):
Expand Down Expand Up @@ -176,7 +183,9 @@ def kapitan_compile(
refController.register_backend(FakeVaultBackend())
click.secho("Compiling catalog...", bold=True)
cached.args["compile"] = ArgumentCache(
inventory_path=config.inventory.inventory_dir
inventory_path=config.inventory.inventory_dir,
yaml_multiline_string_style="",
yaml_dump_null_as_empty=False,
)
kapitan_targets.compile_targets(
inventory_path=config.inventory.inventory_dir,
Expand Down

0 comments on commit 0eb7be7

Please sign in to comment.