Repository navigation
Install a bundle unattended when no tunnel credential exists - #92
Draft
josephschorr wants to merge 2 commits into
Draft
josephschorr wants to merge 2 commits into
josephschorr wants to merge 2 commits into
Conversation
StdinIsInteractive tested for a character device, and /dev/null is one, so `oap ... </dev/null` was read as somebody at the keyboard while a piped stdin was not. Ask term.IsTerminal instead, as the rest of the CLI already does.
An unattended `oap agent install` of a bundle declaring a webhook channel, on a cluster that opens its tunnel on demand, created webd's PublicEndpoint with no credential, waited out the three-minute bound for a tunnel that could not open, and failed before applying anything. The address it waited for is read only by a channel's setup flow, which an unattended run never enters: it reports those channels as skipped and exits 0. Plan no endpoint when there is no credential and nobody to ask for one. The bundle is installed, and each skipped webhook channel's summary entry says the tunnel is missing and what supplies the credential. A run that has a credential, or an operator to ask, behaves as before.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
oap agent install <bundle>could not complete on OAP Desktop for a bundlewhose manifest declares a webhook channel (
requires.channelswith a githubchannel) when run with nobody at the terminal and no ngrok credential on the
machine. The installer created the
webdPublicEndpoint, printed "waiting upto 3m0s for PublicEndpoint webd to publish a public URL", then failed with
"the public endpoint "webd" did not publish a URL within 3m0s", and nothing
from the bundle was installed. The only way through was to copy the bundle and
set
requires: {}.The wait could not succeed: an endpoint with no credential stays at
Pending/AuthTokenSecretMissing by design. It was also for nothing: the public
URL is read only by a channel's setup flow, and an unattended install never
enters one. It reports each declared channel as skipped and exits 0.
Separately,
oap ... </dev/nullwas treated as interactive while a pipedstdin was not, because the check tested for a character device and the null
device is one.
Summary of changes
publicendpoint.PrepareWebdOnDemandplans no endpoint when there is nocredential (Secret or
NGROK_AUTHTOKEN) and nobody to ask. The plan recordsthat and exposes
MissingCredential(), the sentence saying what is missingand what supplies it.
oap agent installcarries that sentence into the channel summary as a noteunder each skipped webhook channel, next to the existing
oap channel createfinishing command. Exit code stays 0, as for anyskipped channel.
apcmd.StdinIsInteractiveusesterm.IsTerminal. It has about ten callsites (agent install, chat, imagemode, the cloud reporters), so
</dev/nullbecomes non-interactive for all of them.
oap agent install --help, the generated CLI reference, and the reviewbotexample README describe the unattended behaviour.
Unchanged: any run with a credential (the tunnel is opened and waited for,
and a tunnel that never comes up still fails with the existing message), any
run with an operator at the terminal, and clusters whose webd already has a
public address.
Worth a reviewer's attention: the old code created the pending endpoint on an
unattended run on purpose, so that a missing credential was reported by the
bounded wait and not silently treated as a decline. This change keeps the
report (the note in the summary) but drops the wait and the failure.
Alternatives considered
defers channels on an unattended run; a flag would be a second spelling of
the same thing and would not have helped anyone who did not know to pass it.
the bundle still would not install.
rollback rules; the re-run with a token already creates it.
setup flow does need the address.
Provenance
Ship gate
mage test:unitmage test:integrationmage test:e2eResults:
Not yet run. What was run locally:
go build ./...,go veton the threetouched packages, and
go test -count=1 ./cmd/...(all packages ok). The newgraph test was confirmed to fail with the original three-minute timeout error
when the old planning behaviour is restored. No cluster was used.
Regeneration
+kubebuilder:rbacmarker or a CRD-shaping field: n/aconfig/**: n/amage docs:cli(only
oap-agent.mdxkept; the generator also renumberedorder:infive unrelated pages, left out of this PR)
mage fmt:alluntilmage fmt:checkis clean:mage fmt:checknot run; oxfmt
--checkpasses on the one Markdown file editedCoverage
or it does not add user-visible behavior. No bundle: the change is
in the CLI install path, covered by unit tests in
cmd/oap/internal/agentcmdandcmd/oap/internal/publicendpoint.model.
Before requesting review
the install fix. They can land independently; they are together because
both came from the same failed install.