forked from tektoncd/results
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tkn-results: Add service account based auth.
The Result API accepts bearer token auth, which is then checked against the cluster. For human accounts, this means accepting a token that likely has much higher priviledge than the Result API needs. As an alternative, this adds support for fetching a service account bearer token as a delegate for Result operations - the service account is expected to have much finer permissions, reducing the scope / blast radius of the credential. This change: - Adds a service_account config field - Refactors client creation to allow for fake dependencies (i.e. k8s client) to be injected for tests. - Adds tests for token generation, SSL cert reading.
- Loading branch information
1 parent
7d71633
commit ff00628
Showing
10 changed files
with
1,014 additions
and
89 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Environment Variables: | ||
TKN_RESULTS_SSL_ROOTS_FILE_PATH: Path to local SSL cert to use. | ||
TKN_RESULTS_SSL_SERVER_NAME_OVERRIDE: SSL server name override (useful if using with a proxy such as kubectl port-forward). | ||
|
||
Config: | ||
A config file may be stored in `~/.config/tkn/results.yaml` to configure the CLI client. | ||
|
||
Fields: | ||
- address: Results API Server address | ||
- service_account: When specified, the CLI will first fetch a bearer token | ||
for the specified ServiceAccount and attach that to Result API requests. | ||
- namespace: ServiceAccount namespace | ||
- name: ServiceAccount name | ||
- token: Bearer token to use for API requests. Takes priority over service_account. | ||
- ssl: SSL connection options | ||
- roots_file_path: Path to a certificate to include in the cert pool. Useful for adding allowed self-signed certs. | ||
- server_name_override: For testing only. Sets the grpc.ssl_target_name_override value for requests. | ||
|
||
Example: | ||
|
||
``` | ||
address: results.dogfooding.tekton.dev:443 | ||
token: abcd1234 | ||
ssl: | ||
roots_file_path: path/to/file | ||
server_name_override: example.com | ||
service_account: | ||
namespace: default | ||
name: result-reader | ||
``` | ||
|
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.