Commit 43c6241
committed
Fix K8s token refresh by delegating getClient() to K8sConfig cache
K8sConfig.getClient() uses a Guava cache with a 50-minute expiry to
refresh the service account token (added in PR #6742). However,
K8sExecutor.register() called k8sConfig.getClient() once at startup
and stored the result in a private field. K8sExecutor.getClient()
returned that stored field directly, and K8sTaskHandler stored
executor.client in its constructor — so the Guava cache was never
consulted again after startup.
This caused 401 Unauthorized errors after ~60 minutes on clusters
with short-lived projected SA tokens (e.g. AKS, RKE2 with default
~1hr token lifetime).
Fix:
- Remove the private K8sClient field from K8sExecutor
- Change getClient() to delegate to k8sConfig.getClient() on each
invocation, letting the Guava cache handle token refresh
- Fix K8sTaskHandler constructor to use executor.getClient() instead
of accessing executor.client directly
Fixes #6918
Generated by Claude Code
Signed-off-by: adamrtalbot <12817534+adamrtalbot@users.noreply.github.com>1 parent 021c77c commit 43c6241
File tree
2 files changed
+10
-11
lines changed- plugins/nf-k8s/src/main/nextflow/k8s
2 files changed
+10
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | 43 | | |
53 | 44 | | |
54 | 45 | | |
| |||
57 | 48 | | |
58 | 49 | | |
59 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
0 commit comments