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

More robust WaitForServiceLatestRevision function for rolling upgrades #5956

Merged
merged 3 commits into from
Nov 9, 2019

Conversation

mgencur
Copy link
Contributor

@mgencur mgencur commented Nov 6, 2019

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

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Nov 6, 2019
@knative-prow-robot knative-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. area/test-and-release It flags unit/e2e/conformance/perf test issues for product features labels Nov 6, 2019
Copy link
Contributor

@knative-prow-robot knative-prow-robot left a 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.

@@ -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) {
Copy link
Contributor

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)

Copy link
Contributor Author

@mgencur mgencur Nov 7, 2019

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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 :)

Copy link
Contributor Author

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
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep.

Copy link
Contributor

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....

Copy link
Contributor Author

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.

@vagababov
Copy link
Contributor

/lgtm
/approve
I am annoyed that CheckRevisionState does not follow (bool, error) signature but I guess it's a different fix

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 7, 2019
@knative-prow-robot
Copy link
Contributor

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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 7, 2019
@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/scale.[build failed]
test/conformance/api/v1.[build failed]
test/conformance/api/v1alpha1.[build failed]
test/conformance/api/v1beta1.[build failed]
test/conformance/runtime.[build failed]
test/e2e.[build failed]
test/e2e/istio.[build failed]

@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Nov 7, 2019
@mgencur
Copy link
Contributor Author

mgencur commented Nov 7, 2019

@vagababov thanks for the review, I had to do another fix after rebase. Please review.

@dgerd
Copy link

dgerd commented Nov 8, 2019

/lgtm

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/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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants