-
Notifications
You must be signed in to change notification settings - Fork 1
support loading client secrets from Kubernetes Secret Resource #26
Conversation
b03c5de
to
4674174
Compare
71f6729
to
e2dd0bb
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #26 +/- ##
==========================================
- Coverage 93.12% 93.05% -0.07%
==========================================
Files 19 20 +1
Lines 1266 1311 +45
==========================================
+ Hits 1179 1220 +41
- Misses 51 55 +4
Partials 36 36
|
dd944e9
to
c4a373d
Compare
ad614bc
to
dea5e25
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments. Thanks!
036d5f8
to
848534d
Compare
5f0bd3b
to
ab4b0f4
Compare
ab4b0f4
to
c0c5fc2
Compare
internal/config.go
Outdated
} | ||
|
||
return cl, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will be loading other secrets, and I think we could decouple the K8s logic from the Config file itself, for a cleaner design. For example, we could:
- Create a
SecretLoader
in theinternal
package that receives the Config in the constructor and that implements therun.PreRunner
interface. This will make itsPreRun
method be called after the configuration has been loaded. - In the PreRun method, you can load the secrets and mutate the configuration accordingly.
- In the
main.go
, register the secretLoader in the run group immediately after the localConfig.
This way the k8s logic will be decoupled from the configuration, and if we need to reuse, say the k8s client in other services we'll already have the code prepared to share it more easily.
c0c5fc2
to
fcfb4e6
Compare
Added a small fix to the e2e tests, so that the kubeconfig is only loaded if there is any secret ref configured. It was trying to load it in the docker-based tests as well. |
This PR loads client secrets from Kubernetes Secrets when reading config.
A follow-up PR will be added to watch Kubernetes Secrets and update the config.
Fix #24