Skip to content

rep: optionally log container instance address on container operations - #1218

Merged
ameowlia merged 3 commits into
cloudfoundry:developfrom
ivo1116:rep-optional-log-container-network-info
Oct 19, 2026
Merged

ameowlia merged 3 commits into
cloudfoundry:developfrom
ivo1116:rep-optional-log-container-network-info

Conversation

@ivo1116

@ivo1116 ivo1116 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a new diego.rep.log_container_network_info property (default false). When enabled, the rep logs each container's internal (instance) IP under the container-network-info log key during container operations.

This provides a connection-independent way to correlate a container's overlay IP to its instance — useful for operators who want to attribute network activity (e.g. a DNS lookup captured elsewhere by its source IP) back to a specific LRP/instance without relying on the app opening a connection that would otherwise surface the mapping.

Details

  • New property diego.rep.log_container_network_info (default false) → rendered into the rep config as log_container_network_info → RepConfig.LogContainerNetworkInfo → threaded through generator.New to ContainerOperation.
  • The log line is emitted only when the property is true and the container has an internal IP, so there is no behavior/volume change by default.
  • Unit tests cover config parsing and both the enabled (line emitted) and disabled (line suppressed) cases.

Testing

go build ./... and go test ./generator/ ./cmd/rep/config/ pass.

Add a diego.rep.log_container_network_info property (default false). When
enabled, the rep logs each container's internal (instance) IP under the
"container-network-info" log key during container operations, providing a
connection-independent way to correlate a container IP to its instance.

Signed-off-by: Radkov <ivo.radkov@sap.com>
Keep the Windows rep job spec and config template in sync with the Linux
rep job (resolves the windows-drift / rep-specs-drifted lint checks).

Signed-off-by: Radkov <ivo.radkov@sap.com>

@ameowlia ameowlia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This provides a connection-independent way to correlate a container's overlay IP to its instance — useful for operators who want to attribute network activity (e.g. a DNS lookup captured elsewhere by its source IP) back to a specific LRP/instance without relying on the app opening a connection that would otherwise surface the mapping.

Yes I see how this would be helpful.

According to my AI, as written, this logs every ~30s for every container, not just on container operations. ContainerOperation.Execute() is also called by the bulker's periodic sync (BatchOperations → operationFromContainer, every polling_interval_in_seconds), so each container re-emits container-network-info on every sweep. Was that intended?

If you really want it every 30s then this should definitely be optional via config like you have already done. In that case I would update the config description to indicate this frequency.

However, if you want to limit it to only certain container actions like when it starts running, any change to readiness, exiting, then I think it would be a good idea to turn it on for everyone with no need for config.

Please ping me on slack when you want me to review this PR again.

…ption

Describe explicitly that the container-network-info line is emitted on every
container-operation sweep (per diego.rep.polling_interval_in_seconds, default
30s) for every container with an internal IP, so operators understand the
per-poll frequency before enabling. No behavior change.

Signed-off-by: Radkov <ivo.radkov@sap.com>
@github-project-automation github-project-automation Bot moved this from Inbox to Pending Merge | Prioritized in Application Runtime Platform Working Group Oct 19, 2026
@ameowlia
ameowlia merged commit ba34b6e into cloudfoundry:develop Oct 19, 2026
10 checks passed
@github-project-automation github-project-automation Bot moved this from Pending Merge | Prioritized to Done in Application Runtime Platform Working Group Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants