-
Notifications
You must be signed in to change notification settings - Fork 29
fix(#710): when creation/update of a namespace fails,create new ones with new base-name #714
fix(#710): when creation/update of a namespace fails,create new ones with new base-name #714
Conversation
…create new ones with new base-name
c := obj.(context.Context) | ||
x, ok := obj.(InternalServerError) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other our services we actually pass the context as InternalServerError instead of interface{}. Which helps to fetch bugs when a controller doesn't declare 500 result in design on the compilation phase. See https://github.com/fabric8-services/fabric8-common/blob/41debd6a68ab0999841b3fdc53e3603f16fa76e2/goasupport/jsonapi_errors_helpers/jsonapi_errors_converter.go.txt#L149
Not critical for this PR though. Let's address it later (after merging the refactoring PR).
Codecov Report
@@ Coverage Diff @@
## master #714 +/- ##
==========================================
+ Coverage 59.28% 61.43% +2.15%
==========================================
Files 34 34
Lines 2569 2570 +1
==========================================
+ Hits 1523 1579 +56
+ Misses 889 824 -65
- Partials 157 167 +10
Continue to review full report at Codecov.
|
There is an issue when reset and update/create actions come after each other too quickly and OS is too slow, then the update/creation fails with conflict for jenkins PVC. The reason is that the original one is still not completely removed while a new one is already requested.
This fix detects such conflicts (or 403 when PVC is in being terminated). If there is such an error - let say for user
[email protected]
where the namespace is namedmjobanek-jenkins
- then it deletes all namespaces for the user (all that starts withmjobanek
) and adds a suffix to the base-name -mjobanek2
if is available (not used by other user). Then it tries to create new namespaces with this base-name (mjobanek2
,mjobanek2-jenkins
, ...). If this attempt fails as well, then it returns an errorFor more information please read: openshiftio/openshift.io#4598 (comment) and openshiftio/openshift.io#4598 (comment)
I know that the code looks terrible, but it is hard to do it nicely with the current codebase
fixes: #710