From 73f16f0e77cf89a91bed100e1aa37179c7037bc5 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten Date: Sun, 9 Feb 2025 12:04:25 +0100 Subject: [PATCH] feat(common): include dependencies as a common-subtree (#31534) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** This PR, creates a subkey for common called "dependencies", which will get merged with the main program. Technically it functions the same as helm-dependencies, but instead of creating multiple charts it merges everything in a single chart ⚒️ Fixes # **⚙️ Type of change** - [x] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [x] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [ ] ⚖️ My code follows the style guidelines of this project - [ ] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [ ] ⬆️ I increased versions for any altered app according to semantic versioning - [ ] I made sure the title starts with `feat(chart-name):`, `fix(chart-name):` or `chore(chart-name):` **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Signed-off-by: Kjeld Schouten --- charts/library/common-test/Chart.yaml | 2 +- charts/library/common/Chart.yaml | 2 +- charts/library/common/templates/values/_init.tpl | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/charts/library/common-test/Chart.yaml b/charts/library/common-test/Chart.yaml index 195b2cc4970..5ffe691cc0a 100644 --- a/charts/library/common-test/Chart.yaml +++ b/charts/library/common-test/Chart.yaml @@ -7,7 +7,7 @@ apiVersion: v2 appVersion: unknown dependencies: - name: common - version: ~26.1.0 + version: ~26.2.0 repository: file://../common/ condition: "" alias: "" diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index 42fe1986c25..fd0425e3eb6 100644 --- a/charts/library/common/Chart.yaml +++ b/charts/library/common/Chart.yaml @@ -48,4 +48,4 @@ sources: - https://hub.docker.com/_/ - https://hub.docker.com/r/mikefarah/yq type: library -version: 26.1.0 +version: 26.2.0 diff --git a/charts/library/common/templates/values/_init.tpl b/charts/library/common/templates/values/_init.tpl index 154742d8cba..0ae6a642574 100644 --- a/charts/library/common/templates/values/_init.tpl +++ b/charts/library/common/templates/values/_init.tpl @@ -9,6 +9,18 @@ {{- $commonValues := mustDeepCopy .Values.common -}} {{- $chartValues := mustDeepCopy (omit .Values "common") -}} {{- $mergedValues := mustMergeOverwrite $commonValues $chartValues -}} + {{- range $name, $dependencyValues := .Values.dependencies -}} + {{ $enabled := (include "tc.v1.common.lib.util.enabled" (dict + "rootCtx" $ "objectData" $dependencyValues + "name" $name "caller" "dependency" + "key" "dependencies")) }} + {{- if eq $enabled "true" -}} + {{- $dependencyValues := omit $dependencyValues "global " -}} + {{- $dependencyValues := omit $dependencyValues "securityContext " -}} + {{- $dependencyValues := omit $dependencyValues "podOptions " -}} + {{- $mergedValues = mustMergeOverwrite $mergedValues $dependencyValues -}} + {{- end -}} + {{- end -}} {{- $_ := set . "Values" (mustDeepCopy $mergedValues) -}} {{- end -}} {{- end -}}