Skip to content

Commit 6e8ee16

Browse files
committed
feat(standalone): Polishing
1 parent 0b9f3a3 commit 6e8ee16

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

pkg/controllers/daemon/standalone/controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func New(config *kcfg.StandaloneConfig, cache *standalone.Cache, metricsModule *
5656
cache: cache,
5757
config: config,
5858
metricsModule: metricsModule,
59-
l: log.Logger().Named(string("Controller")),
59+
l: log.Logger().Named(string("RetinaEndpointController")),
6060
}, nil
6161
}
6262

@@ -104,7 +104,7 @@ func (c *Controller) Reconcile(ctx context.Context) error {
104104

105105
// Run starts the controller loop
106106
func (c *Controller) Run(ctx context.Context) {
107-
c.l.Info("Starting controller")
107+
c.l.Info("Starting RetinaEndpoint controller")
108108

109109
ticker := time.NewTicker(c.config.MetricsInterval)
110110
defer ticker.Stop()
@@ -124,7 +124,7 @@ func (c *Controller) Run(ctx context.Context) {
124124

125125
// Stop stops the controller and cleans up resources
126126
func (c *Controller) Stop() {
127-
c.l.Info("Stopping controller")
127+
c.l.Info("Stopping RetinaEndpoint controller")
128128
c.cache.Clear()
129129
c.metricsModule.Clear()
130130
}

pkg/controllers/daemon/standalone/controller_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,17 @@ func TestControllerReconcile(t *testing.T) {
4646
newEndpoint := common.NewRetinaEndpoint("new-pod", "default", &common.IPAddresses{IPv4: net.ParseIP("1.1.1.1")})
4747
mockSource.EXPECT().GetAllEndpoints().Return([]*common.RetinaEndpoint{newEndpoint}, nil)
4848

49+
// Need valid file path to initialize statefile source
50+
testMockStatefilePath := "./source/statefile/azure/azure-vnet-mock.json"
51+
4952
// Setup test controller with invalid config to test error handling
50-
invalidCfg := &kcfg.StandaloneConfig{MetricsInterval: time.Second, EnrichmentMode: "gcp-statefile"}
53+
invalidCfg := &kcfg.StandaloneConfig{MetricsInterval: time.Second, EnrichmentMode: "gcp-statefile", StateFileLocation: testMockStatefilePath}
5154
controller, err := New(invalidCfg, cache, metricsModule)
5255
require.Error(t, err)
5356
require.Nil(t, controller)
5457

5558
// Setup test controller with valid config
56-
cfg := &kcfg.StandaloneConfig{MetricsInterval: time.Second, EnrichmentMode: "azure-vnet-statefile"}
59+
cfg := &kcfg.StandaloneConfig{MetricsInterval: time.Second, EnrichmentMode: "azure-vnet-statefile", StateFileLocation: testMockStatefilePath}
5760
controller, err = New(cfg, cache, metricsModule)
5861
require.NoError(t, err)
5962
require.NotNil(t, controller)

0 commit comments

Comments
 (0)