Revision return replicas#11038
Conversation
Codecov Report
@@ Coverage Diff @@
## main #11038 +/- ##
==========================================
- Coverage 87.74% 87.72% -0.02%
==========================================
Files 190 190
Lines 9162 9164 +2
==========================================
Hits 8039 8039
- Misses 870 871 +1
- Partials 253 254 +1
Continue to review full report at Codecov.
|
fc4f41b to
0a1e6af
Compare
|
/retest |
| // Reflect the PA status in our own. | ||
| cond := ps.GetCondition(autoscalingv1alpha1.PodAutoscalerConditionReady) | ||
| if ps.ActualScale != nil { | ||
| rs.ActualReplicas = *ps.ActualScale |
There was a problem hiding this comment.
Could we use the GetActualScale helper here and avoid the nil check?
| if ps.ActualScale != nil { | ||
| rs.ActualReplicas = *ps.ActualScale | ||
| } else { | ||
| rs.ActualReplicas = 0 |
There was a problem hiding this comment.
I think this else may be redundant since ActualReplicas defaults to 0 anyway. Might be clearer to drop it.
There was a problem hiding this comment.
I think it's fine to guard against the PodAutoscalerStatus and leave this else clause
ie. if in the future PodAutoscalerStatus scale could cycle through the values -1 => some number > 0 => -1 then we'd be fine.
Or alternatively it might be better to have
rs.ActualReplicas := math.Max(ps.GetActualScale(), 0)There was a problem hiding this comment.
Doesn't work, since Math.Max works with float64 only (thanks golang). But we can write our own max (we have a few in the code already).
| } | ||
|
|
||
| if ps.DesiredScale != nil && *ps.DesiredScale != -1 { | ||
| rs.DesiredReplicas = *ps.DesiredScale |
There was a problem hiding this comment.
can use GetDesiredScale() helper here and avoid nil check
| ps: autoscalingv1alpha1.PodAutoscalerStatus{ | ||
| DesiredScale: ptr.Int32(-1), | ||
| }, | ||
| // actualReplicas: 0, desiredReplicas: 0 |
There was a problem hiding this comment.
might as well just set the want fields I think (even if theyre technically redundant) if we're going to have the comment here anyway
| // +optional | ||
| ContainerStatuses []ContainerStatus `json:"containerStatuses,omitempty"` | ||
|
|
||
| // Reflects the PodAutoScalerStatus.ActualScale value in RevisionStatus. |
There was a problem hiding this comment.
| // Reflects the PodAutoScalerStatus.ActualScale value in RevisionStatus. | |
| // ActualReplicas reflects the PodAutoScalerStatus.ActualScale value in RevisionStatus. |
|
|
||
| // Reflects the PodAutoScalerStatus.ActualScale value in RevisionStatus. | ||
| ActualReplicas int32 `json:"actualReplicas,omitempty"` | ||
| // Reflects the PodAutoScalerStatus.DesiredScale value in RevisionStatus. |
There was a problem hiding this comment.
| // Reflects the PodAutoScalerStatus.DesiredScale value in RevisionStatus. | |
| // DesiredReplicas reflects the PodAutoScalerStatus.DesiredScale value in RevisionStatus. |
test/e2e/helloworld_test.go
Outdated
| } else { | ||
| t.Fatalf("Failed to get Service name from Revision label") | ||
| } | ||
| if val := revision.Status.ActualReplicas; val != 1 { |
There was a problem hiding this comment.
Im wondering why we added this check to this test in particular (seems not particularly related?).
test/e2e/minscale_readiness_test.go
Outdated
| t.Fatalf("The revision %q scaled to %d > %d after not being routable anymore: %v", newRevName, lr, minScale, err) | ||
| } | ||
|
|
||
| revision, err = clients.ServingClient.Revisions.Get(context.Background(), newRevName, metav1.GetOptions{}) |
There was a problem hiding this comment.
Could this be flaky if sometimes the revision hasnt quite finished reconciling the PA status? (ie. since I think we're not waiting for that reconcile to complete in waitForDesiredScale might it be possible for waitForDesiredScale to return before ActualScale has bubbled up?)
0a1e6af to
a09ae43
Compare
test/e2e/autoscale.go
Outdated
| @@ -291,22 +290,12 @@ func assertScaleDown(ctx *TestContext) { | |||
| func numberOfReadyPods(ctx *TestContext) (float64, error) { | |||
| // SKS name matches that of revision. | |||
There was a problem hiding this comment.
| // SKS name matches that of revision. |
vagababov
left a comment
There was a problem hiding this comment.
Do you want to change revision.yaml CRD as well to report the values on k get revision?
vagababov
left a comment
There was a problem hiding this comment.
stylistic issues only.
| wantActualReplicas: -1, | ||
| wantDesiredReplicas: -1, |
There was a problem hiding this comment.
Do we want these to surface -1 as long as the pointers are nil? Have we considered making the respective Status on the Revision pointers to ints as well?
|
/assign @dprotaso For an API review. |
|
/retest |
|
So the upgrade tests are failing due to downgrading detecting unrecognizable fields
We should discuss the options - I've made an issue here: #11065 |
|
/hold API change is pulled out here: #11068 We'll want to land that and wait till after the release before continuing this PR |
de9916b to
b2493b8
Compare
|
/test pull-knative-serving-istio-stable-no-mesh |
|
/retest |
d2d28fa to
1aa690f
Compare
1aa690f to
7abff9f
Compare
|
/retest |
|
/retest |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dprotaso The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/test pull-knative-serving-istio-stable-no-mesh |
|
/hold cancel |
Fixes #10750
Proposed Changes