Skip to content

Commit

Permalink
Fix the errors during image resolutions. (#10071)
Browse files Browse the repository at this point in the history
Those contain URLs and they contain `%` sequences which screw up
errors and we get logs like

```
 Reason=ContainerMissing Message="Unable to fetch image
 \"gcr.io/dm-vagababov/helloworld:latest\": failed to resolve image to
 digest: GET
 https://gcr.io/v2/token?scope=repository%!!(MISSING)A(MISSING)dm-vagababov%!!(MISSING)F(MISSING)helloworld%!!(MISSING)A(MISSING)pull&service=gcr.io:
 unsupported status code 429; body: Quota Exceeded."
```

Not cool.

Change-Id: I616c1388c6292538e4dc93ca91c9bb451a32be42
  • Loading branch information
vagababov authored Nov 10, 2020
1 parent f4c7907 commit db4879e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions pkg/apis/serving/v1/revision_lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,16 @@ func (rs *RevisionStatus) MarkContainerHealthyTrue() {

// MarkContainerHealthyFalse marks ContainerHealthy status on revision as False
func (rs *RevisionStatus) MarkContainerHealthyFalse(reason, message string) {
revisionCondSet.Manage(rs).MarkFalse(RevisionConditionContainerHealthy, reason, message)
// We escape here, because errors sometimes contain `%` and that makes the error message
// quite poor.
revisionCondSet.Manage(rs).MarkFalse(RevisionConditionContainerHealthy, reason, "%s", message)
}

// MarkContainerHealthyUnknown marks ContainerHealthy status on revision as Unknown
func (rs *RevisionStatus) MarkContainerHealthyUnknown(reason, message string) {
revisionCondSet.Manage(rs).MarkUnknown(RevisionConditionContainerHealthy, reason, message)
// We escape here, because errors sometimes contain `%` and that makes the error message
// quite poor.
revisionCondSet.Manage(rs).MarkUnknown(RevisionConditionContainerHealthy, reason, "%s", message)
}

// MarkResourcesAvailableTrue marks ResourcesAvailable status on revision as True
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/serving/v1/revision_lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func TestTypicalFlowWithContainerMissing(t *testing.T) {
apistest.CheckConditionOngoing(r, RevisionConditionContainerHealthy, t)
apistest.CheckConditionOngoing(r, RevisionConditionReady, t)

const want = "something about the container being not found"
const want = "something about the container being not found %s"
r.MarkContainerHealthyFalse(ReasonContainerMissing, want)
apistest.CheckConditionOngoing(r, RevisionConditionResourcesAvailable, t)
apistest.CheckConditionFailed(r, RevisionConditionContainerHealthy, t)
Expand Down

0 comments on commit db4879e

Please sign in to comment.