Commit 0f86cc0
authored
feat: Add automatic package label management and Package-to-Function mapping (#201)
### Motivation
This PR addresses the need for better relationship management between Functions and Packages in the FunctionStream operator. Previously, there was no automatic way to track which Functions depend on which Packages, making it difficult to:
1. Automatically trigger Function reconciliations when their referenced Packages are updated
2. Maintain consistent labeling for Functions based on their Package dependencies
3. Efficiently query Functions that depend on a specific Package
The changes also remove the overly restrictive validation that prevented Package updates when Functions referenced them, replacing it with a more flexible approach that automatically handles Package updates.
### Modifications
1. **Automatic Package Label Management**:
- Functions now automatically receive a `package` label that matches their `spec.package` field
- Labels are updated when the Package reference changes
- Existing labels are preserved when adding the package label
2. **Package-to-Function Mapping**:
- Added `mapPackageToFunctions` function that finds all Functions referencing a specific Package using label selectors
- Added Package watcher in the Function controller to trigger reconciliations when Packages are updated
- This enables automatic deployment updates when Package images change
3. **Enhanced Testing**:
- Added comprehensive test cases for automatic label management
- Added tests for Package-to-Function mapping functionality
- Added tests for cross-namespace Package updates
- Added tests for Package change propagation to multiple Functions
4. **Deployment Improvements**:
- Removed redundant `ImagePullPolicy` settings that were causing issues
- Streamlined container configuration
These changes provide a more robust and maintainable way to manage Function-Package relationships while enabling automatic updates when Package configurations change.
---------
Signed-off-by: EvanWave <[email protected]>1 parent 9393c4b commit 0f86cc0
File tree
8 files changed
+524
-80
lines changed- .github/workflows
- operator
- examples
- internal
- controller
- webhook/v1alpha1
8 files changed
+524
-80
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | | - | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
| |||
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
84 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
85 | 98 | | |
86 | 99 | | |
87 | 100 | | |
| |||
95 | 108 | | |
96 | 109 | | |
97 | 110 | | |
98 | | - | |
| 111 | + | |
99 | 112 | | |
100 | 113 | | |
101 | 114 | | |
102 | 115 | | |
103 | 116 | | |
104 | 117 | | |
105 | | - | |
| 118 | + | |
106 | 119 | | |
107 | 120 | | |
108 | 121 | | |
| |||
132 | 145 | | |
133 | 146 | | |
134 | 147 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
139 | 151 | | |
140 | 152 | | |
141 | 153 | | |
142 | 154 | | |
143 | 155 | | |
144 | 156 | | |
145 | | - | |
146 | | - | |
147 | | - | |
| 157 | + | |
| 158 | + | |
148 | 159 | | |
149 | 160 | | |
150 | 161 | | |
| |||
168 | 179 | | |
169 | 180 | | |
170 | 181 | | |
171 | | - | |
| 182 | + | |
172 | 183 | | |
173 | 184 | | |
174 | 185 | | |
| |||
199 | 210 | | |
200 | 211 | | |
201 | 212 | | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
202 | 231 | | |
203 | 232 | | |
204 | 233 | | |
| |||
280 | 309 | | |
281 | 310 | | |
282 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
283 | 316 | | |
284 | 317 | | |
285 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
0 commit comments