Retry apply if conflict is detected#639
Conversation
Pull Request Test Coverage Report for Build 1045
💛 - Coveralls |
4a34191 to
5d31fb4
Compare
|
|
||
| // defaultObjectMerger merges an object with an object already in the cluster. This | ||
| // will ensure that important cluster values aren't overwritten. | ||
| type defaultObjectMerger struct { |
There was a problem hiding this comment.
should we also have this in here:
var _ objectMerger = (*defaultObjectMerger)(nil)|
|
||
| return string(newobj.GetUID()), nil | ||
| } | ||
| time.Sleep(a.conflictTimeout) |
There was a problem hiding this comment.
is it worth trying exponential backoff? 1 second is generally a long time. do you have any statistics on how frequently one retry is enough? i know 1 - 5 seconds isn't a terrible amount of time, but things add up and commandline and returning to the users quickly is nice.
also would be nice to have a debug level log entry to know a retry happened.
There was a problem hiding this comment.
That's an interesting thought. I modeled it this way based on what I thought I saw in kubectl. This is something that we should possibly explore in the future.
| actions.OptionSkipGc: viper.GetBool(vApplySkipGc), | ||
| } | ||
|
|
||
| fmt.Println("extract jsonnet flag") |
There was a problem hiding this comment.
is this worth logging instead?
There was a problem hiding this comment.
No, it was a debugging artifact.
| @@ -109,24 +72,54 @@ type Apply struct { | |||
| // these make it easier to test Apply. | |||
There was a problem hiding this comment.
are all of the below (especially the things you added) just things to make testing easier - are any of them essential to Apply outside the config except for adding easy testing?
When applying objects to a cluster, there a small chance that a conflict could arise. Instead of failing instantly, sleep for one second, and retry up to five times. Fixes ksonnet#619 Signed-off-by: bryanl <bryanliles@gmail.com>
5d31fb4 to
97a91b5
Compare
When applying objects to a cluster, there a small chance that a
conflict could arise. Instead of failing instantly, sleep for one
second, and retry up to five times.
Fixes #619
Signed-off-by: bryanl bryanliles@gmail.com