keikoproj / addon-manager

Manage addons in a Kubernetes cluster
Apache License 2.0
71 stars 25 forks source link

fix: remove old workflows on addon checksum change #297

Closed ccpeng closed 1 year ago

ccpeng commented 1 year ago

fixes: #285 #174

with contribution from @estela-ramirez

a new addon (but has the same checksum from recent past) won't generate a new workflow since a previous workflow was already created; as a result, the addon gets stuck on pending

fix is to purge old workflows so a new workflow can get created

codecov[bot] commented 1 year ago

Codecov Report

Merging #297 (9ebe761) into master (ef27eb5) will decrease coverage by 0.39%. The diff coverage is 64.28%.

@@            Coverage Diff             @@
##           master     #297      +/-   ##
==========================================
- Coverage   56.20%   55.81%   -0.39%     
==========================================
  Files          14       14              
  Lines        1893     1933      +40     
==========================================
+ Hits         1064     1079      +15     
- Misses        715      734      +19     
- Partials      114      120       +6     
Files Coverage Δ
pkg/workflows/workflow.go 68.71% <100.00%> (+0.09%) :arrow_up:
controllers/addon_controller.go 53.53% <63.41%> (-1.72%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

kevdowney commented 1 year ago

I think the Addon can still get stuck in pending if there's no further updates or controllers aren't updating... we can additionally add a check before return from https://github.com/keikoproj/addon-manager/blob/ef27eb55c2f360f9aa6d24d4ca60c0117bdb79bf/controllers/addon_controller.go#L350

if instance.IsPending() {
  return ctrl.Result{RequeAfter: 5 * Duration.Seconds}, nil
}