You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KRA-1027 - change release name generation to avoid conflicts (#156)
* chore: moved cdc specific functions from runtime to internal library
* feat: implement deterministic release name generation to avoid conflicts
* chore: update deps
* docs: update Helm release name logic to avoid conflicts in different namespaces
* feat: enhance release name generation to handle missing UID by generating a random suffix
* refactor: remove logging dependency from handler and update context usage in HTTP tracing
* chore: update unstructured-runtime dependency to v0.3.0
* fix: update tracer initialization to use verbose mode based on metadata
The **Composition Dynamic Controller (CDC)** is a specialized Kubernetes operator that orchestrates the end-to-end lifecycle of Krateo compositions. Acting as the reconciliation engine for Composition custom resources, it bridges declarative application definitions with Helm’s packaging system through intelligent automation. The **Chart Inspector** serves as its "safety advisor," enabling proactive decision-making via dry-run analysis.
@@ -55,7 +67,7 @@ The **Composition Dynamic Controller (CDC)** is a specialized Kubernetes operato
55
67
56
68
---
57
69
58
-
### **Why This Architecture Matters**
70
+
### Why This Architecture Matters
59
71
1.**Safety Net**
60
72
- The Chart Inspector’s dry-run prevents "helm surprises" (e.g., undeclared CRD creations or namespace pollution).
61
73
- Example: Blocks a chart upgrade if the new version requires a `ClusterRole` the CDC isn’t authorized to manage.
@@ -70,7 +82,7 @@ The **Composition Dynamic Controller (CDC)** is a specialized Kubernetes operato
70
82
71
83
---
72
84
73
-
### **Real-World Example: Handling a Breaking Chart Change**
85
+
### Real-World Example: Handling a Breaking Chart Change
74
86
1.**Scenario**: A Helm chart v1.2.0 introduces a new `CustomResourceDefinition` (CRD).
75
87
2.**CDC+Inspector Flow**:
76
88
-**Dry-run** detects the new CRD and its required API group permissions.
@@ -79,6 +91,33 @@ The **Composition Dynamic Controller (CDC)** is a specialized Kubernetes operato
79
91
3.**Result**: Zero downtime; no "helm upgrade failed: CRD missing" errors.
80
92
81
93
94
+
---
95
+
96
+
## Helm Release Name Logic
97
+
98
+
### Prior Versions (<= 0.19.9)
99
+
100
+
For versions up to 0.19.9, the **`composition-dynamic-controller`** used the following logic to determine the **Helm release name** associated with a composition resource:
101
+
102
+
1. If the **label**`krateo.io/release-name` is set on the composition resource, its value is used as the Helm release name.
103
+
2. Otherwise, the **composition resource name** is used as the Helm release name.
104
+
105
+
---
106
+
107
+
### Subsequent Versions (>= 0.20.0)
108
+
109
+
Starting from version 0.20.0, the **`composition-dynamic-controller`** uses the following logic to determine the Helm release name associated with a composition resource:
110
+
111
+
1. If the **annotation**`krateo.io/release-name` is set on the composition resource, its value is used as the Helm release name.
112
+
2. Otherwise, the release name is composed as follows: **`{composition.metadata.name}-{composition.metadata.uid[:8]}`**.
113
+
114
+
**N.B.:** From this version onward, the `metadata.name` field of the composition cannot exceed **44 characters**. This is because the UID suffix adds **9 characters** to the release name (the hyphen `-` plus the 8 characters of the UID), and Helm release names cannot exceed **53 characters** in total.
115
+
116
+
This change was implemented to avoid conflicts when multiple resources belonging to the `composition.krateo.io` group with the same `metadata.name` are created in **different namespaces**.
The composition-dynamic-controller inject labels and values into the installed resources and in the helm chart release values. This values contains informations about the composition resource associated with the helm release.
0 commit comments