Skip to content
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

Merged
merged 9 commits into from
Jul 26, 2020

Conversation

vagababov
Copy link
Contributor

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

This initial version only deals with SKS and sets deps
not ready if SKS is not ready and ready otherwise.

Lots of test churn... :-)
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jul 25, 2020
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 25, 2020
@knative-prow-robot knative-prow-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. area/API API objects and controllers area/autoscale labels Jul 25, 2020
@knative-prow-robot knative-prow-robot added the area/test-and-release It flags unit/e2e/conformance/perf test issues for product features label Jul 25, 2020
@vagababov
Copy link
Contributor Author

Alright, should be all golden to go :)

Copy link
Contributor Author

@vagababov vagababov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Thanks.

@knative-test-reporter-robot

The following jobs failed:

Test name Triggers Retries
pull-knative-serving-integration-tests 0/3

Failed non-flaky tests preventing automatic retry of pull-knative-serving-integration-tests:

test/e2e.TestMultipleNamespace
test/e2e.TestRollbackBYOName
test/e2e.TestCallToPublicService

@vagababov
Copy link
Contributor Author

/retest

@@ -185,6 +186,18 @@ func (pas *PodAutoscalerStatus) MarkScaleTargetInitialized() {
podCondSet.Manage(pas).MarkTrue(PodAutoscalerConditionScaleTargetInitialized)
}

// MarkDependenciesReadymarks the PA condition denoting that all its
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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) {
Copy link
Member

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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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")
Copy link
Member

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")
Copy link
Member

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()
Copy link
Member

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.

@vagababov
Copy link
Contributor Author

Sure, rewrote with SKS specific condition.

Comment on lines 195 to 196
func (pas *PodAutoscalerStatus) MarkSKSNotReady() {
podCondSet.Manage(pas).MarkUnknown(PodAutoscalerSKSReady, "SKSNotReady", "SKS is not ready yet")
Copy link
Member

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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pa.Status.MarkSKSNotReady()
pa.Status.MarkSKSNotReady("NoPrivateService", "blah")

ready = 0
pa.Status.MarkSKSNotReady()
Copy link
Member

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.

@vagababov vagababov changed the title Add new Kpa status for dependencies Add new KPA status for dependencies Jul 26, 2020
@vagababov
Copy link
Contributor Author

used the message, reason just kept generic

@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-serving-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/autoscaling/kpa/kpa.go 94.5% 94.8% 0.3

ready = 0
pa.Status.MarkSKSNotReady()
pa.Status.MarkSKSNotReady(sks.Status.GetCondition(nv1alpha1.ServerlessServiceConditionReady).Message)
Copy link
Member

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 😬

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

@mattmoor mattmoor left a 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)
Copy link
Member

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.

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 26, 2020
@knative-prow-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot merged commit 1642dd1 into knative:master Jul 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/API API objects and controllers area/autoscale area/test-and-release It flags unit/e2e/conformance/perf test issues for product features cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants