Skip to content

Commit 0ee5874

Browse files
bakayoloampcode-com
andcommitted
fix: correctly classify extended support as YELLOW, not RED
Resources past standard support but still in extended support were incorrectly classified as RED because: 1. convertCycle checked EOL date before extended support window 2. Policy treated IsDeprecated as RED even when IsExtendedSupport was set Now: extended support check runs first, and policy excludes extended support resources from RED status. EKS k8s 1.30/1.32 correctly show as YELLOW with 'in extended support (6x standard cost)' message. Amp-Thread-ID: https://ampcode.com/threads/T-019d92b6-b80d-731a-8a83-64e6442ae52c Co-authored-by: Amp <amp@ampcode.com>
1 parent 50c51ef commit 0ee5874

2 files changed

Lines changed: 23 additions & 14 deletions

File tree

pkg/eol/endoflife/provider.go

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -297,38 +297,47 @@ func (p *Provider) convertCycle(engine, product string, cycle *ProductCycle) (*t
297297
}
298298
}
299299

300-
// Determine lifecycle status based on dates
300+
// Determine lifecycle status based on dates.
301+
// For products like EKS, the "support" field is absent and "eol" means
302+
// end of standard support while "extendedSupport" is the true end of life.
303+
// We treat eolDate as the standard support boundary when supportDate is nil.
301304
now := time.Now()
302305

303-
// If we have an EOL date and we're past it, mark as EOL
304-
if eolDate != nil && now.After(*eolDate) {
305-
lifecycle.IsEOL = true
306-
lifecycle.IsSupported = false
307-
lifecycle.IsDeprecated = true
308-
return lifecycle, nil
306+
// Resolve the effective standard-support-end date
307+
standardEnd := supportDate
308+
if standardEnd == nil {
309+
standardEnd = eolDate
309310
}
310311

311-
// If we have extended support end and we're past standard support
312-
if extendedSupportDate != nil && supportDate != nil && now.After(*supportDate) {
312+
// Check extended support window first — must come before the EOL check
313+
// so that resources in extended support get YELLOW, not RED.
314+
if extendedSupportDate != nil && standardEnd != nil && now.After(*standardEnd) {
313315
if now.Before(*extendedSupportDate) {
314316
// In extended support window
315317
lifecycle.IsSupported = true
316318
lifecycle.IsExtendedSupport = true
317319
lifecycle.IsDeprecated = true
318320
} else {
319-
// Past extended support
321+
// Past extended support — truly EOL
320322
lifecycle.IsEOL = true
321323
lifecycle.IsSupported = false
322324
lifecycle.IsDeprecated = true
323325
}
324326
return lifecycle, nil
325327
}
326328

327-
// If we're past support date but no extended support info
329+
// Past EOL with no extended support available
330+
if eolDate != nil && now.After(*eolDate) {
331+
lifecycle.IsEOL = true
332+
lifecycle.IsSupported = false
333+
lifecycle.IsDeprecated = true
334+
return lifecycle, nil
335+
}
336+
337+
// Past standard support but no extended support info
328338
if supportDate != nil && now.After(*supportDate) {
329339
lifecycle.IsDeprecated = true
330340
lifecycle.IsSupported = false
331-
// If we have EOL date, use it; otherwise mark as deprecated but not EOL
332341
if eolDate != nil && now.Before(*eolDate) {
333342
lifecycle.IsEOL = false
334343
}

pkg/policy/default.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ func (p *DefaultPolicy) isRedStatus(lifecycle *types.VersionLifecycle) bool {
7171
return true
7272
}
7373

74-
// Deprecated
75-
if lifecycle.IsDeprecated {
74+
// Deprecated (but not if still in extended support)
75+
if lifecycle.IsDeprecated && !lifecycle.IsExtendedSupport {
7676
return true
7777
}
7878

0 commit comments

Comments
 (0)