nyl 0.9.0__tar.gz → 0.9.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. nyl-0.9.2/.changelog/0.9.0.toml +31 -0
  2. nyl-0.9.2/.changelog/0.9.1.toml +25 -0
  3. nyl-0.9.2/.changelog/0.9.2.toml +13 -0
  4. nyl-0.9.2/DEPRECATION_NOTICE.md +7 -0
  5. {nyl-0.9.0 → nyl-0.9.2}/PKG-INFO +2 -2
  6. {nyl-0.9.0 → nyl-0.9.2}/README.md +1 -1
  7. {nyl-0.9.0 → nyl-0.9.2}/docs/content/changelog.md +64 -31
  8. nyl-0.9.2/docs/content/index.md +22 -0
  9. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/configuration/environment.md +21 -4
  10. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/templating/basics.md +3 -2
  11. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/templating/locals.md +3 -3
  12. {nyl-0.9.0 → nyl-0.9.2}/example/manifests/postgres.yaml +3 -2
  13. nyl-0.9.2/example/nyl-profiles.toml +10 -0
  14. {nyl-0.9.0 → nyl-0.9.2}/pyproject.toml +2 -2
  15. nyl-0.9.2/slap.toml +2 -0
  16. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/commands/__init__.py +21 -0
  17. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/commands/new.py +17 -4
  18. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/commands/template.py +6 -2
  19. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/generator/helmchart.py +3 -0
  20. nyl-0.9.2/src/nyl/generator/helmchart_test.py +44 -0
  21. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/profiles/config.py +9 -2
  22. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/templating.py +9 -2
  23. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/tools/testing.py +3 -0
  24. nyl-0.9.2/testdata/helm-test-chart/Chart.yaml +3 -0
  25. nyl-0.9.2/testdata/helm-test-chart/templates/sa.yaml +7 -0
  26. nyl-0.9.2/testdata/helm-test-chart/values.yaml +1 -0
  27. nyl-0.9.0/.changelog/0.9.0.toml +0 -7
  28. nyl-0.9.0/docs/content/index.md +0 -10
  29. {nyl-0.9.0 → nyl-0.9.2}/.changelog/0.7.0.toml +0 -0
  30. {nyl-0.9.0 → nyl-0.9.2}/.changelog/0.7.1.toml +0 -0
  31. {nyl-0.9.0 → nyl-0.9.2}/.changelog/0.7.2.toml +0 -0
  32. {nyl-0.9.0 → nyl-0.9.2}/.changelog/0.8.0.toml +0 -0
  33. {nyl-0.9.0 → nyl-0.9.2}/.changelog/0.8.1.toml +0 -0
  34. {nyl-0.9.0 → nyl-0.9.2}/.envrc +0 -0
  35. {nyl-0.9.0 → nyl-0.9.2}/.github/workflows/docker.yaml +0 -0
  36. {nyl-0.9.0 → nyl-0.9.2}/.github/workflows/docs.yaml +0 -0
  37. {nyl-0.9.0 → nyl-0.9.2}/.github/workflows/python.yaml +0 -0
  38. {nyl-0.9.0 → nyl-0.9.2}/.github/workflows/update-flake-lock.yaml +0 -0
  39. {nyl-0.9.0 → nyl-0.9.2}/.gitignore +0 -0
  40. {nyl-0.9.0 → nyl-0.9.2}/argocd-cmp/Dockerfile +0 -0
  41. {nyl-0.9.0 → nyl-0.9.2}/argocd-cmp/README.md +0 -0
  42. {nyl-0.9.0 → nyl-0.9.2}/argocd-cmp/plugin.yaml +0 -0
  43. {nyl-0.9.0 → nyl-0.9.2}/argocd-with-nyl/.envrc +0 -0
  44. {nyl-0.9.0 → nyl-0.9.2}/argocd-with-nyl/.secrets.yaml +0 -0
  45. {nyl-0.9.0 → nyl-0.9.2}/argocd-with-nyl/.sops.yaml +0 -0
  46. {nyl-0.9.0 → nyl-0.9.2}/argocd-with-nyl/README.md +0 -0
  47. {nyl-0.9.0 → nyl-0.9.2}/argocd-with-nyl/argocd.yaml +0 -0
  48. {nyl-0.9.0 → nyl-0.9.2}/argocd-with-nyl/nyl-project.yaml +0 -0
  49. {nyl-0.9.0 → nyl-0.9.2}/argocd-with-nyl/nyl-secrets.yaml +0 -0
  50. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/applysets.md +0 -0
  51. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/argocd-plugin.md +0 -0
  52. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/cluster-connectivity.md +0 -0
  53. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/configuration/profiles.md +0 -0
  54. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/configuration/projects.md +0 -0
  55. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/configuration/secrets.md +0 -0
  56. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/configuration-api/profiles.md +0 -0
  57. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/configuration-api/secrets.md +0 -0
  58. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/glossary.md +0 -0
  59. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/templating/components.md +0 -0
  60. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/templating/inlining/helmcharts.md +0 -0
  61. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/templating/inlining/overview.md +0 -0
  62. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/templating/inlining/postprocessor.md +0 -0
  63. {nyl-0.9.0 → nyl-0.9.2}/docs/content/reference/templating/secrets.md +0 -0
  64. {nyl-0.9.0 → nyl-0.9.2}/docs/mkdocs.yml +0 -0
  65. {nyl-0.9.0 → nyl-0.9.2}/docs/pyproject.toml +0 -0
  66. {nyl-0.9.0 → nyl-0.9.2}/docs/uv.lock +0 -0
  67. {nyl-0.9.0 → nyl-0.9.2}/example/nyl-profiles.yaml +0 -0
  68. {nyl-0.9.0 → nyl-0.9.2}/example/nyl-secrets.yaml +0 -0
  69. {nyl-0.9.0 → nyl-0.9.2}/example/secrets.yaml +0 -0
  70. {nyl-0.9.0 → nyl-0.9.2}/flake.lock +0 -0
  71. {nyl-0.9.0 → nyl-0.9.2}/flake.nix +0 -0
  72. {nyl-0.9.0 → nyl-0.9.2}/nix/uv.nix +0 -0
  73. {nyl-0.9.0 → nyl-0.9.2}/renovate.json +0 -0
  74. {nyl-0.9.0 → nyl-0.9.2}/src/kubernetes/README.md +0 -0
  75. {nyl-0.9.0 → nyl-0.9.2}/src/kubernetes/__init__.pyi +0 -0
  76. {nyl-0.9.0 → nyl-0.9.2}/src/kubernetes/dynamic/__init__.pyi +0 -0
  77. {nyl-0.9.0 → nyl-0.9.2}/src/kubernetes/dynamic/client.pyi +0 -0
  78. {nyl-0.9.0 → nyl-0.9.2}/src/kubernetes/dynamic/discovery.pyi +0 -0
  79. {nyl-0.9.0 → nyl-0.9.2}/src/kubernetes/dynamic/exceptions.pyi +0 -0
  80. {nyl-0.9.0 → nyl-0.9.2}/src/kubernetes/dynamic/resource.pyi +0 -0
  81. {nyl-0.9.0 → nyl-0.9.2}/src/kubernetes/watch/__init__.pyi +0 -0
  82. {nyl-0.9.0 → nyl-0.9.2}/src/kubernetes/watch/watch.pyi +0 -0
  83. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/__init__.py +0 -0
  84. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/commands/add.py +0 -0
  85. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/commands/argocd.py +0 -0
  86. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/commands/crds.py +0 -0
  87. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/commands/profile.py +0 -0
  88. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/commands/run.py +0 -0
  89. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/commands/secrets.py +0 -0
  90. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/commands/tools/__init__.py +0 -0
  91. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/commands/tools/bcrypt.py +0 -0
  92. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/commands/tools/sops.py +0 -0
  93. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/commands/tun.py +0 -0
  94. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/generator/__init__.py +0 -0
  95. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/generator/components.py +0 -0
  96. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/generator/dispatch.py +0 -0
  97. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/generator/dispatch_test.py +0 -0
  98. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/generator/statefulsecret.py +0 -0
  99. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/profiles/__init__.py +0 -0
  100. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/profiles/config_test.py +0 -0
  101. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/profiles/kubeconfig.py +0 -0
  102. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/profiles/tunnel.py +0 -0
  103. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/project/config.py +0 -0
  104. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/resources/__init__.py +0 -0
  105. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/resources/applyset.py +0 -0
  106. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/resources/applyset_test.py +0 -0
  107. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/resources/helmchart.py +0 -0
  108. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/resources/helmchart_test.py +0 -0
  109. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/resources/placeholder.py +0 -0
  110. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/resources/postprocessor.py +0 -0
  111. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/resources/postprocessor_test.py +0 -0
  112. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/resources/statefulsecret.py +0 -0
  113. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/secrets/__init__.py +0 -0
  114. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/secrets/config.py +0 -0
  115. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/secrets/config_test.py +0 -0
  116. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/secrets/kubernetes.py +0 -0
  117. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/secrets/null.py +0 -0
  118. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/secrets/sops.py +0 -0
  119. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/secrets/sops_test.py +0 -0
  120. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/templating_test.py +0 -0
  121. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/tools/di.py +0 -0
  122. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/tools/fs.py +0 -0
  123. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/tools/fs_test.py +0 -0
  124. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/tools/kubectl.py +0 -0
  125. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/tools/kubernetes.py +0 -0
  126. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/tools/kvstore.py +0 -0
  127. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/tools/loads.py +0 -0
  128. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/tools/logging.py +0 -0
  129. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/tools/shell.py +0 -0
  130. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/tools/typer.py +0 -0
  131. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/tools/types.py +0 -0
  132. {nyl-0.9.0 → nyl-0.9.2}/src/nyl/tools/yaml.py +0 -0
  133. {nyl-0.9.0 → nyl-0.9.2}/tests/__init__.py +0 -0
  134. {nyl-0.9.0 → nyl-0.9.2}/tests/conftest.py +0 -0
  135. {nyl-0.9.0 → nyl-0.9.2}/uv.lock +0 -0
@@ -0,0 +1,31 @@
1
+ release-date = "2025-04-15"
2
+
3
+ [[entries]]
4
+ id = "a2772016-3dff-4da6-926d-1f47e509c63a"
5
+ type = "feature"
6
+ description = "Add ability to define and use local variables in manifests"
7
+ author = "@NiklasRosenstein"
8
+
9
+ [[entries]]
10
+ id = "11f1c1eb-5442-46c9-bf00-9f383c58cc47"
11
+ type = "improvement"
12
+ description = "argocd-cmp: Upgrade ArgoCD from v2.13.1 to v2.14.10"
13
+ author = "@NiklasRosenstein"
14
+
15
+ [[entries]]
16
+ id = "a275e0d6-3dc3-44ac-a737-5d369bd8e412"
17
+ type = "improvement"
18
+ description = "argocd-cmp: Upgrade Helm from v3.16.3 to v3.17.3"
19
+ author = "@NiklasRosenstein"
20
+
21
+ [[entries]]
22
+ id = "05430d18-8d65-460a-9230-299a48d3bb1f"
23
+ type = "improvement"
24
+ description = "argocd-cmp: Upgrade Sops from v3.9.2 to v3.10.2"
25
+ author = "@NiklasRosenstein"
26
+
27
+ [[entries]]
28
+ id = "c1984d5a-9e9f-480f-b6f9-cfb2b6f8d0ff"
29
+ type = "improvement"
30
+ description = "argocd-cmp: Upgrade Kyverno from 1.13.2 to 1.13.4"
31
+ author = "@NiklasRosenstein"
@@ -0,0 +1,25 @@
1
+ release-date = "2025-04-20"
2
+
3
+ [[entries]]
4
+ id = "ee341cce-af19-447c-88af-a62248924ab6"
5
+ type = "improvement"
6
+ description = "`nyl new component` now includes `metadata.labels` and `metadata.annotations` defaults in the generated `values.yaml`"
7
+ author = "@NiklasRosenstein"
8
+
9
+ [[entries]]
10
+ id = "3dc4e6b4-4a6d-4ed3-8e8b-5e9321cabb9a"
11
+ type = "feature"
12
+ description = "Add support for `NYL_ARGS` and `ARGOCD_ENV_NYL_ARGS` environment variables"
13
+ author = "@NiklasRosenstein"
14
+
15
+ [[entries]]
16
+ id = "71dada10-a681-47d6-8399-5769a8ecf455"
17
+ type = "improvement"
18
+ description = "Improve help text of `nyl new component` command"
19
+ author = "@NiklasRosenstein"
20
+
21
+ [[entries]]
22
+ id = "3dc3cd0e-ad32-465b-b67c-0f18c8cb1b3e"
23
+ type = "improvement"
24
+ description = "`.metadata.labels` set on a `HelmChart` resource now propagate and overwrite labels on the resources it generates (note that this also applies to Nyl components using Helm charts)"
25
+ author = "@NiklasRosenstein"
@@ -0,0 +1,13 @@
1
+ release-date = "2025-04-22"
2
+
3
+ [[entries]]
4
+ id = "469033a3-ec4d-4a54-9294-b1608735bacb"
5
+ type = "improvement"
6
+ description = "Introduce new `values` object into templating evaluation namespace, replacing the `locals` object going forward. The `locals` name is still available but will be removed in an upcoming release."
7
+ author = "@NiklasRosenstein"
8
+
9
+ [[entries]]
10
+ id = "7cd10ee2-9c5a-4c23-8fe4-9f4d9291ceb4"
11
+ type = "feature"
12
+ description = "Allow defining parameters in the \"values\" of a profile, accessible via `${{ values.PARAM }}` throughout manifest rendering with the profile."
13
+ author = "@NiklasRosenstein"
@@ -0,0 +1,7 @@
1
+ The following is a list of features and functionalities that are deprecated and will be removed in a future version
2
+ of Nyl. This file serves as an announcement as well as reminder before cutting a new release.
3
+
4
+ ## Deprecated Features
5
+
6
+ * `locals` in templates: The use of `locals` in templates is deprecated and will be removed in Nyl 0.10.x. Please
7
+ use `values` instead.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nyl
3
- Version: 0.9.0
3
+ Version: 0.9.2
4
4
  Summary: Advanced templating engine for Kubernetes and GitOps.
5
5
  Author-email: Niklas Rosenstein <rosensteinniklas@gmail.com>
6
6
  License: MIT
@@ -33,7 +33,7 @@ Requires Python 3.11 or newer.
33
33
 
34
34
  For some features, additional programs must be available:
35
35
 
36
- * [kubectl](https://kubernetes.io/de/docs/reference/kubectl/) for most operations
36
+ * [kubectl](https://kubernetes.io/de/docs/reference/kubectl/) for applying
37
37
  * [kyverno](https://kyverno.io/docs/kyverno-cli/) ^1.13.x when using the Nyl `PostProcessor` resource
38
38
  * [sops](https://github.com/getsops/sops) when using the SOPS secrets provider
39
39
 
@@ -11,7 +11,7 @@ Requires Python 3.11 or newer.
11
11
 
12
12
  For some features, additional programs must be available:
13
13
 
14
- * [kubectl](https://kubernetes.io/de/docs/reference/kubectl/) for most operations
14
+ * [kubectl](https://kubernetes.io/de/docs/reference/kubectl/) for applying
15
15
  * [kyverno](https://kyverno.io/docs/kyverno-cli/) ^1.13.x when using the Nyl `PostProcessor` resource
16
16
  * [sops](https://github.com/getsops/sops) when using the SOPS secrets provider
17
17
 
@@ -1,4 +1,66 @@
1
- # Changelog
1
+ ## 0.9.2 (2025-04-22)
2
+
3
+ <table><tr><th>Type</th><th>Description</th><th>PR</th><th>Issues</th><th>Author</th></tr>
4
+ <tr><td>Improvement</td><td>
5
+
6
+ Introduce new `values` object into templating evaluation namespace, replacing the `locals` object going forward. The `locals` name is still available but will be removed in an upcoming release.</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
7
+ <tr><td>Feature</td><td>
8
+
9
+ Allow defining parameters in the "values" of a profile, accessible via `${{ values.PARAM }}` throughout manifest rendering with the profile.</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
10
+ </table>
11
+
12
+ ## 0.9.1 (2025-04-20)
13
+
14
+ <table><tr><th>Type</th><th>Description</th><th>PR</th><th>Issues</th><th>Author</th></tr>
15
+ <tr><td>Improvement</td><td>
16
+
17
+ `nyl new component` now includes `metadata.labels` and `metadata.annotations` defaults in the generated `values.yaml`</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
18
+ <tr><td>Feature</td><td>
19
+
20
+ Add support for `NYL_ARGS` and `ARGOCD_ENV_NYL_ARGS` environment variables</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
21
+ <tr><td>Improvement</td><td>
22
+
23
+ Improve help text of `nyl new component` command</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
24
+ <tr><td>Improvement</td><td>
25
+
26
+ `.metadata.labels` set on a `HelmChart` resource now propagate and overwrite labels on the resources it generates (note that this also applies to Nyl components using Helm charts)</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
27
+ </table>
28
+
29
+ ## 0.9.0 (2025-04-15)
30
+
31
+ <table><tr><th>Type</th><th>Description</th><th>PR</th><th>Issues</th><th>Author</th></tr>
32
+ <tr><td>Feature</td><td>
33
+
34
+ Add ability to define and use local variables in manifests</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
35
+ <tr><td>Improvement</td><td>
36
+
37
+ argocd-cmp: Upgrade ArgoCD from v2.13.1 to v2.14.10</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
38
+ <tr><td>Improvement</td><td>
39
+
40
+ argocd-cmp: Upgrade Helm from v3.16.3 to v3.17.3</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
41
+ <tr><td>Improvement</td><td>
42
+
43
+ argocd-cmp: Upgrade Sops from v3.9.2 to v3.10.2</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
44
+ <tr><td>Improvement</td><td>
45
+
46
+ argocd-cmp: Upgrade Kyverno from 1.13.2 to 1.13.4</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
47
+ </table>
48
+
49
+ ## 0.8.1 (2025-01-22)
50
+
51
+ <table><tr><th>Type</th><th>Description</th><th>PR</th><th>Issues</th><th>Author</th></tr>
52
+ <tr><td>Fix</td><td>
53
+
54
+ Remove sneaky `breakpoint()` call in `nyl template`</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
55
+ </table>
56
+
57
+ ## 0.8.0 (2025-01-22)
58
+
59
+ <table><tr><th>Type</th><th>Description</th><th>PR</th><th>Issues</th><th>Author</th></tr>
60
+ <tr><td>Improvement</td><td>
61
+
62
+ Further improve on #56 by populating the namespace of resources earlier than later (e.g. before the `HelmChart` gets rendered, instead of only applying it to the resources generated by the `HelmChart` at the end).</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
63
+ </table>
2
64
 
3
65
  ## 0.7.2 (2025-01-17)
4
66
 
@@ -63,35 +125,6 @@ Refactor `PostProcessor` implementation for generating policy files and invoking
63
125
  `PostProcessor` log for invoking Kyverno now lists the policy file paths that are going to be applied</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
64
126
  <tr><td>Fix</td><td>
65
127
 
66
- `nyl new chart` now generates 2-space indented YAML and has a more complete template</td><td></td><td><a href="https://github.com/NiklasRosenstein/nyl/issues/47">47</a></td><td>@NiklasRosenstein</td></tr>
128
+ `nyl new chart` now generates 2-space indented YAML and has a more complete template</td><td></td><td><a href="https://github.com/NiklasRosenstein/nyl/issues/47">NiklasRosenstein/nyl#47</a></td><td>@NiklasRosenstein</td></tr>
67
129
  </table>
68
130
 
69
- ## 0.6.0
70
-
71
- * Upgraded `argocd-cmp-server` in `nyl/argocd-cmp` container image to `v2.13.1` (see [#46](https://github.com/helsing-ai/nyl/pull/46))
72
- * Re-introduce `settings.generate_placeholders` in `nyl-project.toml`, but warn if it is used. Enabling the option will have the
73
- same effect as setting `on_lookup_failure = "CreatePlaceholder"` and take precedence over the original value of `on_lookup_failure`.
74
-
75
- ## 0.5.1
76
-
77
- * Add Nix flake
78
- * Docs: Add missing API docs for `nyl.secrets.kubernetes`
79
-
80
- ## 0.5.0
81
-
82
- * Add the [`KubernetesSecret`](./reference/configuration/secrets.md#provider-kubernetessecret) secret provider
83
- * Add the `ntyl secrets set` and `nyl secrets unset` commands
84
- * Breaking: Replace the `settings.generate_placeholders` option with `settings.on_lookup_failure`
85
-
86
- ## 0.4.0
87
-
88
- * Automatically replace the host in Kubeconfig `server` field if it is set to `localhost`, `0.0.0.0` or `127.0.0.1`
89
- when a Kubeconfig is retrieved via SSH (saving you to configure `replace_apiserver_hostname` when sourcing a
90
- Kubeconfig from a K3s/RKE2 cluster via SSH).
91
- * Add `port` and `sudo` option to `KubeconfigFromSsh` config
92
-
93
- ## 0.3.0
94
-
95
- * Add [`PostProcessor`](./reference/templating/inlining/postprocessor.md) inline resource which supports applying
96
- Kyverno policies to the generated resources.
97
- * Fixed a bug in the construction of the local Helm chart path when referencing a Helm chart in a Git repository.
@@ -0,0 +1,22 @@
1
+ ---
2
+ title: Home
3
+ ---
4
+
5
+ # Welcome to the Nyl documentation
6
+
7
+ Nyl is a flexible configuration management tool for Kubernetes resources that can be used to generate and deploy
8
+ applications directly via the command-line and via an [ArgoCD ConfigManagementPlugin][CMP].
9
+
10
+ [CMP]: https://argoproj.github.io/argo-cd/operator-manual/config-management-plugins/
11
+
12
+ ## Features
13
+
14
+ - **Usability**: Define your deployments once and let ArgoCD apply them, or apply the same deployment from the CLI when you
15
+ need to break the glass without having to twist and warp your configuration for the occasion.
16
+
17
+ - **End-to-end configuration**: Not only codify your deployment configuration, but also how to connect to your cluster
18
+ when you use the CLI. From using the default kubeconfig, to connecting to your cluster via an SSH tunnel, Nyl got you.
19
+
20
+ - **Powerful templating**: Load and inject secrets from external sources, instantiate Helm charts, post-process your
21
+ manifests with Kyverno policies, streamline and standardize recurring configuration with Nyl components, lookup
22
+ existing objects in the target cluster, etc.
@@ -2,6 +2,11 @@
2
2
 
3
3
  This page summarizes all environment variables that are used by Nyl.
4
4
 
5
+ ## General
6
+
7
+ - `NYL_ARGS` &ndash; Additional command-line arguments to append to the Nyl invocation. Use with care, as options
8
+ accepted by a parent command are not accepted in a subcommand, and these arguments are only ever append to the
9
+ argument list.
5
10
  - `NYL_LOG_LEVEL` &ndash; The log level to use if `--log-level` is not specified. Defaults to `info`. Used by: `nyl`.
6
11
  - `NYL_PROFILE` &ndash; The name of the profile to use as defined in the closest `nyl-profiles.yaml` or
7
12
  `nyl-project.yaml` configuration file. Used by: `nyl profile`, `nyl template`, `nyl tun`.
@@ -12,10 +17,11 @@ This page summarizes all environment variables that are used by Nyl.
12
17
  Used by: `nyl profile`, `nyl template`, `nyl tun`.
13
18
  - `NYL_CACHE_DIR` &ndash; The directory where Nyl stores its cache, such as downloaded Helm charts and cloned
14
19
  repositories. Defaults to `cache/` relative to the `NYL_STATE_DIR`. Used by `nyl template`.
15
- - `ARGOCD_ENV_NYL_CMP_TEMPLATE_INPUT` &mdash; This variable is only recognized by `nyl template` when the only positional argument
16
- it receives is `.` (i.e. the current working directory). The variable should be a comma-separated list of filenames
17
- that should be treated as if the files were passed as arguments to `nyl template` instead. This is used for the Nyl
18
- ArgoCD plugin to allow specifying exactly which files should be templated as part of an ArgoCD application.
20
+
21
+ ## Build-environment variables
22
+
23
+ > The following variables are supported for they are provided by [ArgoCD as Build Environment Variables][^ArgoBuildEnv].
24
+
19
25
  - `KUBE_VERSION` &ndash; The version of the Kubernetes cluster. If this is not set, Nyl will try to query the Kubernetes
20
26
  API server to determine the version. When used as an ArgoCD plugin, this variable is usually available
21
27
  [^ArgoBuildEnv]. Used by: `nyl template`.
@@ -23,4 +29,15 @@ This page summarizes all environment variables that are used by Nyl.
23
29
  Nyl will try to query the Kubernetes API server to determine the versions. When used as an ArgoCD plugin, this
24
30
  variable is usually available [^ArgoBuildEnv]. Used by: `nyl template`.
25
31
 
32
+ ## Plugin variables
33
+
34
+ > ArgoCD permits passing environment variables to CustomManagementPlugins. These get prefixed with `ARGOCD_ENV` to
35
+ > ensure that only specifically supported variables can be set. The following such variables are supported by Nyl:
36
+
37
+ - `ARGOCD_ENV_NYL_ARGS` &ndash; Same as `NYL_ARGS`, but is taken into account after.
38
+ - `ARGOCD_ENV_NYL_CMP_TEMPLATE_INPUT` &mdash; This variable is only recognized by `nyl template` when the only positional argument
39
+ it receives is `.` (i.e. the current working directory). The variable should be a comma-separated list of filenames
40
+ that should be treated as if the files were passed as arguments to `nyl template` instead. This is used for the Nyl
41
+ ArgoCD plugin to allow specifying exactly which files should be templated as part of an ArgoCD application.
42
+
26
43
  [^ArgoBuildEnv]: See [ArgoCD Build Environment](https://argo-cd.readthedocs.io/en/stable/user-guide/build-environment/).
@@ -17,5 +17,6 @@ Currently, only the following names are available in the scope of the expression
17
17
 
18
18
  - `secrets`: A reference to the secrets provider. This is used to retrieve secrets from the configured secrets
19
19
  provider. See [Secrets](./secrets.md) for more information.
20
- - `locals`: A container for local variables defined in the same manifest. See [Local Variables](./locals.md) for more
21
- information.
20
+ - `values`: A container for values defined on the profile-level (see [Profiles](../configuration/profiles.md)) or in the
21
+ manifest (see [Local Variables](./locals.md)). (Note that the use of `locals` instead of `values` is deprecated and
22
+ will be removed in Nyl 0.10.x).
@@ -2,10 +2,10 @@
2
2
 
3
3
  You may define a YAML object in your Kubernetes manifest that is used to define variables that can later be accessed
4
4
  in the same manifest to achieve some level of DRY-ness. This is done by not setting any `apiVersion` or `kind`, and
5
- instead just define variables prefixed with `$`. Variables can later be accessed using the `${{ locals.var }}`.
5
+ instead just define variables prefixed with `$`. Variables can later be accessed using the `${{ values.var }}`.
6
6
 
7
7
  Note that expressions in values assigned to variables are not currently supported. This means that you cannot use e.g.
8
- `${{ secrets.get("my-secret") }}` in the value of a variable, nor can you use `${{ locals.var }}`.
8
+ `${{ secrets.get("my-secret") }}` in the value of a variable, nor can you use `${{ values.var }}`.
9
9
 
10
10
  ## Example
11
11
 
@@ -17,7 +17,7 @@ $name: my-app
17
17
  apiVersion: apps/v1
18
18
  kind: Deployment
19
19
  metadata:
20
- name: ${{ locals.name }}
20
+ name: ${{ values.name }}
21
21
  # ...
22
22
  ```
23
23
 
@@ -3,7 +3,8 @@ kind: StatefulSecret
3
3
  metadata:
4
4
  name: postgres-password
5
5
  stringData:
6
- PASSWORD: {{ randhex(32) }}
6
+ PASSWORD: ${{ randhex(32) }}
7
+
7
8
  ---
8
9
  apiVersion: nyl.io/v1
9
10
  kind: HelmChart
@@ -16,4 +17,4 @@ spec:
16
17
  version: 15.5.16
17
18
  values:
18
19
  auth:
19
- postgresPassword: {{ ref("Secret", "postgres-password", "PASSWORD") }}
20
+ postgresPassword: ${{ ref("Secret", "postgres-password", "PASSWORD") }}
@@ -0,0 +1,10 @@
1
+ [default.kubeconfig]
2
+ type = "ssh"
3
+ user = "root"
4
+ host = "k3s.host.local"
5
+ path = "/etc/rancher/k3s/k3s.yaml"
6
+
7
+ [default.tunnel]
8
+ type = "ssh"
9
+ user = "root"
10
+ host = "k3s.host.local"
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "nyl"
7
- version = "0.9.0"
7
+ version = "0.9.2"
8
8
  description = "Advanced templating engine for Kubernetes and GitOps."
9
9
  authors = [
10
10
  {name = "Niklas Rosenstein", email = "rosensteinniklas@gmail.com"},
@@ -29,7 +29,7 @@ readme = "README.md"
29
29
  license = {text = "MIT"}
30
30
 
31
31
  [project.scripts]
32
- nyl = "nyl.commands:app"
32
+ nyl = "nyl.commands:main"
33
33
 
34
34
  [tool.uv]
35
35
  dev-dependencies = [
nyl-0.9.2/slap.toml ADDED
@@ -0,0 +1,2 @@
1
+ [release]
2
+ pre-commit = "slap changelog format --all --markdown > docs/content/changelog.md && git add docs/content/changelog.md"
@@ -6,6 +6,7 @@ applications directly or integrate as an ArgoCD ConfigManagementPlugin.
6
6
  import atexit
7
7
  import json
8
8
  import os
9
+ import shlex
9
10
  import sys
10
11
  import time
11
12
  from dataclasses import dataclass
@@ -19,6 +20,7 @@ from typer import Option, Typer
19
20
  from kubernetes.client.api_client import ApiClient
20
21
  from nyl import __version__
21
22
  from nyl.profiles import ProfileManager
23
+ from nyl.profiles.config import Profile
22
24
  from nyl.project.config import ProjectConfig
23
25
  from nyl.secrets.config import SecretsConfig
24
26
  from nyl.tools.di import DependenciesProvider
@@ -109,6 +111,12 @@ def _callback(
109
111
  PROVIDER.get(ProfileManager), PROVIDER.get(ApiClientConfig).profile
110
112
  ),
111
113
  )
114
+ PROVIDER.set_lazy(
115
+ Profile,
116
+ lambda: PROVIDER.get(ProfileManager).config.profiles[
117
+ PROVIDER.get(ApiClientConfig).profile or template.DEFAULT_PROFILE
118
+ ],
119
+ )
112
120
 
113
121
 
114
122
  @app.command()
@@ -139,3 +147,16 @@ app.add_typer(profile.app)
139
147
  app.add_typer(secrets.app)
140
148
  app.add_typer(tools.app)
141
149
  app.add_typer(tun.app)
150
+
151
+
152
+ def main() -> None:
153
+ additional_args = []
154
+ for env in ("NYL_ARGS", "ARGOCD_ENV_NYL_ARGS"):
155
+ if env in os.environ:
156
+ additional_args = shlex.split(args_string := os.environ[env])
157
+ logger.opt(colors=True).debug(
158
+ "Adding additional arguments from <cyan>{}</>: <yellow>{}</>", env, args_string
159
+ )
160
+ sys.argv += additional_args
161
+ logger.opt(colors=True).debug("Full Nyl command-line: <yellow>{}</>", shlex.join(sys.argv))
162
+ app()
@@ -7,7 +7,7 @@ from pathlib import Path
7
7
  from textwrap import dedent
8
8
 
9
9
  from loguru import logger
10
- from typer import Option, Typer
10
+ from typer import Argument, Option, Typer
11
11
 
12
12
  from nyl.commands import PROVIDER
13
13
  from nyl.project.config import ProjectConfig
@@ -52,6 +52,9 @@ def chart(dir: Path) -> None:
52
52
  dir,
53
53
  "values.yaml",
54
54
  """
55
+ metadata:
56
+ annotations: {}
57
+ labels: {}
55
58
  image:
56
59
  repository: my/image
57
60
  tag: 1.0.0
@@ -71,6 +74,10 @@ def chart(dir: Path) -> None:
71
74
  "image"
72
75
  ],
73
76
  "properties": {
77
+ "metadata": {
78
+ "type": "object",
79
+ "additionalProperties": true
80
+ },
74
81
  "image": {
75
82
  "type": "string"
76
83
  }
@@ -111,11 +118,17 @@ def chart(dir: Path) -> None:
111
118
 
112
119
  @app.command()
113
120
  def component(
114
- api_version: str,
115
- kind: str,
121
+ api_version: str = Argument(help="API version of the component. Must be paired with the `kind` argument."),
122
+ kind: str = Argument(help="Kind of the component. Must be paired with the `api_version` argument."),
116
123
  type: ComponentType = Option("helm", help="The type of Nyl component to create."),
117
124
  ) -> None:
118
- """Create the boilerplate for a Nyl component in the components directory."""
125
+ """
126
+ Create the boilerplate for a Nyl component in the components directory.
127
+
128
+ Note that this is equivalent to `nyl new chart components/{api_version}/{kind}`, assuming the current project's
129
+ component directory is `components/` (the default, relative to the project configuration file or current working
130
+ directory).
131
+ """
119
132
 
120
133
  components_path = PROVIDER.get(ProjectConfig).get_components_path()
121
134
  chart(components_path / api_version / kind)
@@ -16,6 +16,7 @@ from nyl.commands import PROVIDER, ApiClientConfig, app
16
16
  from nyl.generator import reconcile_generator
17
17
  from nyl.generator.dispatch import DispatchingGenerator
18
18
  from nyl.profiles import ProfileManager
19
+ from nyl.profiles.config import Profile
19
20
  from nyl.project.config import ProjectConfig
20
21
  from nyl.resources import API_VERSION_INLINE, NylResource
21
22
  from nyl.resources.applyset import APPLYSET_LABEL_PART_OF, ApplySet
@@ -64,7 +65,7 @@ def get_profile_kubernetes_client(profiles: ProfileManager, profile: str | None)
64
65
 
65
66
  If no *profile* is specified, but the profile manager contains at least one profile, the *profile* argument will
66
67
  default to the value of :data:`DEFAULT_PROFILE` (which is `"default"`). Otherwise, if no profile is selected and
67
- none is configured, the standard Kubernetes config load takes place (i.e. try `KUBECONFIG` and then
68
+ none is configured, the standard Kubernetes config loading is used (i.e. try `KUBECONFIG` and then
68
69
  `~/.kube/config`).
69
70
  """
70
71
 
@@ -210,6 +211,9 @@ def template(
210
211
  else project.config.settings.on_lookup_failure,
211
212
  )
212
213
 
214
+ # Seed the template engine with the profile values.
215
+ vars(template_engine.values).update(PROVIDER.get(Profile).values)
216
+
213
217
  # Look for objects that contain local variables and feed them into the template engine.
214
218
  for manifest in source.manifests[:]:
215
219
  if "apiVersion" in manifest or "kind" in manifest:
@@ -227,7 +231,7 @@ def template(
227
231
  exit(1)
228
232
  for key, value in manifest.items():
229
233
  assert key.startswith("$"), key
230
- setattr(template_engine.locals, key[1:], value)
234
+ setattr(template_engine.values, key[1:], value)
231
235
  source.manifests.remove(manifest)
232
236
 
233
237
  # Begin populating the default namespace to resources.
@@ -215,4 +215,7 @@ class HelmChartGenerator(Generator[HelmChart], resource_type=HelmChart):
215
215
  if release.namespace:
216
216
  populate_namespace_to_resources(manifests, release.namespace)
217
217
 
218
+ for resource in manifests:
219
+ resource["metadata"].setdefault("labels", {}).update(res.metadata.labels or {})
220
+
218
221
  return manifests
@@ -0,0 +1,44 @@
1
+ from pathlib import Path
2
+ from tempfile import TemporaryDirectory
3
+ from typing import Iterator
4
+
5
+ import pytest
6
+ from nyl.generator.helmchart import HelmChartGenerator
7
+ from nyl.resources import ObjectMetadata
8
+ from nyl.resources.helmchart import ChartRef, HelmChart, HelmChartSpec
9
+ from nyl.tools.testing import TESTDATA_PATH
10
+
11
+ CHART_PATH = TESTDATA_PATH / "helm-test-chart"
12
+
13
+
14
+ @pytest.fixture
15
+ def generator() -> Iterator[HelmChartGenerator]:
16
+ with TemporaryDirectory() as _tmp:
17
+ tmp = Path(_tmp)
18
+ yield HelmChartGenerator(tmp, tmp, [], tmp, "1.31", set())
19
+
20
+
21
+ def test_helmchart_resource_overrides_labels(generator: HelmChartGenerator) -> None:
22
+ """
23
+ This test verifies that resources generated by a Helm chart component have their labels updated and overwritten
24
+ by labels on the resource that describes the chart instantiation.
25
+ """
26
+
27
+ chart_resource = HelmChart(
28
+ metadata=ObjectMetadata(
29
+ name="myapp",
30
+ namespace="mynamespace",
31
+ labels={"app.kubernetes.io/name": "overwritten-value", "team": "testing"},
32
+ ),
33
+ spec=HelmChartSpec(chart=ChartRef(path=str(CHART_PATH))),
34
+ )
35
+
36
+ resources = generator.generate(chart_resource)
37
+ assert len(resources) == 1
38
+ assert resources[0]["apiVersion"] == "v1"
39
+ assert resources[0]["kind"] == "ServiceAccount"
40
+ assert resources[0]["metadata"]["labels"] == {
41
+ "app.kubernetes.io/name": "overwritten-value",
42
+ "app.kubernetes.io/version": "1.0.0",
43
+ "team": "testing",
44
+ }
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  from dataclasses import dataclass, field
4
4
  from pathlib import Path
5
- from typing import Literal
5
+ from typing import Any, Literal
6
6
 
7
7
  from loguru import logger
8
8
 
@@ -13,7 +13,14 @@ from nyl.tools.loads import loadf
13
13
  @dataclass
14
14
  class Profile:
15
15
  """
16
- Represents a Kubernetes connection profile.
16
+ A profile embodies a set of configurations for a Kubernetes cluster that resources will be deployed to using Nyl.
17
+ It defines the Kubeconfig to use, whether to use an SSH tunnel to reach the cluster, as well as global values that
18
+ are accessible during rendering any manifest with the profile activated.
19
+ """
20
+
21
+ values: dict[str, Any] = field(default_factory=dict)
22
+ """
23
+ Global values that are accessible during manifest rendering under the `values` object.
17
24
  """
18
25
 
19
26
  kubeconfig: LocalKubeconfig | KubeconfigFromSsh = field(default_factory=lambda: LocalKubeconfig())
@@ -173,7 +173,7 @@ class NylTemplateEngine:
173
173
 
174
174
  secrets: SecretProvider
175
175
  client: ApiClient
176
- locals: Namespace = field(default_factory=Namespace)
176
+ values: Namespace = field(default_factory=Namespace)
177
177
  on_lookup_failure: Literal["Error", "CreatePlaceholder", "SkipResource"] = "Error"
178
178
 
179
179
  def __post_init__(self) -> None:
@@ -196,7 +196,14 @@ class NylTemplateEngine:
196
196
  NylTemplateEngine.current = prev
197
197
 
198
198
  def _new_engine(self) -> _TemplateEngine:
199
- return _TemplateEngine({"secrets": self.secrets, "locals": self.locals, **registered_functions})
199
+ return _TemplateEngine(
200
+ {
201
+ "secrets": self.secrets,
202
+ "locals": self.values, # TODO: Deprecate in 0.10.x
203
+ "values": self.values,
204
+ **registered_functions,
205
+ }
206
+ )
200
207
 
201
208
  def evaluate(self, value: Manifests, recursive: bool = True) -> Manifests:
202
209
  result = []
@@ -1,5 +1,8 @@
1
1
  from pathlib import Path
2
2
 
3
+ TESTDATA_PATH = Path(__file__).parent.parent.parent.parent / "testdata"
4
+ assert TESTDATA_PATH.is_dir(), f"testdata directory ({TESTDATA_PATH}) not found"
5
+
3
6
 
4
7
  def create_files(prefix: str | Path, files: dict[str, str]) -> None:
5
8
  for name, content in files.items():
@@ -0,0 +1,3 @@
1
+ apiVersion: v2
2
+ name: components-test-chart
3
+ version: '0.0.0'
@@ -0,0 +1,7 @@
1
+ apiVersion: v1
2
+ kind: ServiceAccount
3
+ metadata:
4
+ name: {{ .Release.Name }}
5
+ labels:
6
+ app.kubernetes.io/name: {{ .Release.Name }}
7
+ app.kubernetes.io/version: "1.0.0"
@@ -0,0 +1 @@
1
+ {}
@@ -1,7 +0,0 @@
1
- release-date = "2025-04-15"
2
-
3
- [[entries]]
4
- id = "a2772016-3dff-4da6-926d-1f47e509c63a"
5
- type = "feature"
6
- description = "Add ability to define and use local variables in manifests"
7
- author = "@NiklasRosenstein"
@@ -1,10 +0,0 @@
1
- ---
2
- title: Home
3
- ---
4
-
5
- # Welcome to the Nyl documentation
6
-
7
- Nyl is a flexible configuration management tool for Kubernetes resources that can be used to generate and deploy
8
- applications directly or integrate as an [ArgoCD ConfigManagementPlugin][CMP].
9
-
10
- [CMP]: https://argoproj.github.io/argo-cd/operator-manual/config-management-plugins/
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes