- Notifications
You must be signed in to change notification settings - Fork1k
Commitc74ead4
committed
chore: add managed_agent_limit licensing feature
Note that enforcement and checking usage will come in a future PR.This feature is implemented differently than existing features in a fewways.Firstly, the feature is represented as a single feature in the codersdkworld, but is represented with multiple features in the license.E.g. in the license you may have: { "features": { "managed_agent_limit_soft": 100,"managed_agent_limit_hard": 200 } }But the entitlements endpoint will return a single feature: { "features": { "managed_agent_limit": { "limit": 200, "soft_limit": 100} } }This is required because of our rigid parsing that uses a`map[string]int64` for features in the license. To avoid requiring allcustomers to upgrade to use new licenses, the decision was made to justuse two features and merge them into one. Older Coder deployments willparse this feature (from new licenses) as two separate features, butit's not a problem because they don't get used anywhere obviously.The reason we want to differentiate between a "soft" and "hard" limit isso we can show admins how much of the usage is "included" vs. how muchthey can use before they get hard cut-off.The second major difference to other features is that "usage period"features such as `managed_agent_limit` will now be primarily compared bythe `iat` (issued at) claim of the license they come from. This differsfrom previous features. The reason this was done was so we could reducelimits with newer licenses, which the current comparison code does notallow for.This effectively means if you have two active licenses:- `iat`: 2025-07-14, `managed_agent_limit_soft`: 100, `managed_agent_limit_hard`: 200- `iat`: 2025-07-15, `managed_agent_limit_soft`: 50, `managed_agent_limit_hard`: 100Then the resulting `managed_agent_limit` entitlement will come from thesecond license, even though the values are smaller than another validlicense. The existing comparison code would prefer the first licenseeven though it was issued earlier.Existing limit features, like the user limit, just measure the currentusage value of the feature. The active user count is a gauge that goesup and down, whereas agent usage can only be incremented, so it doesn'tmake sense to use a continually incrementing counter forever and everfor managed agents.For managed agent limit, we count the usage between `nbf` (not before)and `exp` (expires at) of the license that the entitlement comes from.In the example above, we'd use the issued at date and expiry of thesecond license as this date range.This essentially means, when you get a new license, the usage resets tozero.The actual usage counting code will be implemented in a follow-up PR.Temporarily (until further notice), we will be providing licenses with`feature_set` set to `premium` a default limit.- Soft limit: `800 * user_limit`- Hard limit: `1000 * user_limit`"Enterprise" licenses do not get any default limit and are not entitledto use the feature.Unlicensed customers (e.g. OSS) will be permitted to use the feature asmuch as they want without limits. This will be implemented when thecounting code is implemented in a follow-up PR.1 parentf1eec2d commitc74ead4
File tree
5 files changed
+826
-62
lines changed- codersdk
- enterprise/coderd
- coderdenttest
- license
5 files changed
+826
-62
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
85 | 85 |
| |
86 | 86 |
| |
87 | 87 |
| |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
88 | 92 |
| |
89 | 93 |
| |
90 |
| - | |
91 |
| - | |
92 |
| - | |
93 |
| - | |
94 |
| - | |
95 |
| - | |
96 |
| - | |
97 |
| - | |
98 |
| - | |
99 |
| - | |
100 |
| - | |
101 |
| - | |
102 |
| - | |
103 |
| - | |
104 |
| - | |
105 |
| - | |
106 |
| - | |
107 |
| - | |
108 |
| - | |
109 |
| - | |
110 |
| - | |
111 |
| - | |
112 |
| - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
113 | 129 |
| |
114 | 130 |
| |
115 | 131 |
| |
| |||
153 | 169 |
| |
154 | 170 |
| |
155 | 171 |
| |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
156 | 188 |
| |
157 | 189 |
| |
158 | 190 |
| |
| |||
177 | 209 |
| |
178 | 210 |
| |
179 | 211 |
| |
180 |
| - | |
| 212 | + | |
181 | 213 |
| |
182 | 214 |
| |
183 | 215 |
| |
184 | 216 |
| |
185 | 217 |
| |
186 | 218 |
| |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
187 | 223 |
| |
188 | 224 |
| |
| 225 | + | |
| 226 | + | |
| 227 | + | |
189 | 228 |
| |
190 | 229 |
| |
191 | 230 |
| |
| |||
196 | 235 |
| |
197 | 236 |
| |
198 | 237 |
| |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
199 | 257 |
| |
200 | 258 |
| |
201 | 259 |
| |
| |||
205 | 263 |
| |
206 | 264 |
| |
207 | 265 |
| |
208 |
| - | |
209 |
| - | |
210 |
| - | |
211 |
| - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
212 | 272 |
| |
213 |
| - | |
| 273 | + | |
| 274 | + | |
214 | 275 |
| |
215 | 276 |
| |
216 | 277 |
| |
| |||
225 | 286 |
| |
226 | 287 |
| |
227 | 288 |
| |
228 |
| - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
229 | 293 |
| |
230 |
| - | |
| 294 | + | |
231 | 295 |
| |
232 | 296 |
| |
233 | 297 |
| |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
234 | 312 |
| |
235 | 313 |
| |
236 | 314 |
| |
| |||
295 | 373 |
| |
296 | 374 |
| |
297 | 375 |
| |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
298 | 383 |
| |
299 | 384 |
| |
300 | 385 |
| |
| |||
306 | 391 |
| |
307 | 392 |
| |
308 | 393 |
| |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
309 | 407 |
| |
310 | 408 |
| |
311 | 409 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
554 | 554 |
| |
555 | 555 |
| |
556 | 556 |
| |
557 |
| - | |
558 |
| - | |
559 |
| - | |
560 |
| - | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
561 | 567 |
| |
562 | 568 |
| |
563 | 569 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
176 | 176 |
| |
177 | 177 |
| |
178 | 178 |
| |
179 |
| - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
180 | 184 |
| |
181 | 185 |
| |
182 | 186 |
| |
| 187 | + | |
183 | 188 |
| |
184 | 189 |
| |
185 | 190 |
| |
186 | 191 |
| |
187 | 192 |
| |
188 | 193 |
| |
| 194 | + | |
189 | 195 |
| |
190 | 196 |
| |
191 | 197 |
| |
| |||
236 | 242 |
| |
237 | 243 |
| |
238 | 244 |
| |
| 245 | + | |
239 | 246 |
| |
240 | 247 |
| |
241 | 248 |
| |
| |||
246 | 253 |
| |
247 | 254 |
| |
248 | 255 |
| |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
249 | 261 |
| |
250 | 262 |
| |
251 | 263 |
| |
252 | 264 |
| |
253 | 265 |
| |
254 | 266 |
| |
255 |
| - | |
| 267 | + | |
256 | 268 |
| |
257 | 269 |
| |
258 | 270 |
| |
| |||
264 | 276 |
| |
265 | 277 |
| |
266 | 278 |
| |
267 |
| - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
268 | 285 |
| |
269 | 286 |
| |
270 | 287 |
| |
|
0 commit comments
Comments
(0)