It was IK8sInfoBootstrap depends on K8sInfoBackgroundService
Changed to K8sInfoBackgroundService depends on K8sInfoBootstrap
So that logic has been pulled out of K8sInfoBackgroundService. The responsibility for K8sInfoBackgroundService is clearly to handle background service startup.
And the bootstrap logic is shared by both the background service and called by the client directly.
The fetch of the cluster properties is pulled out of the bootstrap implementations to divide the responsibilities:
K8sInfoBootstrap is responsible for handling bootstrap logic - initial delay, time out, query intervals, etc.
K8sEnvironmentFetcher is responsible for creating a new K8sEnv object and setting it to K8sEnvHolder.
It is more aligned with the single responsibility principle, isolating those responsibilities also made it possible to mock half of the responsibilities and test the other half.
Added unit tests to cover DI container service resolution.
Tests
[x] F5 project E2E - deployed to k8s, got the k8s properties.
[x] Console application deployed to k8s, got the k8s properties.
Addresses #327. Piggybacked some simple refactor.
Flipped the dependency.
IK8sInfoBootstrap
depends onK8sInfoBackgroundService
K8sInfoBackgroundService
depends onK8sInfoBootstrap
So that logic has been pulled out ofK8sInfoBackgroundService
. The responsibility forK8sInfoBackgroundService
is clearly to handle background service startup. And the bootstrap logic is shared by both the background service and called by the client directly.The fetch of the cluster properties is pulled out of the bootstrap implementations to divide the responsibilities:
K8sInfoBootstrap
is responsible for handling bootstrap logic - initial delay, time out, query intervals, etc.K8sEnvironmentFetcher
is responsible for creating a new K8sEnv object and setting it to K8sEnvHolder. It is more aligned with the single responsibility principle, isolating those responsibilities also made it possible to mock half of the responsibilities and test the other half.Added unit tests to cover DI container service resolution.
Tests