Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkg/enterprise/render/logcollector/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,19 @@ func (c *fluentBitComponent) metricsService() *corev1.Service {
}
}

// fluent-bit's listeners default to 0.0.0.0, which an IPv6-only pod can't be
// reached on. Binding the pod IP covers either family without guessing it from
// the IP pools (empty under non-Calico CNIs), and avoids "::", which fails
// where IPv6 is disabled and is v6-only on Windows.
const fluentBitListenAddress = "${POD_IP}"

// podIPEnvVar feeds fluentBitListenAddress.
var podIPEnvVar = corev1.EnvVar{Name: "POD_IP", ValueFrom: &corev1.EnvVarSource{FieldRef: &corev1.ObjectFieldSelector{FieldPath: "status.podIP"}}}

func (c *fluentBitComponent) envvars() []corev1.EnvVar {
envs := []corev1.EnvVar{
{Name: "NODENAME", ValueFrom: &corev1.EnvVarSource{FieldRef: &corev1.ObjectFieldSelector{FieldPath: "spec.nodeName"}}},
podIPEnvVar,
}
// Additional stores are Linux-only (the Windows pipeline ships to Linseed
// only, matching the fluentd Windows variant), so their credentials are too.
Expand Down
2 changes: 2 additions & 0 deletions pkg/enterprise/render/logcollector/eks_log_forwarder.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func (c *fluentBitComponent) renderEKSFluentBitConf() string {
"flush": 5,
"log_level": "info",
"http_server": true,
"http_listen": fluentBitListenAddress,
"http_port": FluentBitMetricsPort,
"health_check": true,
// Load the custom in_eks Go plugin shipped in the image. Without
Expand Down Expand Up @@ -104,6 +105,7 @@ func (c *fluentBitComponent) eksLogForwarderDeployment() *appsv1.Deployment {

envVars := []corev1.EnvVar{
{Name: "LOG_LEVEL", Value: "info"},
podIPEnvVar,
// CloudWatch config, credentials — consumed by the in_eks input plugin
// (fluent-bit/plugins/in_eks/pkg/config) and the AWS SDK credential chain.
{Name: "EKS_CLOUDWATCH_LOG_GROUP", Value: c.cfg.EKSConfig.GroupName},
Expand Down
10 changes: 10 additions & 0 deletions pkg/enterprise/render/logcollector/fluentbit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,15 @@ var _ = Describe("Tigera Secure Fluent Bit rendering tests", func() {
},
},
))
// The rendered listeners bind ${POD_IP} so IPv6-only pods are reachable.
Expect(envs).Should(ContainElement(
corev1.EnvVar{
Name: "POD_IP",
ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{FieldPath: "status.podIP"},
},
},
))

// Linseed/TLS config is now in the ConfigMap, not env vars.
Expect(envs).ShouldNot(ContainElements(
Expand Down Expand Up @@ -1100,6 +1109,7 @@ var _ = Describe("Tigera Secure Fluent Bit rendering tests", func() {

expectedEnvVars := []corev1.EnvVar{
{Name: "LOG_LEVEL", Value: "info", ValueFrom: nil},
{Name: "POD_IP", ValueFrom: &corev1.EnvVarSource{FieldRef: &corev1.ObjectFieldSelector{FieldPath: "status.podIP"}}},
{Name: "EKS_CLOUDWATCH_LOG_GROUP", Value: "dummy-eks-cluster-cloudwatch-log-group"},
{Name: "AWS_REGION", Value: "us-west-1", ValueFrom: nil},
{
Expand Down
3 changes: 2 additions & 1 deletion pkg/enterprise/render/logcollector/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func (c *fluentBitComponent) renderFluentBitConf() string {
"flush": 5,
"log_level": "info",
"http_server": true,
"http_listen": fluentBitListenAddress,
"http_port": FluentBitMetricsPort,
// Enable the /api/v1/health endpoint the readiness probe hits
// (without this it returns 404 and pods never become Ready).
Expand Down Expand Up @@ -116,7 +117,7 @@ func (c *fluentBitComponent) addInputs(cfg *fluentBitConfig) {
if c.cfg.NonClusterHost != nil && c.osType == rmeta.OSTypeLinux {
cfg.Pipeline.Inputs = append(cfg.Pipeline.Inputs, map[string]interface{}{
"name": "http",
"listen": "0.0.0.0",
"listen": fluentBitListenAddress,
"port": FluentBitInputPort,
// fluentd's http source accepted bodies up to `body_size_limit
// 100m`; in_http instead rejects anything over buffer_max_size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down Expand Up @@ -180,7 +181,7 @@
{
"buffer_chunk_size": "5M",
"buffer_max_size": "100M",
"listen": "0.0.0.0",
"listen": "${POD_IP}",
"name": "http",
"port": 9880,
"storage.type": "filesystem",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"service": {
"flush": 5,
"health_check": true,
"http_listen": "${POD_IP}",
"http_port": 2020,
"http_server": true,
"log_level": "info",
Expand Down
Loading