-
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
More robust WaitForServiceLatestRevision function for rolling upgrades #5956
Conversation
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.
@mgencur: 0 warnings.
In response to this:
Fixes the following type of issue when running rolling-upgrade tests, this issue happens randomly:
service_postupgrade_test.go:35: Since the Service was updated a new Revision will be created and the Service will be updated\n service_postupgrade_test.go:35: Service pizzaplanet-upgrade-service was not updated with the Revision for image pizzaplanetv2: service \"pizzaplanet-upgrade-service\" is not in desired state, got: &{TypeMeta:{Kind: APIVersion:} ObjectMeta:{Name:pizzaplanet-upgrade-service GenerateName: Namespace:serving-tests SelfLink:/apis/serving.knative.dev/v1alpha1/namespaces/serving-tests/services/pizzaplanet-upgrade-service UID:e0b1a3ff-007a-11ea-bfa4-02c1cbe14dfb ResourceVersion:27702 Generation:3 CreationTimestamp:2019-11-06 04:50:34 -0500 EST DeletionTimestamp:<nil> DeletionGracePeriodSeconds:<nil> Labels:map[] Annotations:map[serving.knative.dev/creator:kube:admin serving.knative.dev/forceUpgrade:true serving.knative.dev/lastModifier:kube:admin] OwnerReferences:[] Initializers:nil Finalizers:[] ClusterName:} Spec:{DeprecatedGeneration:0 DeprecatedRunLatest:<nil> DeprecatedPinned:<nil> DeprecatedManual:<nil> DeprecatedRelease:<nil> ConfigurationSpec:{DeprecatedGeneration:0 DeprecatedBuild:nil DeprecatedRevisionTemplate:<nil> Template:&ObjectMeta{Name:,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,CreationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string{autoscaling.knative.dev/minScale: 1,},OwnerReferences:[],Finalizers:[],ClusterName:,Initializers:nil,}} RouteSpec:{DeprecatedGeneration:0 Traffic:[{DeprecatedName: TrafficTarget:{Tag: RevisionName: ConfigurationName: LatestRevision:0xc0007a1048 Percent:0xc0007a1070 URL:}}]}} Status:{Status:{ObservedGeneration:3 Conditions:[{Type:ConfigurationsReady Status:True Severity: LastTransitionTime:{Inner:2019-11-06 04:53:45 -0500 EST} Reason: Message:} {Type:Ready Status:True Severity: LastTransitionTime:{Inner:2019-11-06 04:53:46 -0500 EST} Reason: Message:} {Type:RoutesReady Status:True Severity: LastTransitionTime:{Inner:2019-11-06 04:53:46 -0500 EST} Reason: Message:}]} RouteStatusFields:{URL:http://pizzaplanet-upgrade-service.serving-tests.apps.ocf-rollup-19-ocf-ocp-4.0-aws-rolling-upgrade.openshift-aws.rhocf-dev.com DeprecatedDomain: DeprecatedDomainInternal: Address:0xc000382760 Traffic:[{DeprecatedName: TrafficTarget:{Tag: RevisionName:pizzaplanet-upgrade-service-lqckw ConfigurationName: LatestRevision:0xc0007a109b Percent:0xc0007a10a0 URL:}}]} ConfigurationStatusFields:{LatestReadyRevisionName:pizzaplanet-upgrade-service-lqckw LatestCreatedRevisionName:pizzaplanet-upgrade-service-lqckw}}}: timed out waiting for the condition
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
7c5dfc4
to
e853147
Compare
@@ -75,6 +75,14 @@ func IsRevisionReady(r *v1.Revision) (bool, error) { | |||
return r.Generation == r.Status.ObservedGeneration && r.Status.IsReady(), nil | |||
} | |||
|
|||
// IsRevisionPinned will check if the revision is pinned to a route. | |||
func IsRevisionPinned(r *v1.Revision) (bool, error) { |
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.
It seems that if you just return false that will percolate nicely without error? (return CheckRevisionState)
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.
Yeah. That's right. I just wanted to align the function signature with the other functions of this type so that they can be used similarly. But I don't have a problem changing that if required.
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.
Signature is fine. But returning false
rather than error would achieve same benefit, no?
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.
Yes. I meant signature including return parameters/type. Returning false would be simpler in this case indeed.
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.
Ehmm. Actually, the CheckRevisionState function expects the signature I have now.
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.
Yes, don't change the signature, change the logic :)
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.
Oooh, ok. Do you mean something like this?
// IsRevisionPinned will check if the revision is pinned to a route.
func IsRevisionPinned(r *v1beta1.Revision) (bool, error) {
_, pinned := r.Annotations[serving.RevisionLastPinnedAnnotationKey]
return pinned, nil
}
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.
Yep.
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.
And in the call site just
return X(...)
, rather than if _, err := X(...); err != nil...
.
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.
Pushed changes. Unfortunately, the last suggestion from you is not possible because I'm not directly calling IsRevisionPinned but I'm passing it to CheckRevisionState which, itself returns only error
. But the enclosing function expects again (bool, error). So there's double conversion of return types throughout the method calls.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mgencur, 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 |
The following jobs failed:
Failed non-flaky tests preventing automatic retry of pull-knative-serving-integration-tests:
|
b0e7ea7
to
68707a1
Compare
@vagababov thanks for the review, I had to do another fix after rebase. Please review. |
/lgtm |
Fixes the following type of issue when running rolling-upgrade tests, this issue happens randomly: