Repository navigation
Conversation
| readonly -f install_registry | ||
|
|
||
| function wait_for_registry() { | ||
| function wait_generation() { |
There was a problem hiding this comment.
wait_for_synced_registry is a more appropriate name since you don't wait only for generation
There was a problem hiding this comment.
Maybe I should rename it to is_registry_ready? Because this function doesn't wait but returns the status of deployment.
515b22b to
23a014d
Compare
| local generation="$(oc get dc/docker-registry -o 'jsonpath={.metadata.generation}')" | ||
| local onereplicajs='{.status.observedGeneration},{.status.replicas},{.status.updatedReplicas},{.status.availableReplicas}' | ||
| wait_for_command "oc get dc/docker-registry -o 'jsonpath=${onereplicajs}' --config='${ADMIN_KUBECONFIG}' | grep '^${generation},1,1,1$'" "$((5*TIME_MIN))" | ||
| oc get dc/docker-registry -o "jsonpath=${onereplicajs}" --config="${ADMIN_KUBECONFIG}" | fgrep -x "${generation},1,1,1" |
There was a problem hiding this comment.
This function shouldn't probably return anything. Or make it return just the generation. Returning 2,1,1,1 as a value indicating success doesn't make any sense.
There was a problem hiding this comment.
Good catch! I added -q parameter to suppress grep's output.
| readonly -f install_registry | ||
|
|
||
| function wait_for_registry() { | ||
| function is_registry_ready() { |
There was a problem hiding this comment.
This probably won't be used on its own apart from wait_for_registry function. Maybe we could make it "private" by adding _ or __ prefix.
There was a problem hiding this comment.
When I'm looking in this file I don't see any function that uses such naming convention.
There was a problem hiding this comment.
NACK to prefixing it with anything. The correct format in correct files (I'm working on it ...) is os::<whatever>::internal::<funcname>
There was a problem hiding this comment.
@stevekuznetsov Where is documentation for this? Why even this file doesn't respect this rules? I see that this file has 28 functions without namespace and only 10 that having it.
…ith timeout. It was possible that between command where we're getting value of the metadata.generation field and the command where we're checking the current state, value has been changed.
23a014d to
4c421a9
Compare
| readonly -f install_registry | ||
|
|
||
| function wait_for_registry() { | ||
| function is_registry_ready() { |
There was a problem hiding this comment.
NACK to prefixing it with anything. The correct format in correct files (I'm working on it ...) is os::<whatever>::internal::<funcname>
| local generation="$(oc get dc/docker-registry -o 'jsonpath={.metadata.generation}')" | ||
| local onereplicajs='{.status.observedGeneration},{.status.replicas},{.status.updatedReplicas},{.status.availableReplicas}' | ||
| wait_for_command "oc get dc/docker-registry -o 'jsonpath=${onereplicajs}' --config='${ADMIN_KUBECONFIG}' | grep '^${generation},1,1,1$'" "$((5*TIME_MIN))" | ||
| oc get dc/docker-registry -o "jsonpath=${onereplicajs}" --config="${ADMIN_KUBECONFIG}" | fgrep -qx "${generation},1,1,1" |
There was a problem hiding this comment.
Why change the grep invocation?
There was a problem hiding this comment.
I also feel like there's no good reason to conflate these four tests with each other -- we want to test:
observedGeneration == dc.generationreplicas == 1updatedReplicas == 1availableReplicas == 1
We aren't hurting for API calls, right? I would pefer to have four tests instead of one that sticks commas in there. I won't block this PR on it, though.
There was a problem hiding this comment.
Why change the grep invocation?
@stevekuznetsov I have an opposite question: why I shouldn't?
There was a problem hiding this comment.
I also feel like there's no good reason to conflate these four tests with each other
we want to make sure the object has a coherent view of all four of those things at a single point in time. four consecutive checks wouldn't do that.
There was a problem hiding this comment.
@stevekuznetsov I have an opposite question: why I shouldn't?
- change for the sake of change is not a good argument
fgrepis not preferred togrep -F
Justify your change by what it adds?
|
We specifically locked the expected generation at the beginning of the function, because nothing should be modifying the registry dc spec asynchronously while we're waiting here. If that is happening, we need to find out what is doing that and fix it. |
While we're at it let's leave a comment to explain this subtle but important point about this function ... |
@liggitt How to debug this and find out who is changing the registry dc? |
|
@liggitt I suspect that it happens because |
that's concerning, and seems like a more fundamental issue we need to track down and fix nothing should be bumping the generation of the docker-registry dc after we call this helper function |
|
There are two places in the deployment api that bump generation: the normal update strategy and the strategy used by /instantiate. The normal create hook sets generation to 1 and the update hook will increment on a spec or latestVersion update. It seems though that prior to /instantiate we would end up with a deployment config with latestVersion=1 and generation=1 though generation is supposed to be 2: After we got instantiate, the time for incrementing a version has become higher because we delegate to the API server via instantiate: We have an extended test for generation here. |
no, we use this function in other places to wait for the registry to deploy an updated version based on changes made to the deployment config. |
|
Can we use oc rollout status for this? |
|
@mmilata good idea, we should use |
|
Something like this might work: |
|
With Slava's permission I've opened PR for using oc rollout status: #11487. |
|
Closing this in favor of #11487 |
|
You don't need a wait with On Fri, Oct 21, 2016 at 3:52 PM, Martin Milata [email protected]
|
It was possible that between command where we're getting value of the
metadata.generationfield and the command where we're checking the current state, value has been changed.Thanks to @legionus for the code and @Kargakis for confirming that this is a race.
PTAL @bparees
@miminar JFYI
Fixes #11406