Skip to content

feat(windows): Create daemon for non-k8s orchestration and update enricher, cache and controller to support standalone mode#1385

Closed
BeegiiK wants to merge 11 commits into
microsoft:mainfrom
BeegiiK:issues/1365
Closed

feat(windows): Create daemon for non-k8s orchestration and update enricher, cache and controller to support standalone mode#1385
BeegiiK wants to merge 11 commits into
microsoft:mainfrom
BeegiiK:issues/1365

Conversation

@BeegiiK

@BeegiiK BeegiiK commented Feb 24, 2025

Copy link
Copy Markdown
Contributor

Description

This PR is part 1 of a POC on enabling Retina to work outside of Kubernetes (ACI) and collect pod level information such as name and namespace by running it as a binary on the host VM.

The two main efforts are the following:

  • Decoupling the dependence for the K8s configuration files to allow bootstrapping to proceed. Currently, if the control plane fails to boot up, the data plane will also too. In the scenario of running on ACI, we need to reconfigure how Retina starts as it expects a lot of K8s information so that the responsible plugin (HNS stats - feature only supports windows as of now) can start collecting information. This behavior can be controlled by the new toggle, i.e. enableStandalone and by default it will be set to false.

  • Collecting the pod related information. There are two ways that we can retrieve the pod name and its corresponding namespace for a given (HNS endpoint / IP address). Either through containerd or reading the CNI state file. This behavior can be controlled by another new toggle, i.e. enableCrictl. Once these were collected by the controller, the new data are returned in the new set of advanced metrics for windows

Bootstrap Manager:

  • Retina would start as a normal binary with the toggle set to true in the config.yaml file. The bootstrap manager then selects the appropriate daemon depending if standalone is enabled.

Daemon:

Controller:

Enricher:

  • For standalone mode, the HNS plugin will write to the enricher and flows will be handled here. The cache is checked for the corresponding IP address and enriched.
  • The export reader of the enricher will be created in the metrics module.

Related Issue

#1365

Checklist

  • I have read the contributing documentation.
  • I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Screenshots (if applicable) or Testing Completed

AKS testing to ensure normal Retina works

image
image

Running it as a binary on a Windows VM

CriCtl

image
image
image

State-file

image
image

Manual deletion in the state-file to reflect cache is updated
image

ACI Dev Node

image

Additional Notes


Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.

@BeegiiK BeegiiK changed the title Create standalone daemon for non-k8s orchestration feat(windows): Create standalone daemon for non-k8s orchestration Feb 28, 2025
@BeegiiK BeegiiK self-assigned this Feb 28, 2025
@rbtr rbtr requested a review from Copilot February 28, 2025 16:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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")

Comment thread pkg/controllers/cache/standalone_cache.go Outdated
Comment thread cmd/standalone_daemon.go Outdated
@BeegiiK BeegiiK force-pushed the issues/1365 branch 4 times, most recently from 0294bba to a9efcc5 Compare March 25, 2025 16:32
Comment thread cmd/standalone_daemon.go Outdated
Comment thread cmd/bootstrap_manager.go Outdated
Comment thread cmd/standalone_daemon.go Outdated
Comment thread deploy/standard/manifests/controller/helm/retina/values.yaml
Comment thread pkg/controllers/cache/standalone_cache.go Outdated
Comment thread pkg/controllers/cache/standalone_cache_test.go Outdated
Comment thread pkg/enricher/enricher.go Outdated
Comment thread pkg/enricher/enricher.go Outdated
Comment thread pkg/enricher/standalone_enricher.go Outdated
Comment thread pkg/enricher/standalone_enricher_test.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 20 out of 22 changed files in this pull request and generated 1 comment.

Files not reviewed (2)
  • pkg/enricher/ctrinfo/mock_podSpec.json: Language not supported
  • pkg/enricher/statefile/mock_statefile.json: Language not supported

Comment thread pkg/enricher/ctrinfo/helper.go Outdated
@BeegiiK BeegiiK force-pushed the issues/1365 branch 2 times, most recently from 3748469 to 44ce508 Compare April 16, 2025 10:17
@BeegiiK BeegiiK changed the title feat(windows): Create standalone daemon for non-k8s orchestration feat(windows): Create standalone daemon for non-k8s orchestration and retrieve pod level metadata on running VM May 19, 2025
@BeegiiK BeegiiK marked this pull request as ready for review May 19, 2025 12:57
@BeegiiK BeegiiK requested a review from a team as a code owner May 19, 2025 12:57
@BeegiiK BeegiiK force-pushed the issues/1365 branch 3 times, most recently from 9528334 to 3988cf0 Compare May 23, 2025 14:55
@github-actions

Copy link
Copy Markdown

This PR will be closed in 7 days due to inactivity.

@github-actions github-actions Bot added the meta/waiting-for-author Blocked and waiting on the author label Jun 23, 2025
@github-actions

Copy link
Copy Markdown

Pull request closed due to inactivity.

@BeegiiK BeegiiK force-pushed the issues/1365 branch 2 times, most recently from 8a00e7c to b4a6867 Compare September 30, 2025 16:05
@BeegiiK BeegiiK force-pushed the issues/1365 branch 3 times, most recently from 560e696 to 858f730 Compare October 1, 2025 09:25
@github-actions

github-actions Bot commented Nov 1, 2025

Copy link
Copy Markdown

This PR will be closed in 7 days due to inactivity.

@github-actions github-actions Bot added the meta/waiting-for-author Blocked and waiting on the author label Nov 1, 2025
@github-actions

github-actions Bot commented Nov 9, 2025

Copy link
Copy Markdown

Pull request closed due to inactivity.

@github-actions github-actions Bot closed this Nov 9, 2025
@BeegiiK BeegiiK reopened this Nov 11, 2025
@github-actions github-actions Bot removed the meta/waiting-for-author Blocked and waiting on the author label Nov 12, 2025
@github-actions

Copy link
Copy Markdown

This PR will be closed in 7 days due to inactivity.

@github-actions github-actions Bot added the meta/waiting-for-author Blocked and waiting on the author label Dec 12, 2025
@github-actions

Copy link
Copy Markdown

Pull request closed due to inactivity.

@github-actions github-actions Bot closed this Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/windows meta/waiting-for-author Blocked and waiting on the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants