Skip to content

Annotate revision with the configuration generation label#572

Merged
grantr merged 1 commit intoknative:masterfrom
johnugeorge:master
Apr 4, 2018
Merged

Annotate revision with the configuration generation label#572
grantr merged 1 commit intoknative:masterfrom
johnugeorge:master

Conversation

@johnugeorge
Copy link
Contributor

@johnugeorge johnugeorge commented Apr 3, 2018

Fixes #458

Adds a revision label with generation of the configuration that created the revision

@google-prow-robot google-prow-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 3, 2018
@evankanderson
Copy link
Member

evankanderson commented Apr 3, 2018 via email

Copy link
Contributor

@grantr grantr left a comment

Choose a reason for hiding this comment

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

Looks good @johnugeorge, thanks! @bobcatfish @evankanderson, should this be exercised in conformance tests since it's part of the spec?

@johnugeorge
Copy link
Contributor Author

/retest

Copy link
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

I'm not sure there's much value in indexing the configurationGeneration, unlike the configuration and route associated with the revision.

rev.ObjectMeta.Labels = make(map[string]string)
}
rev.ObjectMeta.Labels[ela.ConfigurationLabelKey] = config.Name
rev.ObjectMeta.Labels[ela.ConfigurationGenerationLabelKey] = fmt.Sprintf("%v", config.Spec.Generation)
Copy link
Member

Choose a reason for hiding this comment

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

Should this be a label or an annotation?

Labels can be used to select objects and to find collections of objects that satisfy certain conditions. In contrast, annotations are not used to identify and select objects

@johnugeorge
Copy link
Contributor Author

@evankanderson I am not sure if there were some discussions already which resulted in the spec designed in #458

@bobcatfish
Copy link
Contributor

@bobcatfish @evankanderson, should this be exercised in conformance tests since it's part of the spec?

@grantr yeah I think so, and there have been a few other changes recently we should probably include as well. I'll follow up on it.

@evankanderson
Copy link
Member

/lgtm
/approve

@google-prow-robot google-prow-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 3, 2018
@grantr
Copy link
Contributor

grantr commented Apr 3, 2018

/hold

According to #580 this should actually be an annotation instead of a label. When #580 is merged, this PR should be updated to reflect that.

@google-prow-robot google-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 3, 2018
@grantr
Copy link
Contributor

grantr commented Apr 3, 2018

/hold cancel

Oops, ignore my previous comment. I forgot to check whether this PR had been updated already (it has).

@google-prow-robot google-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 3, 2018
}

if rev.Annotations[ela.ConfigurationGenerationAnnotationKey] != fmt.Sprintf("%v", config.Spec.Generation) {
t.Errorf("rev does not have generation label <%s:%s>", ela.ConfigurationGenerationAnnotationKey, config.Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably say "generation annotation" instead of "generation label"

Fixes #458

Adds revision label with generation of the configuration that created
the revision
@google-prow-robot google-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Apr 4, 2018
@grantr
Copy link
Contributor

grantr commented Apr 4, 2018

/lgtm

@google-prow-robot google-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 4, 2018
@google-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: evankanderson, grantr, johnugeorge

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@grantr grantr merged commit 4c483da into knative:master Apr 4, 2018
@bobcatfish
Copy link
Contributor

@grantr I created #593 to get this covered in the conformance tests.

google-prow-robot pushed a commit that referenced this pull request Apr 6, 2018
In #572 Revision was made to be
updated with the generation of the Configuration that triggered its
creation. This commit updates the conformance tests to assert that it is
being populated correctly.

Also fixed a bug: after updating the Configuration with a new image, we
were (I mean *I was*, I created this bug XD) waiting for the previous
Revision to be ready (which of course it was right away), not the new
Revision. This means that the health check we had added MIGHT have
actually been working (i.e. saving us from 404s and 503s).

Snuck in a rename of `routeIsReady` to `isRouteReady` to be consistent
with other functions in the file.

This partially addresses #593.
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. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants