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

Self image lookup: Retry on empty string #1628

Merged
merged 1 commit into from
Aug 4, 2022

Conversation

alvaroaleman
Copy link
Contributor

Occasionally this appears to return am empty string, which then makes
things fail down the line as an empty string is not a valid image. Retry
if that happens.

Output for when this happened:

{"level":"info","ts":"2022-07-28T16:55:17Z","logger":"setup","msg":"using operator image","image":""}

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, use fixes #<issue_number>(, fixes #<issue_number>, ...) format, where issue_number might be a GitHub issue, or a Jira story:
Fixes #

Checklist

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Occasionally this appears to return am empty string, which then makes
things fail down the line as an empty string is not a valid image. Retry
if that happens.

Output for when this happened:

```
{"level":"info","ts":"2022-07-28T16:55:17Z","logger":"setup","msg":"using operator image","image":""}
```
@openshift-ci openshift-ci bot requested review from csrwng and sjenning July 28, 2022 21:31
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 28, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 28, 2022
operatorImage, err = lookupOperatorImage(opts.ControlPlaneOperatorImage)
if err != nil {
return false, err
}
Copy link
Member

Choose a reason for hiding this comment

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

is this because container.Status needs some time to be populated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so. I can not tell exactly why this happens, I just did observe it happen once and it leads to hard to understand issues down the line (Deployment invalid: "" is not a valid image). I thought this would be the best workaround, as it is simple and stupid.

return false, err
}
// Apparently this is occasionally set to an empty string
if hostedClusterConfigOperatorImage == "" {
Copy link
Member

@enxebre enxebre Aug 3, 2022

Choose a reason for hiding this comment

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

Given lookupOperatorImage must find an Image, I think it should error when it doesn't e.g. hostedClusterConfigOperatorImage == "".
i.e modify lookupOperatorImage to check container.ImageID is not empty here and fail otherwise:

				for _, container := range me.Status.ContainerStatuses {
					// TODO: could use downward API for this too, overkill?
					if container.Name == "control-plane-operator" {
						return strings.TrimPrefix(container.ImageID, "docker-pullable://"), nil
					}
				}

Then we poll here and retry if lookupOperatorImage errors.
wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right now we break the retyring if we encounter an error because we assume that an error is fatal and not recoverable. The "We got an empty string back" is likely recoverable, so we retry.

@enxebre
Copy link
Member

enxebre commented Aug 3, 2022

/lgtm
/hold
feel free to cancel if you disagree with #1628 (comment)

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 3, 2022
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 3, 2022
@alvaroaleman
Copy link
Contributor Author

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 3, 2022
@alvaroaleman
Copy link
Contributor Author

/retest-required

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 2 against base HEAD 0b95b70 and 8 for PR HEAD b54e5ff in total

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 1 against base HEAD 0b95b70 and 7 for PR HEAD b54e5ff in total

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 0b95b70 and 6 for PR HEAD b54e5ff in total

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 3, 2022

@alvaroaleman: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/capi-provider-agent-sanity b54e5ff link false /test capi-provider-agent-sanity

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@alvaroaleman
Copy link
Contributor Author

/retest-required

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 2 against base HEAD 8b84dee and 5 for PR HEAD b54e5ff in total

@openshift-ci openshift-ci bot merged commit 260f0fe into openshift:main Aug 4, 2022
@alvaroaleman
Copy link
Contributor Author

/cherrypick release-4.11

@openshift-cherrypick-robot

@alvaroaleman: new pull request created: #1695

In response to this:

/cherrypick release-4.11

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.

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants