-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new KPA status for dependencies #8809
Add new KPA status for dependencies #8809
Conversation
This initial version only deals with SKS and sets deps not ready if SKS is not ready and ready otherwise. Lots of test churn... :-)
Alright, should be all golden to go :) |
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.
Updated. Thanks.
The following jobs failed:
Failed non-flaky tests preventing automatic retry of pull-knative-serving-integration-tests:
|
/retest |
@@ -185,6 +186,18 @@ func (pas *PodAutoscalerStatus) MarkScaleTargetInitialized() { | |||
podCondSet.Manage(pas).MarkTrue(PodAutoscalerConditionScaleTargetInitialized) | |||
} | |||
|
|||
// MarkDependenciesReadymarks the PA condition denoting that all its |
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.
// MarkDependenciesReadymarks the PA condition denoting that all its | |
// MarkDependenciesReady marks the PA condition denoting that all its |
|
||
// MarkDependenciesNotReady marks the PA condation that at least one of the | ||
// dependendcies is not ready. | ||
func (pas *PodAutoscalerStatus) MarkDependenciesNotReady(reason, message string) { |
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.
I expected NotReady
to be False
, but perhaps it is sort of ambiguous. 🤷
@@ -117,6 +117,9 @@ const ( | |||
PodAutoscalerConditionScaleTargetInitialized apis.ConditionType = "ScaleTargetInitialized" | |||
// PodAutoscalerConditionActive is set when the PodAutoscaler's ScaleTargetRef is receiving traffic. | |||
PodAutoscalerConditionActive apis.ConditionType = "Active" | |||
// PodAutoscalerCondtionDependenciesReady is set when all the dependencies are ready and | |||
// the revision is ready to scale. | |||
PodAutoscalerConditionDependenciesReady = "DependeciesReady" |
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.
PodAutoscalerConditionDependenciesReady = "DependeciesReady" | |
PodAutoscalerConditionDependenciesReady = "DependenciesReady" |
// Before we can reconcile decider and get real number of activators | ||
// we start with default of 2. | ||
if _, err = c.ReconcileSKS(ctx, pa, nv1alpha1.SKSOperationModeServe, 0 /*numActivators == all*/); err != nil { | ||
return fmt.Errorf("error reconciling SKS: %w", err) | ||
} | ||
pa.Status.MarkDependenciesNotReady("DependenciesNotReady", "SKS is provisioning") |
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.
"DependenciesNotReady" is redundant with the new Type. I'd use this to identify the dependency itself, e.g. SKSNotReady or something
ready = 0 | ||
pa.Status.MarkDependenciesNotReady("DependenciesNotReady", "SKS is provisioning") |
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.
same
pa.Status.MarkDependenciesNotReady("DependenciesNotReady", "SKS is provisioning") | ||
} else { | ||
logger.Debug("SKS is ready, marking dependencies ready") | ||
pa.Status.MarkDependenciesReady() |
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.
Thinking about this at a meta level for a moment... Are you sure you want a single condition for all dependencies?
In general, I'd probably advocate for a condition per dependency.
I comment on that here because one of the problems you have with an N-ary condition is: Who should mark it ready?
The logic we have for managing the actual "Ready" condition sort of solves this already, assuming you have a sub-condition per dependency.
Sure, rewrote with SKS specific condition. |
func (pas *PodAutoscalerStatus) MarkSKSNotReady() { | ||
podCondSet.Manage(pas).MarkUnknown(PodAutoscalerSKSReady, "SKSNotReady", "SKS is not ready yet") |
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.
SKSNotReady is redundant with the Type itself. Generally this context is passed through from the caller.
// Before we can reconcile decider and get real number of activators | ||
// we start with default of 2. | ||
if _, err = c.ReconcileSKS(ctx, pa, nv1alpha1.SKSOperationModeServe, 0 /*numActivators == all*/); err != nil { | ||
return fmt.Errorf("error reconciling SKS: %w", err) | ||
} | ||
pa.Status.MarkSKSNotReady() |
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.
pa.Status.MarkSKSNotReady() | |
pa.Status.MarkSKSNotReady("NoPrivateService", "blah") |
ready = 0 | ||
pa.Status.MarkSKSNotReady() |
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.
You could bubble up SKS's Ready condition's Reason/Message here.
used the message, reason just kept generic |
The following is the coverage report on the affected files.
|
ready = 0 | ||
pa.Status.MarkSKSNotReady() | ||
pa.Status.MarkSKSNotReady(sks.Status.GetCondition(nv1alpha1.ServerlessServiceConditionReady).Message) |
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.
This can return nil, so I'd guess this will make our controllers crash loop 😬
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.
This one cannot: we get here only if PrivateServiceName is set, which means SKS reconciled this at least once, which means InitializeConditions has been invoked and sks updated the status.
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.
i see the sks.Status.PrivateServiceName
guard, which ensures things have been initialized to reach this point.
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.
/lgtm
ready = 0 | ||
pa.Status.MarkSKSNotReady() | ||
pa.Status.MarkSKSNotReady(sks.Status.GetCondition(nv1alpha1.ServerlessServiceConditionReady).Message) |
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.
i see the sks.Status.PrivateServiceName
guard, which ensures things have been initialized to reach this point.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mattmoor, vagababov The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This initial version only deals with SKS and sets deps
not ready if SKS is not ready and ready otherwise.
I did not remove yet the defaulting to 0 of
got
, since it would require too many test changes, which I did not want to put in this PR.This is for #8792.
/assign @yanweiguo mattmoor @markusthoemmes @julz