Commit 55198fc
refactor: drop kedge-agent binary; use kedge CLI in agent container image (#141)
* refactor: drop kedge-agent binary; use kedge CLI in agent container image
- cmd/kedge-agent/ removed; agent container now runs kedge agent run
- Dockerfile.agent builds cmd/kedge/, ENTRYPOINT [/kedge, agent, run]
- kedge agent run already accepts --hub-kubeconfig for SA-backed auth
- e2e framework Agent.Start() updated to use bin/kedge agent run
- Makefile build-agent now builds bin/kedge (alias for build-kedge)
- dev-run-edge updated to use kedge agent run with correct flag names
- Closes #140
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
* fix: use --hub-insecure-skip-tls-verify in Helm chart and agent join template
kedge-agent used --insecure-skip-tls-verify but kedge agent run uses
--hub-insecure-skip-tls-verify. After dropping kedge-agent in favour of
the kedge CLI binary, the Helm chart deployment template and the
Deployment generated by 'kedge agent join' were passing the old flag name,
causing CrashLoopBackOff: 'unknown flag: --insecure-skip-tls-verify'.
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
* fix: load hub kubeconfig from in-cluster Secret on pod restart
When the agent runs as a Kubernetes Deployment with a bootstrap join
token, the flow is:
1. First boot: connect with token → hub sends back kubeconfig
2. Agent saves kubeconfig to in-cluster Secret (SaveKubeconfigToSecret)
then calls os.Exit(1) to force a pod restart
3. Second boot (token still in Deployment args): runAgentForeground must
load the Secret BEFORE falling back to the bootstrap token
Previously step 3 only checked the local filesystem (ephemeral in a
container) and the durable token config, meaning it always fell back to
the bootstrap token — which the hub had already cleared — causing
'invalid join token' rejections on every restart.
Fix: add LoadKubeconfigFromSecret to incluster.go and call it at the top
of runAgentForeground when IsInCluster() is true. If the Secret exists
the kubeconfig is written to a temp file and used directly, overriding
the bootstrap token in the Deployment args.
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
* fix: restore --hub-insecure-skip-tls-verify in agentJoinKubernetes Deployment template
The cp in the previous commit accidentally re-introduced --insecure-skip-tls-verify
(old kedge-agent flag) in the token-mode and kubeconfig-mode Deployment args
generated by 'kedge agent join --type kubernetes'. This caused the Deployment
pod to crash immediately with 'unknown flag'.
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
---------
Co-authored-by: mjudeikis-bot <ai@faros.sh>
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>1 parent c584751 commit 55198fc
8 files changed
Lines changed: 78 additions & 245 deletions
File tree
- cmd/kedge-agent
- deploy
- charts/kedge-agent/templates
- pkg
- agent
- cli/cmd
- test/e2e/framework
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| |||
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
159 | | - | |
| 160 | + | |
160 | 161 | | |
161 | 162 | | |
162 | | - | |
| 163 | + | |
163 | 164 | | |
164 | | - | |
| 165 | + | |
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
| |||
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
175 | | - | |
| 176 | + | |
176 | 177 | | |
177 | | - | |
| 178 | + | |
178 | 179 | | |
179 | 180 | | |
180 | 181 | | |
| |||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
74 | 100 | | |
75 | 101 | | |
76 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
86 | 117 | | |
87 | 118 | | |
88 | 119 | | |
| |||
342 | 373 | | |
343 | 374 | | |
344 | 375 | | |
345 | | - | |
| 376 | + | |
346 | 377 | | |
347 | 378 | | |
348 | 379 | | |
| |||
404 | 435 | | |
405 | 436 | | |
406 | 437 | | |
407 | | - | |
| 438 | + | |
408 | 439 | | |
409 | 440 | | |
410 | 441 | | |
| |||
0 commit comments