Skip to content

Commit 39f46be

Browse files
committed
Disable JVM DNS caching in favor of BOSH DNS
BOSH DNS is always present in Cloud Foundry and provides its own caching layer. Setting networkaddress.cache.ttl=0 ensures the JVM always queries BOSH DNS for fresh results, avoiding stale DNS entries when containers restart or scale. This restores parity with the Ruby buildpack's networking.rb behavior.
1 parent 84aad66 commit 39f46be

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/java/frameworks/container_security_provider.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ func (c *ContainerSecurityProviderFramework) writeSecurityProperties() error {
139139
content += fmt.Sprintf("security.provider.%d=%s\n", i+2, provider)
140140
}
141141

142+
// Disable JVM DNS caching in lieu of BOSH DNS caching
143+
// BOSH DNS is always present in Cloud Foundry and provides its own caching layer
144+
// Setting TTL to 0 ensures the JVM always queries BOSH DNS for fresh results
145+
content += "\n# Disable JVM DNS caching (BOSH DNS provides caching)\n"
146+
content += "networkaddress.cache.ttl=0\n"
147+
content += "networkaddress.cache.negative.ttl=0\n"
148+
142149
if err := os.WriteFile(securityFile, []byte(content), 0644); err != nil {
143150
return fmt.Errorf("failed to write security properties file: %w", err)
144151
}

0 commit comments

Comments
 (0)