feat(promotion-windows): add promotion windows for auto-promotion#5544
feat(promotion-windows): add promotion windows for auto-promotion#5544LittaKake wants to merge 1 commit intoakuity:mainfrom
Conversation
✅ Deploy Preview for docs-kargo-io ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| loc, err := time.LoadLocation(promotionWindowSpec.TimeZone) | ||
| if err != nil { | ||
| return false, fmt.Errorf("unable to load time zone: %w", err) |
There was a problem hiding this comment.
Default to UTC when timeZone is omitted
checkPromotionWindow always calls time.LoadLocation(promotionWindowSpec.TimeZone) and treats a missing timeZone as an error, even though the CRD/docs describe the field as optional with a UTC default. Any PromotionWindow created without a timeZone now returns an error from CheckPromotionWindows, which bubbles up through autoPromotionAllowed and blocks Stage reconciliation/auto-promotion. Please default to UTC when the field is empty instead of erroring.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
if the returned timeZone is "" it should already default to UTC.
Signed-off-by: Kristoffer Fagerbekk <fagerbekk@hotmail.com> Signed-off-by: Kristoffer Fagerbekk <kristoffer.fagerbekk@cognite.com>
ca3f560 to
1dddda1
Compare
|
Conceptually if you had auto promotion on and had a promotion window. If something was wrong with the release to prevent it from being promoted to the next env you would need to modify this CR and disable the window. Is that the correct structure you imagine? |
My intent isn't to have this CR used for adhoc disabling of autopromotion. If thats what you mean. |
Promotion Windows
This PR partly adds the requested feature for allowing/disallowing promotions based on time windows as tracked here #1328.
PR introduces a new CRD, PromotionWindow, which can be referenced from
ProjectConfig.spec.promotionPolicies[].promotionWindowsto control when automatic promotions are allowed or denied.I opted for a CRD for re-usability of common timewindows (such as weekends). Its also easier to re-use if its ever decided to put a reference field in either
stageorwarehouseaswell.Note
The PR opts for putting
promotionWindowsdirectly belowpromotionPoliciesfor now, but it could be better to rework the spec with...promotionPolicies[].autoPromotion.enabledand...promotionPolicies[].autoPromotion.promotionWindowsinstead. But I want someones opinion on this before proceeding.PromotionWindow CRD
A PromotionWindow defines, in spec, a time window using the following fields:
Example
Define a PromotionWindow that allows promotions during weekdays:
Reference the window from a ProjectConfig:
Evaluation
The evaluation of promotionWindows are as follows
Considerations
ClusterPromotionWindowto enable re-use of typical windows (such as christmas, weekends, etc)