nyl 0.10.0__tar.gz → 0.10.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 (143) hide show
  1. nyl-0.10.2/.changelog/0.10.1.toml +13 -0
  2. nyl-0.10.2/.changelog/0.10.2.toml +31 -0
  3. {nyl-0.10.0 → nyl-0.10.2}/PKG-INFO +2 -1
  4. {nyl-0.10.0 → nyl-0.10.2}/argocd-cmp/Dockerfile +10 -7
  5. {nyl-0.10.0 → nyl-0.10.2}/docs/content/changelog.md +31 -0
  6. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/configuration/environment.md +14 -0
  7. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/glossary.md +2 -1
  8. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/templating/basics.md +1 -2
  9. {nyl-0.10.0 → nyl-0.10.2}/pyproject.toml +5 -1
  10. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/commands/__init__.py +27 -29
  11. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/commands/add.py +11 -11
  12. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/commands/template.py +97 -60
  13. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/daemon.py +40 -35
  14. nyl-0.10.2/src/nyl/generator/__init__.py +90 -0
  15. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/generator/components.py +4 -4
  16. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/generator/dispatch.py +4 -4
  17. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/generator/helmchart.py +7 -7
  18. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/generator/statefulsecret.py +4 -4
  19. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/resources/__init__.py +8 -8
  20. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/resources/applyset.py +2 -2
  21. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/resources/postprocessor.py +18 -18
  22. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/resources/postprocessor_test.py +11 -11
  23. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/templating.py +5 -6
  24. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/tools/kubectl.py +3 -3
  25. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/tools/kubernetes.py +4 -4
  26. nyl-0.10.2/src/nyl/tools/pyroscope.py +58 -0
  27. nyl-0.10.2/src/nyl/tools/types.py +12 -0
  28. nyl-0.10.2/src/nyl/tools/url.py +33 -0
  29. nyl-0.10.2/src/pyroscope/__init__.pyi +11 -0
  30. {nyl-0.10.0 → nyl-0.10.2}/uv.lock +71 -1
  31. nyl-0.10.0/DEPRECATION_NOTICE.md +0 -7
  32. nyl-0.10.0/slap.toml +0 -2
  33. nyl-0.10.0/src/nyl/generator/__init__.py +0 -76
  34. nyl-0.10.0/src/nyl/tools/types.py +0 -12
  35. {nyl-0.10.0 → nyl-0.10.2}/.changelog/0.10.0.toml +0 -0
  36. {nyl-0.10.0 → nyl-0.10.2}/.changelog/0.7.0.toml +0 -0
  37. {nyl-0.10.0 → nyl-0.10.2}/.changelog/0.7.1.toml +0 -0
  38. {nyl-0.10.0 → nyl-0.10.2}/.changelog/0.7.2.toml +0 -0
  39. {nyl-0.10.0 → nyl-0.10.2}/.changelog/0.8.0.toml +0 -0
  40. {nyl-0.10.0 → nyl-0.10.2}/.changelog/0.8.1.toml +0 -0
  41. {nyl-0.10.0 → nyl-0.10.2}/.changelog/0.9.0.toml +0 -0
  42. {nyl-0.10.0 → nyl-0.10.2}/.changelog/0.9.1.toml +0 -0
  43. {nyl-0.10.0 → nyl-0.10.2}/.changelog/0.9.2.toml +0 -0
  44. {nyl-0.10.0 → nyl-0.10.2}/.changelog/0.9.3.toml +0 -0
  45. {nyl-0.10.0 → nyl-0.10.2}/.changelog/0.9.4.toml +0 -0
  46. {nyl-0.10.0 → nyl-0.10.2}/.envrc +0 -0
  47. {nyl-0.10.0 → nyl-0.10.2}/.github/workflows/docker.yaml +0 -0
  48. {nyl-0.10.0 → nyl-0.10.2}/.github/workflows/docs.yaml +0 -0
  49. {nyl-0.10.0 → nyl-0.10.2}/.github/workflows/python.yaml +0 -0
  50. {nyl-0.10.0 → nyl-0.10.2}/.github/workflows/update-flake-lock.yaml +0 -0
  51. {nyl-0.10.0 → nyl-0.10.2}/.gitignore +0 -0
  52. {nyl-0.10.0 → nyl-0.10.2}/README.md +0 -0
  53. {nyl-0.10.0 → nyl-0.10.2}/argocd-cmp/README.md +0 -0
  54. {nyl-0.10.0 → nyl-0.10.2}/argocd-cmp/plugin.yaml +0 -0
  55. {nyl-0.10.0 → nyl-0.10.2}/argocd-with-nyl/.envrc +0 -0
  56. {nyl-0.10.0 → nyl-0.10.2}/argocd-with-nyl/.secrets.yaml +0 -0
  57. {nyl-0.10.0 → nyl-0.10.2}/argocd-with-nyl/.sops.yaml +0 -0
  58. {nyl-0.10.0 → nyl-0.10.2}/argocd-with-nyl/README.md +0 -0
  59. {nyl-0.10.0 → nyl-0.10.2}/argocd-with-nyl/argocd.yaml +0 -0
  60. {nyl-0.10.0 → nyl-0.10.2}/argocd-with-nyl/nyl-project.yaml +0 -0
  61. {nyl-0.10.0 → nyl-0.10.2}/argocd-with-nyl/nyl-secrets.yaml +0 -0
  62. {nyl-0.10.0 → nyl-0.10.2}/docs/content/index.md +0 -0
  63. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/applysets.md +0 -0
  64. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/argocd-plugin.md +0 -0
  65. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/cluster-connectivity.md +0 -0
  66. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/configuration/profiles.md +0 -0
  67. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/configuration/projects.md +0 -0
  68. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/configuration/secrets.md +0 -0
  69. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/configuration-api/profiles.md +0 -0
  70. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/configuration-api/secrets.md +0 -0
  71. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/templating/components.md +0 -0
  72. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/templating/inlining/helmcharts.md +0 -0
  73. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/templating/inlining/overview.md +0 -0
  74. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/templating/inlining/postprocessor.md +0 -0
  75. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/templating/locals.md +0 -0
  76. {nyl-0.10.0 → nyl-0.10.2}/docs/content/reference/templating/secrets.md +0 -0
  77. {nyl-0.10.0 → nyl-0.10.2}/docs/mkdocs.yml +0 -0
  78. {nyl-0.10.0 → nyl-0.10.2}/docs/pyproject.toml +0 -0
  79. {nyl-0.10.0 → nyl-0.10.2}/docs/uv.lock +0 -0
  80. {nyl-0.10.0 → nyl-0.10.2}/example/manifests/postgres.yaml +0 -0
  81. {nyl-0.10.0 → nyl-0.10.2}/example/nyl-profiles.toml +0 -0
  82. {nyl-0.10.0 → nyl-0.10.2}/example/nyl-profiles.yaml +0 -0
  83. {nyl-0.10.0 → nyl-0.10.2}/example/nyl-secrets.yaml +0 -0
  84. {nyl-0.10.0 → nyl-0.10.2}/example/secrets.yaml +0 -0
  85. {nyl-0.10.0 → nyl-0.10.2}/flake.lock +0 -0
  86. {nyl-0.10.0 → nyl-0.10.2}/flake.nix +0 -0
  87. {nyl-0.10.0 → nyl-0.10.2}/nix/uv.nix +0 -0
  88. {nyl-0.10.0 → nyl-0.10.2}/renovate.json +0 -0
  89. {nyl-0.10.0 → nyl-0.10.2}/src/kubernetes/README.md +0 -0
  90. {nyl-0.10.0 → nyl-0.10.2}/src/kubernetes/__init__.pyi +0 -0
  91. {nyl-0.10.0 → nyl-0.10.2}/src/kubernetes/dynamic/__init__.pyi +0 -0
  92. {nyl-0.10.0 → nyl-0.10.2}/src/kubernetes/dynamic/client.pyi +0 -0
  93. {nyl-0.10.0 → nyl-0.10.2}/src/kubernetes/dynamic/discovery.pyi +0 -0
  94. {nyl-0.10.0 → nyl-0.10.2}/src/kubernetes/dynamic/exceptions.pyi +0 -0
  95. {nyl-0.10.0 → nyl-0.10.2}/src/kubernetes/dynamic/resource.pyi +0 -0
  96. {nyl-0.10.0 → nyl-0.10.2}/src/kubernetes/watch/__init__.pyi +0 -0
  97. {nyl-0.10.0 → nyl-0.10.2}/src/kubernetes/watch/watch.pyi +0 -0
  98. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/__init__.py +0 -0
  99. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/commands/crds.py +0 -0
  100. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/commands/new.py +0 -0
  101. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/commands/profile.py +0 -0
  102. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/commands/run.py +0 -0
  103. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/commands/secrets.py +0 -0
  104. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/commands/tools/__init__.py +0 -0
  105. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/commands/tools/bcrypt.py +0 -0
  106. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/commands/tools/sops.py +0 -0
  107. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/commands/tun.py +0 -0
  108. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/generator/dispatch_test.py +0 -0
  109. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/generator/helmchart_test.py +0 -0
  110. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/profiles/__init__.py +0 -0
  111. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/profiles/config.py +0 -0
  112. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/profiles/config_test.py +0 -0
  113. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/profiles/kubeconfig.py +0 -0
  114. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/profiles/tunnel.py +0 -0
  115. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/project/config.py +0 -0
  116. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/resources/applyset_test.py +0 -0
  117. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/resources/helmchart.py +0 -0
  118. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/resources/helmchart_test.py +0 -0
  119. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/resources/placeholder.py +0 -0
  120. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/resources/statefulsecret.py +0 -0
  121. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/secrets/__init__.py +0 -0
  122. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/secrets/config.py +0 -0
  123. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/secrets/config_test.py +0 -0
  124. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/secrets/kubernetes.py +0 -0
  125. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/secrets/null.py +0 -0
  126. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/secrets/sops.py +0 -0
  127. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/secrets/sops_test.py +0 -0
  128. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/templating_test.py +0 -0
  129. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/tools/di.py +0 -0
  130. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/tools/fs.py +0 -0
  131. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/tools/fs_test.py +0 -0
  132. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/tools/kvstore.py +0 -0
  133. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/tools/loads.py +0 -0
  134. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/tools/logging.py +0 -0
  135. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/tools/shell.py +0 -0
  136. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/tools/testing.py +0 -0
  137. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/tools/typer.py +0 -0
  138. {nyl-0.10.0 → nyl-0.10.2}/src/nyl/tools/yaml.py +0 -0
  139. {nyl-0.10.0 → nyl-0.10.2}/testdata/helm-test-chart/Chart.yaml +0 -0
  140. {nyl-0.10.0 → nyl-0.10.2}/testdata/helm-test-chart/templates/sa.yaml +0 -0
  141. {nyl-0.10.0 → nyl-0.10.2}/testdata/helm-test-chart/values.yaml +0 -0
  142. {nyl-0.10.0 → nyl-0.10.2}/tests/__init__.py +0 -0
  143. {nyl-0.10.0 → nyl-0.10.2}/tests/conftest.py +0 -0
@@ -0,0 +1,13 @@
1
+ release-date = "2025-05-07"
2
+
3
+ [[entries]]
4
+ id = "e7c7e8db-6db7-40f5-989b-05f1a5338a2a"
5
+ type = "improvement"
6
+ description = "Measure time of successful `nyl template` execution and log a line of level `\"METRIC\"` with a JSON metric payload"
7
+ author = "@NiklasRosenstein"
8
+
9
+ [[entries]]
10
+ id = "3e0e2141-a00c-441e-a637-c2c4dbcf3482"
11
+ type = "improvement"
12
+ description = "Fan out evaluation of Nyl inline resources using ThreadPoolExecutor"
13
+ author = "@NiklasRosenstein"
@@ -0,0 +1,31 @@
1
+ release-date = "2025-05-08"
2
+
3
+ [[entries]]
4
+ id = "4668b8d5-dacd-44d5-a2c4-a05e0511759b"
5
+ type = "hygiene"
6
+ description = "Rename `Manifest` and `Manifests` to `Resource` and `ResourceList` in codebase, and variable names/members accordingly"
7
+ author = "@NiklasRosenstein"
8
+
9
+ [[entries]]
10
+ id = "96175744-25b9-45eb-8b36-2bec70ffa2d0"
11
+ type = "deprecation"
12
+ description = "Remove `locals` from scope of template rendering, use `values` instead"
13
+ author = "@NiklasRosenstein"
14
+
15
+ [[entries]]
16
+ id = "07b855f7-3d5a-4a7c-9412-aa140e42e2e2"
17
+ type = "feature"
18
+ description = "Add support for `NYL_PYROSCOPE_*` environment variables."
19
+ author = "@NiklasRosenstein"
20
+
21
+ [[entries]]
22
+ id = "2eb36ed9-9967-4f43-b40f-39e8e177829f"
23
+ type = "improvement"
24
+ description = "Switch to using `python:3.13-slim` as base image instead of `python:3.13-alpine` to allow installing `pyroscope-io`, imag size is only marginally impacted"
25
+ author = "@NiklasRosenstein"
26
+
27
+ [[entries]]
28
+ id = "26bd73b3-ea9b-49ad-8af0-9782356d5722"
29
+ type = "improvement"
30
+ description = "Remove some Kubernetes-specific environment variables from log line that exposes Nyl-specific environment variables, and redact NYL_PYROSCOPE_URL"
31
+ author = "@NiklasRosenstein"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nyl
3
- Version: 0.10.0
3
+ Version: 0.10.2
4
4
  Summary: Advanced templating engine for Kubernetes and GitOps.
5
5
  Author-email: Niklas Rosenstein <rosensteinniklas@gmail.com>
6
6
  License: MIT
@@ -12,6 +12,7 @@ Requires-Dist: jinja2>=3.1.4
12
12
  Requires-Dist: kubernetes>=30.1.0
13
13
  Requires-Dist: loguru>=0.7.2
14
14
  Requires-Dist: nr-stream>=1.1.5
15
+ Requires-Dist: pyroscope-io>=0.8.11
15
16
  Requires-Dist: pyyaml>=6.0.1
16
17
  Requires-Dist: requests>=2.32.3
17
18
  Requires-Dist: stablehash<0.3.0,>=0.2.1
@@ -1,9 +1,10 @@
1
+ FROM python:3.13-slim AS build_base
2
+ COPY --from=ghcr.io/astral-sh/uv:0.7.2 /uv /bin/uv
1
3
 
2
4
  #: Build Nyl itself.
3
5
  #: -----------------
4
6
 
5
- FROM python:3.13-alpine AS build
6
- COPY --from=ghcr.io/astral-sh/uv:0.7.2 /uv /bin/uv
7
+ FROM build_base AS build
7
8
 
8
9
  WORKDIR /opt/nyl
9
10
 
@@ -83,8 +84,10 @@ RUN \
83
84
  #: Build the ArgoCD CMP server image.
84
85
  #: ----------------------------------
85
86
 
86
- FROM python:3.13-alpine AS nyl-cmp
87
- RUN apk add git
87
+ FROM python:3.13-slim AS nyl-cmp
88
+ RUN apt-get update && \
89
+ apt-get install -y --no-install-recommends git && \
90
+ rm -rf /var/lib/apt/lists/*
88
91
  COPY --from=argocd-bin /usr/local/bin/argocd /usr/local/bin/argocd
89
92
  RUN ln -s /usr/local/bin/argocd /usr/local/bin/argocd-cmp-server && chown 999:999 /usr/local/bin/argocd-cmp-server
90
93
  COPY --from=helm-bin /usr/local/bin/helm /usr/local/bin/helm
@@ -97,9 +100,9 @@ COPY --chown=999 argocd-cmp/plugin.yaml /home/argocd/cmp-server/config/plugin.ya
97
100
 
98
101
  # Validate Nyl can be run, plus various setup steps.
99
102
  RUN nyl version \
100
- && addgroup -S argocd \
101
- && adduser -u 999 argocd -G argocd -D \
102
- && mkdir -p /var/log/nyl \
103
+ && groupadd --system --gid 999 argocd && \
104
+ useradd --system --uid 999 --gid 999 --home /home/argocd -m --shell /bin/false argocd && \
105
+ mkdir -p /var/log/nyl \
103
106
  && chown -R argocd:argocd /var/log/nyl
104
107
 
105
108
  USER argocd
@@ -1,3 +1,34 @@
1
+ ## 0.10.2 (2025-05-08)
2
+
3
+ <table><tr><th>Type</th><th>Description</th><th>PR</th><th>Issues</th><th>Author</th></tr>
4
+ <tr><td>Hygiene</td><td>
5
+
6
+ Rename `Manifest` and `Manifests` to `Resource` and `ResourceList` in codebase, and variable names/members accordingly</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
7
+ <tr><td>Deprecation</td><td>
8
+
9
+ Remove `locals` from scope of template rendering, use `values` instead</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
10
+ <tr><td>Feature</td><td>
11
+
12
+ Add support for `NYL_PYROSCOPE_*` environment variables.</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
13
+ <tr><td>Improvement</td><td>
14
+
15
+ Switch to using `python:3.13-slim` as base image instead of `python:3.13-alpine` to allow installing `pyroscope-io`, imag size is only marginally impacted</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
16
+ <tr><td>Improvement</td><td>
17
+
18
+ Remove some Kubernetes-specific environment variables from log line that exposes Nyl-specific environment variables, and redact NYL_PYROSCOPE_URL</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
19
+ </table>
20
+
21
+ ## 0.10.1 (2025-05-07)
22
+
23
+ <table><tr><th>Type</th><th>Description</th><th>PR</th><th>Issues</th><th>Author</th></tr>
24
+ <tr><td>Improvement</td><td>
25
+
26
+ Measure time of successful `nyl template` execution and log a line of level `"METRIC"` with a JSON metric payload</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
27
+ <tr><td>Improvement</td><td>
28
+
29
+ Fan out evaluation of Nyl inline resources using ThreadPoolExecutor</td><td></td><td></td><td>@NiklasRosenstein</td></tr>
30
+ </table>
31
+
1
32
  ## 0.10.0 (2025-05-07)
2
33
 
3
34
  <table><tr><th>Type</th><th>Description</th><th>PR</th><th>Issues</th><th>Author</th></tr>
@@ -17,6 +17,9 @@ This page summarizes all environment variables that are used by Nyl.
17
17
  Used by: `nyl profile`, `nyl template`, `nyl tun`.
18
18
  - `NYL_CACHE_DIR` &ndash; The directory where Nyl stores its cache, such as downloaded Helm charts and cloned
19
19
  repositories. Defaults to `cache/` relative to the `NYL_STATE_DIR`. Used by `nyl template`.
20
+ - `NYL_TEMPLATE_JOBS` &ndash; The maximum number of jobs to use for parallel evaluation of Nyl inline resources
21
+ when running `nyl template`. If not set, and not specified with the `-j, --jobs` option, an adequate number of jobs
22
+ will be selected automatically.
20
23
 
21
24
  ## Build-environment variables
22
25
 
@@ -55,3 +58,14 @@ This page summarizes all environment variables that are used by Nyl.
55
58
  - `NYL_DAEMON_SOCK` &ndash; This variable is only used by the ArgoCD CMP `plugin.yaml`. If set, it tells the plugin
56
59
  to use the `nyl-daemon` in client mode instead of running `nyl template` directly and connect to the Nyl daemon using
57
60
  a Unix socket as specified in the variable value.
61
+
62
+ ## Other
63
+
64
+ - `NYL_PYROSCOPE_URL` &ndash; The Pyroscope server URL to use for profiling, optionally with basic auth credentials
65
+ in the format `http://username:password@host:port`. The application name may be specified with `?application_name=name`
66
+ and the tenant ID with `?tenant_id=id`. The application name and tenant ID are optional. The name defaults to `nyl`,
67
+ while the tenant ID defaults to no value. Any additional parameters are used as tags.
68
+ - `NYL_PYROSCOPE_APPLICATION_NAME` &ndash; If set, it takes priority over the `?application_name` specified in the
69
+ `NYL_PYROSCOPE_URL`.
70
+ - `NYL_PYROSCOPE_TENANT_ID` &ndash; If set, it takes priority over the `?tenant_id` specified in the
71
+ `NYL_PYROSCOPE_URL`.
@@ -20,7 +20,8 @@ auto-filling and resource post-processing applying only to all resources defined
20
20
  ### Resource
21
21
 
22
22
  A resource is a YAML document that follows the schema of a Kubernetes API resource or [Nyl inline resource][Nyl-inline].
23
- An example would be a Kubernetes `ConfigMap`, `Deployment`, `Pod` or a Nyl `HelmChart` or `PostProcessor`.
23
+ An example would be a Kubernetes `ConfigMap`, `Deployment`, `Pod` or a Nyl `HelmChart` or `PostProcessor`. A list of
24
+ resources is referred to as a `ResourceList` and is typically loaded from a manifest file.
24
25
 
25
26
  ### Secrets provider
26
27
 
@@ -18,5 +18,4 @@ Currently, only the following names are available in the scope of the expression
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
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).
21
+ manifest (see [Local Variables](./locals.md)).
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "nyl"
7
- version = "0.10.0"
7
+ version = "0.10.2"
8
8
  description = "Advanced templating engine for Kubernetes and GitOps."
9
9
  authors = [
10
10
  {name = "Niklas Rosenstein", email = "rosensteinniklas@gmail.com"},
@@ -17,6 +17,7 @@ dependencies = [
17
17
  "kubernetes>=30.1.0",
18
18
  "loguru>=0.7.2",
19
19
  "nr-stream>=1.1.5",
20
+ "pyroscope-io>=0.8.11",
20
21
  "pyyaml>=6.0.1",
21
22
  "requests>=2.32.3",
22
23
  "stablehash>=0.2.1,<0.3.0",
@@ -60,3 +61,6 @@ ruff-fmt = "uv run ruff format --check ."
60
61
 
61
62
  [tool.slap.run]
62
63
  fmt = "uv run ruff format . && uv run ruff check --fix ."
64
+
65
+ [tool.slap.release]
66
+ pre-commit = "uv lock && git add uv.lock && slap changelog format --all --markdown > docs/content/changelog.md && git add docs/content/changelog.md"
@@ -3,13 +3,10 @@ Nyl is a flexible configuration management tool for Kubernetes resources that ca
3
3
  applications directly or integrate as an ArgoCD ConfigManagementPlugin.
4
4
  """
5
5
 
6
- import atexit
7
- from contextlib import ExitStack
8
6
  import json
9
7
  import os
10
8
  import shlex
11
9
  import sys
12
- import time
13
10
  from dataclasses import dataclass
14
11
  from enum import Enum
15
12
  from pathlib import Path
@@ -25,8 +22,10 @@ from nyl.project.config import ProjectConfig
25
22
  from nyl.secrets.config import SecretsConfig
26
23
  from nyl.tools.di import DependenciesProvider
27
24
  from nyl.tools.logging import lazy_str
25
+ from nyl.tools.pyroscope import init_pyroscope, tag_wrapper
28
26
  from nyl.tools.shell import pretty_cmd
29
27
  from nyl.tools.typer import new_typer
28
+ from nyl.tools.url import url_extract_basic_auth
30
29
 
31
30
  app: Typer = new_typer(help=__doc__)
32
31
 
@@ -70,14 +69,13 @@ def _callback(
70
69
  log_details: bool = Option(False, help="Include logger- and function names in the log message format."),
71
70
  log_file: Optional[Path] = Option(None, help="Additionally log to the given file."),
72
71
  ) -> None:
73
- start_time = time.perf_counter()
74
-
75
72
  if log_details:
76
73
  fmt = f"{LOG_TIME_FORMAT} | {LOG_LEVEL_FORAMT} | {LOG_DETAILS_FORMAT} | {LOG_MESSAGE_FORMAT}"
77
74
  else:
78
75
  fmt = f"{LOG_TIME_FORMAT} | {LOG_LEVEL_FORAMT} | {LOG_MESSAGE_FORMAT}"
79
76
 
80
77
  logger.remove()
78
+ logger.level("METRIC", 40, "<green><bold>")
81
79
  logger.add(sys.stderr, level=LogLevel.ERROR.name if quiet else log_level.name, format=fmt)
82
80
  if log_file:
83
81
  logger.add(log_file, level=log_level.name, format=fmt)
@@ -88,8 +86,16 @@ def _callback(
88
86
  logger.debug("Current working directory: {}", Path.cwd())
89
87
  log_env = {}
90
88
  for key, value in os.environ.items():
91
- if key.startswith("ARGOCD_") or key.startswith("NYL_") or key.startswith("KUBE_"):
89
+ if (
90
+ # Keep ARGOCD_ environment variables but filter out those that are likely set by Kubernetes.
91
+ (key.startswith("ARGOCD_") and not (key.endswith("_PORT") or key.endswith("_TCP") or key.endswith("_ADDR")))
92
+ or key.startswith("NYL_")
93
+ or key.startswith("KUBE_")
94
+ ):
92
95
  log_env[key] = value
96
+ # Mask sensitive information in the environment variables that are well-known.
97
+ if "NYL_PYROSCOPE_URL" in log_env:
98
+ log_env["NYL_PYROSCOPE_URL"] = url_extract_basic_auth(log_env["NYL_PYROSCOPE_URL"], mask=True)[0]
93
99
  logger.debug("Nyl-relevant environment variables: {}", lazy_str(json.dumps, log_env, indent=2))
94
100
 
95
101
  PROVIDER.set_lazy(ProfileManager, lambda: ProfileManager.load(required=False))
@@ -104,18 +110,6 @@ def _callback(
104
110
  ),
105
111
  )
106
112
 
107
- exit_stack = ExitStack()
108
- PROVIDER.set(ExitStack, exit_stack)
109
- atexit.register(exit_stack.close)
110
-
111
- # HACK: If we don't wrap it in a lambda, Loguru fails with "ValueError: call stack is not deep enough".
112
- # But we also need to wrap it so we capture the right end time.
113
- def _finalize() -> None:
114
- duration = time.perf_counter() - start_time
115
- logger.debug("Finished (nyl {}) in {:.2f}s", lazy_str(pretty_cmd, sys.argv), duration)
116
-
117
- exit_stack.callback(_finalize)
118
-
119
113
 
120
114
  @app.command()
121
115
  def version() -> None:
@@ -145,14 +139,18 @@ app.add_typer(tools.app)
145
139
  app.add_typer(tun.app)
146
140
 
147
141
 
148
- def main() -> None:
149
- additional_args = []
150
- for env in ("NYL_ARGS", "ARGOCD_ENV_NYL_ARGS"):
151
- if env in os.environ:
152
- additional_args = shlex.split(args_string := os.environ[env])
153
- logger.opt(colors=True).debug(
154
- "Adding additional arguments from <cyan>{}</>: <yellow>{}</>", env, args_string
155
- )
156
- sys.argv += additional_args
157
- logger.opt(colors=True).debug("Full Nyl command-line: <yellow>{}</>", shlex.join(sys.argv))
158
- app()
142
+ def main(args: list[str] | None = None) -> None:
143
+ init_pyroscope()
144
+
145
+ with tag_wrapper({"entrypoint": "nyl"}):
146
+ additional_args = []
147
+ for env in ("NYL_ARGS", "ARGOCD_ENV_NYL_ARGS"):
148
+ if env in os.environ:
149
+ additional_args = shlex.split(args_string := os.environ[env])
150
+ logger.opt(colors=True).debug(
151
+ "Adding additional arguments from <cyan>{}</>: <yellow>{}</>", env, args_string
152
+ )
153
+ sys.argv += additional_args
154
+ logger.opt(colors=True).debug("Full Nyl command-line: <yellow>{}</>", shlex.join(sys.argv))
155
+
156
+ app(args)
@@ -18,7 +18,7 @@ from nyl.commands.template import (
18
18
  from nyl.resources import ObjectMetadata
19
19
  from nyl.resources.helmchart import ChartRef, HelmChart, HelmChartSpec
20
20
  from nyl.tools.typer import new_typer
21
- from nyl.tools.types import Manifests
21
+ from nyl.tools.types import ResourceList
22
22
 
23
23
  app: Typer = new_typer(name="add", help=__doc__)
24
24
 
@@ -27,7 +27,7 @@ MANIFEST_OPTION = Option(..., "-m", "--manifest", help="The manifest YAML file t
27
27
 
28
28
  @app.command()
29
29
  def namespace(
30
- manifest: Path = MANIFEST_OPTION,
30
+ manifest_file: Path = MANIFEST_OPTION,
31
31
  name: str = Argument(help="Name of the namespace to add."),
32
32
  ) -> None:
33
33
  """
@@ -36,15 +36,15 @@ def namespace(
36
36
  If this is the first namespace defined in the manifest, it will be annotated with `nyl.io/is-default-namespace`.
37
37
  """
38
38
 
39
- if manifest.exists():
40
- content = manifest.read_text()
41
- resources = load_manifests([manifest])[0]
39
+ if manifest_file.exists():
40
+ content = manifest_file.read_text()
41
+ manifest = load_manifests([manifest_file])[0]
42
42
  else:
43
43
  content = ""
44
- resources = ManifestsWithSource(Manifests([]), manifest)
44
+ manifest = ManifestsWithSource(ResourceList([]), manifest_file)
45
45
 
46
- if any(is_namespace_resource(x) and x["metadata"]["name"] == name for x in resources.manifests):
47
- logger.error("Namespace '{}' already exists in {}.", name, manifest)
46
+ if any(is_namespace_resource(x) and x["metadata"]["name"] == name for x in manifest.resources):
47
+ logger.error("Namespace '{}' already exists in {}.", name, manifest_file)
48
48
  sys.exit(1)
49
49
 
50
50
  namespace: dict[str, Any] = {
@@ -55,16 +55,16 @@ def namespace(
55
55
  },
56
56
  }
57
57
 
58
- as_default = not any(is_namespace_resource(x) for x in resources.manifests)
58
+ as_default = not any(is_namespace_resource(x) for x in manifest.resources)
59
59
  if as_default:
60
60
  namespace["metadata"]["annotations"] = {DEFAULT_NAMESPACE_ANNOTATION: "true"}
61
61
 
62
62
  if not content.lstrip().startswith("---"):
63
63
  content = f"---\n{content}"
64
64
  content = f"---\n{yaml.safe_dump(namespace, sort_keys=False)}\n{content}"
65
- manifest.write_text(content)
65
+ manifest_file.write_text(content)
66
66
 
67
- logger.info("Added {}namespace '{}' to {}.", "default " if as_default else "", name, manifest)
67
+ logger.info("Added {}namespace '{}' to {}.", "default " if as_default else "", name, manifest_file)
68
68
 
69
69
 
70
70
  @app.command()