--- title: "ADR 0046: bootstrap seeds the trusted hostname and warns instead of failing" --- * Status: accepted * Code: [`pkg/cmd/tknpac/bootstrap/kubestuff.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/cmd/tknpac/bootstrap/kubestuff.go) ## Context After `tkn pac bootstrap github-app` creates the App and its secret, the controller still refuses to send credentials to a GitHub host that is not in the `trusted-provider-hostnames` key of the controller ConfigMap. The hostname bootstrap has is `opts.GithubAPIURL`, typed by the user running the command, not taken from a webhook payload. ## Decision * `trustProviderHostname` parses and canonicalises `opts.GithubAPIURL` with `vcshost`, then adds it to the `settings.TrustedProviderHostnamesKey` entry of the ConfigMap named by `hostpolicy.ControllerConfigMap`. A host already in the list is left alone. * The read, modify and update runs inside `retry.RetryOnConflict`, so a concurrent edit of the ConfigMap does not lose the new entry. * A parse failure or a ConfigMap failure does not fail bootstrap. Both paths call `warnUntrustedHostname`, which prints on `ErrOut` a `kubectl patch configmap` command the user can run, and return nil (`//nolint:nilerr`). * The App and its secret already exist when this runs, so returning an error would leave an install that is half provisioned. The warning makes the skipped security step visible instead of silent. ## Consequences * Seeding from the CLI argument means the allowlist does not depend on a first webhook to learn the host. * When the update fails, the controller refuses the host until the user runs the printed command. Bootstrap's exit code is 0 in that case, so scripts must read the warning on `ErrOut`. * The printed command carries the literal placeholder `HOSTNAME` for the value, not the host that failed. * `kubestuff_test.go` covers the existing-hosts and missing-ConfigMap cases; the code does not show why the warning, rather than a hard failure, was chosen beyond the half-installed state above.