add recreate option for update-policy directive#189
add recreate option for update-policy directive#189kvaps wants to merge 2 commits intosplunk:mainfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #189 +/- ##
==========================================
- Coverage 73.30% 72.92% -0.39%
==========================================
Files 51 51
Lines 4252 4284 +32
==========================================
+ Hits 3117 3124 +7
- Misses 961 986 +25
Partials 174 174
Continue to review full report at Codecov.
|
internal/remote/client.go
Outdated
| return nil, err | ||
| } | ||
|
|
||
| watcher, err := ri.Watch(metav1.ListOptions{}) |
There was a problem hiding this comment.
I don't think the watch algo is correct. You are watching on all objects of that type in the namespace and stopping the watch without checking on the name. If a different object gets deleted, it can trigger the end of your watch
There was a problem hiding this comment.
|
@gotwarlost any updates here? |
|
will do shortly. |
| TimeoutSeconds: &waitTime, | ||
| FieldSelector: "metadata.name=" + obj.GetName(), | ||
| }) | ||
| if err != nil { |
There was a problem hiding this comment.
is this correct? The delete logic says if err != nil && !apiErrors.IsNotFound(err) which means a non-existent object will pass that gate as it should.
What will happen if you start watching that non-existent object? What does the watcher return?
Also I think the watcher should be used as an optimization. That is, the invariant we are looking for is that "this object doesn't exist before I try to create it". We should make sure that this invariant is true before calling create
This PR adds new option:
Which allow to recreate resources when they change.
This might be really useful for updating jobs and some other immutable objects eg. storage class.
see kubernetes/kubernetes#89657 for more details
solves: #64
partially solves: #149
Now
post-installandpost-upgradehelm hooks can be achieved by rewriting them withdirectives.qbec.io/update-policy: recreateannotation)Another trick can be used if you really need to run job every apply, this can be achieved by adding another annotation with random data, eg.: