-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(windows): Create standalone daemon for non-k8s orchestration #1385
base: main
Are you sure you want to change the base?
Conversation
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.
PR Overview
This PR introduces a standalone daemon for non-K8s orchestration. Key changes include:
- Adding a standalone cache implementation with its corresponding test.
- Implementing a new standalone daemon in the cmd package.
- Introducing a BootstrapManager to initialize and start the daemon in non-Kubernetes environments.
Reviewed Changes
File | Description |
---|---|
pkg/controllers/cache/standalone_cache_test.go | Adds tests for standalone cache functionality |
cmd/standalone_daemon.go | Implements a new standalone daemon for Retina orchestration |
cmd/bootstrap_manager.go | Introduces a bootstrap manager to bootstrap the daemon |
pkg/controllers/cache/standalone_cache.go | Implements cache logic used by the standalone daemon |
cmd/standard/daemon.go | Updates daemon configuration and startup to integrate new behavior |
cmd/root.go | Updates CLI to use the new BootstrapManager instead of the daemon directly |
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
cmd/bootstrap_manager.go:43
- [nitpick] Consider using the logger for output instead of fmt.Printf to maintain consistent logging and potentially capture log levels and context.
fmt.Printf("Bootstrapping Retina")
0294bba
to
a9efcc5
Compare
func TestAddPod(t *testing.T) { | ||
if _, err := log.SetupZapLogger(log.GetDefaultLogOpts()); err != nil { | ||
t.Fatalf("Failed to setup logger: %v", err) | ||
} | ||
cache := NewStandaloneCache() | ||
|
||
emptyPodInfo := cache.GetPod(ip) | ||
if emptyPodInfo != nil { | ||
t.Fatalf("Expected nil, got %v", emptyPodInfo) | ||
} | ||
|
||
cache.ProcessPodInfo(ip, defaultInfo) | ||
podInfo := cache.GetPod(ip) | ||
|
||
if podInfo == nil { | ||
t.Fatalf("Expected pod info, got nil") | ||
} | ||
assert.Equal(t, podInfo.Name, name) | ||
assert.Equal(t, podInfo.Namespace, namespace) | ||
} | ||
|
||
func TestDeletePod(t *testing.T) { | ||
if _, err := log.SetupZapLogger(log.GetDefaultLogOpts()); err != nil { | ||
t.Fatalf("Failed to setup logger: %v", err) | ||
} | ||
cache := NewStandaloneCache() | ||
|
||
// Add pod | ||
cache.ProcessPodInfo(ip, defaultInfo) | ||
podInfo := cache.GetPod(ip) | ||
if podInfo == nil { | ||
t.Fatalf("Expected pod info, got nil") | ||
} | ||
|
||
// Attempt to delete pod not in cache | ||
cache.ProcessPodInfo("9.9.9.9", nil) | ||
podInfo1 := cache.GetPod(ip) | ||
if podInfo1 == nil { | ||
t.Fatalf("Expected pod info, got nil") | ||
} | ||
|
||
// Delete pod | ||
cache.ProcessPodInfo(ip, nil) | ||
deletedPodInfo := cache.GetPod(ip) | ||
if deletedPodInfo != nil { | ||
t.Fatalf("Expected nil, got %v", deletedPodInfo) | ||
} | ||
} |
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.
these tests seems to be testing ProcessPodInfo
. Consider adding to a single function TestProcessPodInfo and use table driven tests to test several behaviors of the method (https://dave.cheney.net/2019/05/07/prefer-table-driven-tests)
Description
Please provide a brief description of the changes made in this pull request.
Related Issue
If this pull request is related to any issue, please mention it here. Additionally, make sure that the issue is assigned to you before submitting this pull request.
Checklist
git commit -S -s ...
). See this documentation on signing commits.Screenshots (if applicable) or Testing Completed
Please add any relevant screenshots or GIFs to showcase the changes made.
Additional Notes
Add any additional notes or context about the pull request here.
Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.