Skip to content

Commit b154853

Browse files
committed
node-agent: add the trackPublicNetworks option
1 parent 37f675e commit b154853

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

api/v1/coroot_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ type NodeAgentSpec struct {
7070
LogCollector LogCollectorSpec `json:"logCollector,omitempty"`
7171
EbpfTracer EbpfTracerSpec `json:"ebpfTracer,omitempty"`
7272
EbpfProfiler EbpfProfilerSpec `json:"ebpfProfiler,omitempty"`
73+
74+
// Allow track connections to the specified IP networks (e.g., Y.Y.Y.Y/mask, default: 0.0.0.0/0).
75+
TrackPublicNetworks []string `json:"trackPublicNetworks,omitempty"`
7376
}
7477

7578
type LogCollectorSpec struct {

api/v1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/coroot.com_coroots.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5999,6 +5999,12 @@ spec:
59995999
type: string
60006000
type: object
60016001
type: array
6002+
trackPublicNetworks:
6003+
description: 'Allow track connections to the specified IP networks
6004+
(e.g., Y.Y.Y.Y/mask, default: 0.0.0.0/0).'
6005+
items:
6006+
type: string
6007+
type: array
60026008
update_strategy:
60036009
description: DaemonSetUpdateStrategy is a struct used to control
60046010
the update strategy for a DaemonSet.

controller/node_agent.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ func (r *CorootReconciler) nodeAgentDaemonSet(cr *corootv1.Coroot) *appsv1.Daemo
5454
if v := cr.Spec.NodeAgent.EbpfProfiler.Enabled; v == nil || *v {
5555
env = append(env, corev1.EnvVar{Name: "PROFILES_ENDPOINT", Value: corootURL + "/v1/profiles"})
5656
}
57+
if v := cr.Spec.NodeAgent.TrackPublicNetworks; len(v) > 0 {
58+
env = append(env, corev1.EnvVar{Name: "TRACK_PUBLIC_NETWORK", Value: strings.Join(v, "\n")})
59+
}
5760

5861
for _, e := range cr.Spec.NodeAgent.Env {
5962
env = append(env, e)

0 commit comments

Comments
 (0)