-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add spice secrets docs * Update file store description * rename secret prefix * remove schema * update secrets docs
- Loading branch information
Showing
3 changed files
with
117 additions
and
0 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,98 @@ | ||
--- | ||
type: docs | ||
title: "Spice Secrets" | ||
linkTitle: "Spice Secrets" | ||
description: '' | ||
weight: 70 | ||
--- | ||
|
||
## Secret | ||
|
||
A Secret is an object used to store sensitive data, like a passwords, a tokens, or keys. | ||
|
||
## Secret Stores | ||
|
||
The secret store is a location where the `secret` objects are stored. | ||
|
||
Spice.ai supports four types of secret stores: `file`, `env`, `kubernetes` and `keyring`. The type of secret store is specified in the `store` field of the `secrets` section in the Spicepod manifest. | ||
|
||
### File Secret Store | ||
|
||
Default secret store uses a file located at `~/.spice/auth`. | ||
The Spice.ai CLI offers the `spice login` command to streamline credential storage. When logging into Spice.ai, it automatically saves credentials in the secret store file under `spiceai` secret. | ||
|
||
### Environment Secret Store | ||
|
||
The `env` store type allows Spice.ai to read secrets from environment variables. The environment variables should be formatted like `SPICE_SECRET_<secret-name>_<secret-value-key>`. | ||
|
||
All variables with the same prefix `SPICE_SECRET_<secret-name>` are combined into a single secret. This allows you to group related secret values under a single secret name. | ||
|
||
**Example** | ||
|
||
```yaml | ||
secrets: | ||
store: env | ||
``` | ||
Setting `spiceai` secret with spice.ai API key in `key` secret value: | ||
|
||
```bash | ||
SPICE_SECRET_SPICEAI_KEY="343533|**************" \ | ||
spice run | ||
``` | ||
|
||
### Kubernetes Secret Store | ||
|
||
The `kubernetes` store type allows Spice.ai to read Kubernetes secrets. | ||
|
||
```yaml | ||
secrets: | ||
store: kubernetes | ||
``` | ||
|
||
Note: This method requires the Kubernetes service account, which is running the Spice.ai pod, to have extended roles for secrets API access. Make sure to configure this service account with the necessary permissions to read secrets from the Kubernetes API. | ||
|
||
Example of Kubernetes role configuration for a custom service account: | ||
|
||
```yaml | ||
kind: Role | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: spiced-account-role | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["secrets"] | ||
verbs: ["get"] | ||
``` | ||
|
||
### Keyring Secret Store | ||
|
||
The `keyring` store allows Spice.ai to access secrets from the secure store of the host operating system: | ||
|
||
- On Linux, it uses the secret-service and kernel keyutils. | ||
- On macOS, it uses the keychain. | ||
- On Windows, it uses the credential manager. | ||
|
||
The keyring store will read entries name to be formatted as `spice_secret_<secret-name>`, and entry account or user should be set to `spiced`. | ||
|
||
Note: secret values required to be stored as JSON strings for compatibility with Spice.ai secret objects, as the keyring store supports only string values. | ||
|
||
**Example** | ||
|
||
For setting `spiceai` api key secret using macOS keychain, create new keychain entry, with following JSON string value | ||
|
||
``` | ||
"{ key: "<your spice.ai app api key>" }" | ||
``` | ||
<img src="/images/secrets-keychain-example.png" alt="" width="800"> | ||
Then set `store` field of the `secrets` section in the Spicepod manifest: | ||
```yaml | ||
secrets: | ||
store: keyring | ||
``` | ||
|
||
|
||
|
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.