Skip to content

src: vault driver logs in by AppRole and Kubernetes - #65

Merged
Insei merged 3 commits into
mainfrom
vault-login
Oct 19, 2026
Merged

Insei merged 3 commits into
mainfrom
vault-login

Conversation

@Insei

@Insei Insei commented Oct 19, 2026

Copy link
Copy Markdown
Owner

The vault driver gets the token itself, without Vault Agent:

  • WithAppRole(roleID, secretID) — AppRole auth method;
  • WithKubernetes(role, tokenFile) — Kubernetes auth method with the token of the service account, /var/run/secrets/kubernetes.io/serviceaccount/token by default; the file is read before every login, so the rotated token is used;
  • WithAuthMount(mount) — another mount of the auth method, approle and kubernetes by default.

The driver logs in at the first request and keeps the token, the new token is requested after 2/3 of its lease, and once more when Vault denies the request, because the token can be revoked before its lease expires. Wrong credentials wrap tinyconf.ErrAccessDenied. A login method has priority over WithToken, WithTokenFile and VAULT_TOKEN. No new dependencies: the login is one request of the HTTP API.

The e2e test logs in by AppRole to Vault 1.18. Documentation: the vault driver page, the use case with secrets, Known limitations of Why tinyconf, README, the skill.

Insei added 3 commits October 19, 2026 12:32
… token is requested again before its lease expires

Signed-off-by: Dmitriy Aleksandrov <goodmobiledevices@gmail.com>
Signed-off-by: Dmitriy Aleksandrov <goodmobiledevices@gmail.com>
Signed-off-by: Dmitriy Aleksandrov <goodmobiledevices@gmail.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (be6203c) to head (6965f99).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #65   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           32        32           
  Lines         2693      2755   +62     
=========================================
+ Hits          2693      2755   +62     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark diff: be6203c → 8e8d035 (10 runs)

goos: linux
goarch: amd64
pkg: github.com/insei/tinyconf/v2
cpu: AMD EPYC 7763 64-Core Processor                
                    │  base.txt   │              head.txt              │
                    │   sec/op    │   sec/op     vs base               │
Parse-4               3.349µ ± 0%   3.331µ ± 1%  -0.57% (p=0.014 n=10)
Parse_SubConfig-4     1.530µ ± 0%   1.524µ ± 0%  -0.46% (p=0.011 n=10)
Current-4             55.24n ± 0%   55.30n ± 0%       ~ (p=0.078 n=10)
Current_SubConfig-4   98.90n ± 1%   98.50n ± 0%       ~ (p=0.363 n=10)
geomean               409.1n        407.7n       -0.33%

                    │    base.txt    │               head.txt                │
                    │      B/op      │     B/op      vs base                 │
Parse-4               1.344Ki ± 0%     1.344Ki ± 0%       ~ (p=1.000 n=10) ¹
Parse_SubConfig-4       392.0 ± 0%       392.0 ± 0%       ~ (p=1.000 n=10) ¹
Current-4               0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
Current_SubConfig-4     0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                            ²                 +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                    │   base.txt   │              head.txt               │
                    │  allocs/op   │ allocs/op   vs base                 │
Parse-4               18.00 ± 0%     18.00 ± 0%       ~ (p=1.000 n=10) ¹
Parse_SubConfig-4     10.00 ± 0%     10.00 ± 0%       ~ (p=1.000 n=10) ¹
Current-4             0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Current_SubConfig-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                          ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

pkg: github.com/insei/tinyconf/v2/drivers
                │  base.txt   │           head.txt            │
                │   sec/op    │   sec/op     vs base          │
Parse_Drivers-4   58.63µ ± 1%   58.69µ ± 1%  ~ (p=0.870 n=10)

                │   base.txt   │            head.txt            │
                │     B/op     │     B/op      vs base          │
Parse_Drivers-4   25.27Ki ± 0%   25.27Ki ± 0%  ~ (p=1.000 n=10)

                │  base.txt  │            head.txt            │
                │ allocs/op  │ allocs/op   vs base            │
Parse_Drivers-4   411.0 ± 0%   411.0 ± 0%  ~ (p=1.000 n=10) ¹
¹ all samples are equal

@Insei
Insei merged commit 7640d7a into main Oct 19, 2026
4 checks passed
@Insei
Insei deleted the vault-login branch October 19, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants