Skip to content

Comments

Add EndOfSupport flag#726

Open
sarthakpurohit wants to merge 1 commit intoopenshift:mainfrom
sarthakpurohit:endOfSuppport
Open

Add EndOfSupport flag#726
sarthakpurohit wants to merge 1 commit intoopenshift:mainfrom
sarthakpurohit:endOfSuppport

Conversation

@sarthakpurohit
Copy link

@sarthakpurohit sarthakpurohit commented Feb 20, 2026

Currently, the release controller has an EndOfLife flag that completely hides releases from the UI.
As a trick, minCreationIntervalSeconds is increased to a big number.
However, there's a need for an intermediate state where a release stream:

  • Should stop creating new releases
  • Should remain visible on the status pages (unlike EndOfLife)
  • Should not display countdown timers or pending release messages

This is useful for release streams that are no longer actively maintained but should still be accessible.

Usage
Set "endOfSupport": true in the release configuration to enable this behavior:

{
 "name": "4.19.0-0.okd-scos",
 "endOfSupport": true,
}

Summary by CodeRabbit

  • New Features
    • Added EndOfSupport status capability for releases. Releases marked as EndOfSupport will display "Release has reached end of support" messaging on status pages and will no longer create new periodic jobs or image tags.

@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

Walkthrough

The changes introduce an EndOfSupport field to ReleaseConfig and implement guards across the release controller to prevent new periodic jobs, image synchronization, and mark releases appropriately in HTTP responses when EndOfSupport is enabled.

Changes

Cohort / File(s) Summary
Type Definition
pkg/release-controller/types.go
Added new EndOfSupport boolean field to ReleaseConfig struct with JSON tag for configuration serialization.
Control Flow Guards
cmd/release-controller/periodic.go, cmd/release-controller/sync.go
Added guards to skip periodic job creation and block new image synchronization when EndOfSupport is true, with appropriate logging.
HTTP Response Handling
cmd/release-controller-api/http.go
Refactored delay calculation logic in three HTTP handlers to prioritize EndOfSupport checks, assigning a release delay message and bypassing further delay computations for end-of-support releases.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add EndOfSupport flag' accurately summarizes the main change - introducing a new EndOfSupport boolean field to the release configuration that controls release stream behavior, which is the primary focus across all modified files.
Stable And Deterministic Test Names ✅ Passed This pull request does not introduce any test names with dynamic information. All test naming follows best practices for deterministic testing.
Test Structure And Quality ✅ Passed PR contains no test files or test modifications; test structure quality assessment is not applicable.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 20, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sarthakpurohit
Once this PR has been reviewed and has the lgtm label, please assign hoxhaeris for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cmd/release-controller/sync.go (1)

243-259: ⚠️ Potential issue | 🟡 Minor

EndOfSupport guard doesn't suppress the interval-delay re-queue path.

When EndOfSupport is true and a firstTag exists, IsReleaseDelayedForInterval still executes and can set queueAfter > 0. This causes sync() to re-queue the release (line 130) at every interval even though no new tag will ever be created. For streams with MinCreationIntervalSeconds configured, this fires repeated unnecessary sync cycles for the lifetime of the EndOfSupport state.

hasNewImages is already false at this point, so the MaxUnreadyReleases check also redundantly runs.

🛠️ Proposed fix — break out of the switch after setting the EndOfSupport gate
 default:
     // gate creating new releases when end of support, at max unready, or in the cooldown interval
     if release.Config.EndOfSupport {
         klog.V(2).Infof("Release %s has reached end of support, will not launch new tags", release.Config.Name)
         hasNewImages = false
+        break
     }
     if release.Config.MaxUnreadyReleases > 0 && unreadyTagCount >= release.Config.MaxUnreadyReleases {

Using break inside a switch case exits the switch entirely, skipping both the MaxUnreadyReleases and IsReleaseDelayedForInterval checks, and preventing queueAfter from being populated for EndOfSupport releases.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/release-controller/sync.go` around lines 243 - 259, When
release.Config.EndOfSupport is true we must avoid running the subsequent checks
(MaxUnreadyReleases and IsReleaseDelayedForInterval) that can set queueAfter and
requeue the release; inside the switch case where you set hasNewImages = false
for EndOfSupport, add a break/exit from the switch immediately after setting the
flag so the logic that calls
releasecontroller.IsReleaseDelayedForInterval(firstTag) and assigns queueAfter
is skipped (refer to symbols: release.Config.EndOfSupport, hasNewImages,
firstTag, releasecontroller.IsReleaseDelayedForInterval, queueAfter).
🧹 Nitpick comments (1)
cmd/release-controller-api/http.go (1)

1718-1731: Triplicated EndOfSupport + delay-computation block — extract a shared helper.

The identical if EndOfSupport { … } else if non-stable && tags { … } pattern is copy-pasted into httpReleases, httpReleaseStreamTable, and httpDashboardOverview. Additionally, var delays []string is declared at the outer scope but only ever populated in the else if branch.

♻️ Suggested helper extraction
// computeReleaseDelay returns the appropriate *ReleaseDelay for a stream,
// or nil if no delay applies.
func computeReleaseDelay(r *releasecontroller.Release, tags []*imagev1.TagReference) *ReleaseDelay {
    if r.Config.EndOfSupport {
        return &ReleaseDelay{Message: "Release has reached end of support"}
    }
    if r.Config.As == releasecontroller.ReleaseConfigModeStable || len(tags) == 0 {
        return nil
    }
    var delays []string
    if ok, _, queueAfter := releasecontroller.IsReleaseDelayedForInterval(r, tags[0]); ok {
        delays = append(delays, fmt.Sprintf("waiting for %s", queueAfter.Truncate(time.Second)))
    }
    if r.Config.MaxUnreadyReleases > 0 && releasecontroller.CountUnreadyReleases(r, tags) >= r.Config.MaxUnreadyReleases {
        delays = append(delays, fmt.Sprintf("no more than %d pending", r.Config.MaxUnreadyReleases))
    }
    if len(delays) > 0 {
        return &ReleaseDelay{Message: fmt.Sprintf("Next release may not start: %s", strings.Join(delays, ", "))}
    }
    return nil
}

Then in each handler replace the current block with:

s.Delayed = computeReleaseDelay(r, s.Tags)

Also applies to: 1970-1983, 2129-2142

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/release-controller-api/http.go` around lines 1718 - 1731, Extract a
shared helper function computeReleaseDelay(r *releasecontroller.Release, tags
[]*imagev1.TagReference) *ReleaseDelay that encapsulates the repeated logic:
check r.Config.EndOfSupport and return &ReleaseDelay{Message:"Release has
reached end of support"}; return nil if r.Config.As ==
releasecontroller.ReleaseConfigModeStable || len(tags) == 0; otherwise build a
local delays []string, append the "waiting for ..." message when
releasecontroller.IsReleaseDelayedForInterval(r, tags[0]) returns ok, append the
"no more than N pending" message when r.Config.MaxUnreadyReleases > 0 and
releasecontroller.CountUnreadyReleases(r, tags) >= r.Config.MaxUnreadyReleases,
and return &ReleaseDelay{Message: fmt.Sprintf("Next release may not start: %s",
strings.Join(delays, ", "))} when non-empty; replace the duplicated blocks in
httpReleases, httpReleaseStreamTable, and httpDashboardOverview (and the other
occurrences) with s.Delayed = computeReleaseDelay(r, s.Tags).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@cmd/release-controller/sync.go`:
- Around line 243-259: When release.Config.EndOfSupport is true we must avoid
running the subsequent checks (MaxUnreadyReleases and
IsReleaseDelayedForInterval) that can set queueAfter and requeue the release;
inside the switch case where you set hasNewImages = false for EndOfSupport, add
a break/exit from the switch immediately after setting the flag so the logic
that calls releasecontroller.IsReleaseDelayedForInterval(firstTag) and assigns
queueAfter is skipped (refer to symbols: release.Config.EndOfSupport,
hasNewImages, firstTag, releasecontroller.IsReleaseDelayedForInterval,
queueAfter).

---

Nitpick comments:
In `@cmd/release-controller-api/http.go`:
- Around line 1718-1731: Extract a shared helper function computeReleaseDelay(r
*releasecontroller.Release, tags []*imagev1.TagReference) *ReleaseDelay that
encapsulates the repeated logic: check r.Config.EndOfSupport and return
&ReleaseDelay{Message:"Release has reached end of support"}; return nil if
r.Config.As == releasecontroller.ReleaseConfigModeStable || len(tags) == 0;
otherwise build a local delays []string, append the "waiting for ..." message
when releasecontroller.IsReleaseDelayedForInterval(r, tags[0]) returns ok,
append the "no more than N pending" message when r.Config.MaxUnreadyReleases > 0
and releasecontroller.CountUnreadyReleases(r, tags) >=
r.Config.MaxUnreadyReleases, and return &ReleaseDelay{Message: fmt.Sprintf("Next
release may not start: %s", strings.Join(delays, ", "))} when non-empty; replace
the duplicated blocks in httpReleases, httpReleaseStreamTable, and
httpDashboardOverview (and the other occurrences) with s.Delayed =
computeReleaseDelay(r, s.Tags).

@sarthakpurohit
Copy link
Author

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 24, 2026

@sarthakpurohit: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant