Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/aisix-config-boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ cat "$work/standalone/config.yaml"
name=aisix-cfgboot-standalone-$run_id
docker run -d --name "$name" -p 127.0.0.1::3000 \
-e AISIX_CONFIG_PATH=/etc/aisix/chart/config.yaml \
-e OPENAI_API_KEY=sk-ci-placeholder -e CALLER_API_KEY=ci-caller-placeholder \
-e OPENAI_API_KEY=sk-ci-placeholder \
-v "$work/standalone/config.yaml:/etc/aisix/chart/config.yaml:ro" \
-v "$work/standalone/resources.yaml:/etc/aisix/resources/resources.yaml:ro" \
"$image" >/dev/null
Expand Down
32 changes: 22 additions & 10 deletions charts/aisix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,35 +108,47 @@ controlPlane:

standalone:
resources:
_format_version: "1"
_format_version: "2"
provider_keys:
- display_name: openai-main
- id: 0b6f3c1e-2f0a-4c5e-9d55-7d1a8b0c2e11
display_name: openai-main
provider: openai
adapter: openai
api_key: ${OPENAI_API_KEY}
api_base: https://api.openai.com/v1
models:
- display_name: gpt-4o-mini
- id: 6efd592d-a73b-573d-8e2c-e9e103692f92
display_name: gpt-4o-mini
provider: openai
model_name: gpt-4o-mini
provider_key: openai-main
provider_key_id: 0b6f3c1e-2f0a-4c5e-9d55-7d1a8b0c2e11
api_keys:
- display_name: my-caller
key_env: CALLER_API_KEY
allowed_models:
- gpt-4o-mini
- id: 4a1c9e2b-7d3f-4b6a-8c5e-1f2a3b4c5d6e
display_name: my-caller
key_hash: ${CALLER_API_KEY_SHA256}
allowed_model_ids:
- 6efd592d-a73b-573d-8e2c-e9e103692f92

extraEnvVars:
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: openai-credentials
key: api-key
- name: CALLER_API_KEY
- name: CALLER_API_KEY_SHA256
valueFrom:
secretKeyRef:
name: aisix-caller-keys
key: my-caller
key: my-caller-sha256
```

Every entry carries an `id`, a lowercase UUID you choose, and resources refer
to each other by it (`provider_key_id`, `allowed_model_ids`). An API key is
stored as `key_hash`, the SHA-256 hex digest of the key callers send, so the
key itself never appears in the file:

```sh
printf %s "$CALLER_API_KEY" | sha256sum | cut -d' ' -f1
```

`standalone.existingSecret` and `standalone.existingConfigMap` read the file from
Expand Down
32 changes: 22 additions & 10 deletions charts/aisix/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -102,35 +102,47 @@ controlPlane:

standalone:
resources:
_format_version: "1"
_format_version: "2"
provider_keys:
- display_name: openai-main
- id: 0b6f3c1e-2f0a-4c5e-9d55-7d1a8b0c2e11
display_name: openai-main
provider: openai
adapter: openai
api_key: ${OPENAI_API_KEY}
api_base: https://api.openai.com/v1
models:
- display_name: gpt-4o-mini
- id: 6efd592d-a73b-573d-8e2c-e9e103692f92
display_name: gpt-4o-mini
provider: openai
model_name: gpt-4o-mini
provider_key: openai-main
provider_key_id: 0b6f3c1e-2f0a-4c5e-9d55-7d1a8b0c2e11
api_keys:
- display_name: my-caller
key_env: CALLER_API_KEY
allowed_models:
- gpt-4o-mini
- id: 4a1c9e2b-7d3f-4b6a-8c5e-1f2a3b4c5d6e
display_name: my-caller
key_hash: ${CALLER_API_KEY_SHA256}
allowed_model_ids:
- 6efd592d-a73b-573d-8e2c-e9e103692f92

extraEnvVars:
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: openai-credentials
key: api-key
- name: CALLER_API_KEY
- name: CALLER_API_KEY_SHA256
valueFrom:
secretKeyRef:
name: aisix-caller-keys
key: my-caller
key: my-caller-sha256
```

Every entry carries an `id`, a lowercase UUID you choose, and resources refer
to each other by it (`provider_key_id`, `allowed_model_ids`). An API key is
stored as `key_hash`, the SHA-256 hex digest of the key callers send, so the
key itself never appears in the file:

```sh
printf %s "$CALLER_API_KEY" | sha256sum | cut -d' ' -f1
```

`standalone.existingSecret` and `standalone.existingConfigMap` read the file from
Expand Down
28 changes: 15 additions & 13 deletions charts/aisix/ci/standalone-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,31 @@ replicaCount: 1

standalone:
resources:
_format_version: "1"
_format_version: "2"
provider_keys:
- display_name: openai-main
- id: 0b6f3c1e-2f0a-4c5e-9d55-7d1a8b0c2e11
display_name: openai-main
provider: openai
adapter: openai
api_key: ${OPENAI_API_KEY}
api_base: https://api.openai.com/v1
models:
- display_name: gpt-4o-mini
- id: 6efd592d-a73b-573d-8e2c-e9e103692f92
display_name: gpt-4o-mini
provider: openai
model_name: gpt-4o-mini
provider_key: openai-main
provider_key_id: 0b6f3c1e-2f0a-4c5e-9d55-7d1a8b0c2e11
api_keys:
- display_name: ci-caller
key_env: CALLER_API_KEY
allowed_models:
- gpt-4o-mini
# sha256 of `ci-caller-placeholder`; a hash is not a credential.
- id: 4a1c9e2b-7d3f-4b6a-8c5e-1f2a3b4c5d6e
display_name: ci-caller
key_hash: 4adaf08efa9183c9371238ebd87b767857dd7cbfb5d6b80e718fad5b5f666bba
allowed_model_ids:
- 6efd592d-a73b-573d-8e2c-e9e103692f92

# Both variables are referenced by the resources file above, which fails to
# load if either is unset. No request is sent upstream during the install
# test, so the values only have to be non-empty.
# Referenced by the resources file above, which fails to load if it is unset.
# No request is sent upstream during the install test, so the value only has
# to be non-empty.
extraEnvVars:
- name: OPENAI_API_KEY
value: sk-ci-placeholder-not-a-real-key
- name: CALLER_API_KEY
value: ci-caller-placeholder
Loading