Skip to content

Commit 45cf284

Browse files
authored
update docs for file-based auth support (#1692)
Companion for kedacore/keda#7082 Signed-off-by: Jonas-Taha El Sesiy <[email protected]>
1 parent b8f4b31 commit 45cf284

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
+++
2+
title = "File path"
3+
+++
4+
5+
You can read authentication parameters from files mounted in the KEDA operator pod using the `filePath` option. This feature requires the KEDA operator to be configured with a root path for file access.
6+
7+
## Security Constraints
8+
9+
The `filePath` feature has important security constraints:
10+
11+
- **Requires root path configuration** - The KEDA operator must be started with `--filepath-auth-root-path` to define the allowed directory
12+
- **Path validation** - All file paths are validated to ensure they resolve within the configured root path, preventing access to sensitive system files like service account tokens
13+
- **Relative paths** - The `filePath` in `ClusterTriggerAuthentication` is treated as a relative path under the configured root path
14+
15+
## Operator Configuration
16+
17+
The KEDA operator requires a command-line argument to enable file-based authentication:
18+
19+
```bash
20+
--filepath-auth-root-path=/path/to/allowed/files
21+
```
22+
23+
This path should point to a directory where credential files are mounted. The operator will only read files from within this directory.
24+
25+
## Example
26+
27+
First, ensure the KEDA operator has the root path configured. Then create a `ClusterTriggerAuthentication` referencing files:
28+
29+
```yaml
30+
apiVersion: keda.sh/v1alpha1
31+
kind: ClusterTriggerAuthentication
32+
metadata:
33+
name: file-based-auth
34+
spec:
35+
filePath:
36+
- parameter: apiKey # Required - Defined by the scale trigger
37+
path: credentials/api-key # Required - Path relative to filepath-auth-root-path
38+
```
39+
40+
**Assumptions:**
41+
- The path is relative to the `--filepath-auth-root-path` configured for the KEDA operator
42+
- The credential file exists at `{filepath-auth-root-path}/credentials/api-key`
43+
- The file contains the raw credential value (not JSON encoded)
44+
- The file path should match the actual file name, including any extension if present (e.g., `credentials/api-key.txt` if the file is named `api-key.txt`)

content/docs/2.19/concepts/authentication.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ spec:
104104
- parameter: {scaledObject-parameter-name} # Required.
105105
name: {env-name} # Required.
106106
containerName: {container-name} # Optional. Default: scaleTargetRef.envSourceContainerName of ScaledObject
107+
filePath: # Optional. Define only for ClusterTriggerAuthentication; not supported for TriggerAuthentication.
108+
- parameter: {scaledObject-parameter-name} # Required.
109+
path: {relative-path-to-file} # Required. Relative to --filepath-auth-root-path.
107110
hashiCorpVault: # Optional.
108111
address: {hashicorp-vault-address} # Required.
109112
namespace: {hashicorp-vault-namespace} # Optional. Default is root namespace. Useful for Vault Enterprise
@@ -241,6 +244,30 @@ secretTargetRef: # Optional.
241244

242245
**Assumptions:** `namespace` is in the same resource as referenced by `scaleTargetRef.name` in the ScaledObject, unless specified otherwise.
243246

247+
### File(s)
248+
249+
> **Note:** This feature requires the KEDA operator to be configured with `--filepath-auth-root-path`.
250+
251+
You can read authentication parameters from files mounted in the KEDA operator pod. This is useful when credentials are provided via init containers or sidecars that write to a shared volume.
252+
253+
The `filePath` option is only available for `ClusterTriggerAuthentication`, not for namespaced `TriggerAuthentication`.
254+
255+
```yaml
256+
filePath: # Optional.
257+
- parameter: apiKey # Required - Defined by the scale trigger
258+
path: credentials/api-key # Required - Path relative to filepath-auth-root-path
259+
```
260+
261+
**Security constraints:**
262+
- The path is validated to ensure it resolves within the configured `--filepath-auth-root-path`
263+
- Access to sensitive paths like `/var/run/secrets/kubernetes.io/serviceaccount/` is blocked
264+
- Only `ClusterTriggerAuthentication` can use this authentication method
265+
266+
**Assumptions:**
267+
- The KEDA operator must be started with `--filepath-auth-root-path=/path/to/allowed/files`
268+
- The credential file exists at `{filepath-auth-root-path}/{path}`
269+
- The file contains the raw credential value
270+
244271
### Bound service account token(s)
245272

246273
You can pull one or more service account tokens into the trigger by defining the `serviceAccountName` of the Kubernetes service account.

0 commit comments

Comments
 (0)