From 435030df2fc3c781e6a1b9d14dec0a115c688198 Mon Sep 17 00:00:00 2001 From: Jiaxun Song Date: Mon, 11 Mar 2024 02:38:48 +0000 Subject: [PATCH] change gcsfuse log format to json --- pkg/sidecar_mounter/sidecar_mounter_config.go | 2 +- .../sidecar_mounter_config_test.go | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/sidecar_mounter/sidecar_mounter_config.go b/pkg/sidecar_mounter/sidecar_mounter_config.go index b3584a84f..991c3b7ce 100644 --- a/pkg/sidecar_mounter/sidecar_mounter_config.go +++ b/pkg/sidecar_mounter/sidecar_mounter_config.go @@ -154,7 +154,7 @@ func (mc *MountConfig) prepareMountArgs() { configFileFlagMap := map[string]string{ "logging:file-path": "/dev/fd/1", // redirect the output to cmd stdout - "logging:format": "text", + "logging:format": "json", "cache-dir": "", // by default the gcsfuse file cache is disabled on GKE } diff --git a/pkg/sidecar_mounter/sidecar_mounter_config_test.go b/pkg/sidecar_mounter/sidecar_mounter_config_test.go index ea1a31516..c47164b83 100644 --- a/pkg/sidecar_mounter/sidecar_mounter_config_test.go +++ b/pkg/sidecar_mounter/sidecar_mounter_config_test.go @@ -37,7 +37,7 @@ var ( defaultConfigFileFlagMap = map[string]string{ "logging:file-path": "/dev/fd/1", - "logging:format": "text", + "logging:format": "json", "cache-dir": "", } @@ -101,7 +101,7 @@ func TestPrepareMountArgs(t *testing.T) { }, expectedConfigMapArgs: map[string]string{ "logging:file-path": "/dev/fd/1", - "logging:format": "text", + "logging:format": "json", "logging:severity": "error", "write:create-empty-file": "true", "cache-dir": "", @@ -172,7 +172,7 @@ func TestPrepareMountArgs(t *testing.T) { expectedArgs: defaultFlagMap, expectedConfigMapArgs: map[string]string{ "logging:file-path": "/dev/fd/1", - "logging:format": "text", + "logging:format": "json", "cache-dir": "", "file-cache:max-size-mb": "0", }, @@ -189,7 +189,7 @@ func TestPrepareMountArgs(t *testing.T) { expectedArgs: defaultFlagMap, expectedConfigMapArgs: map[string]string{ "logging:file-path": "/dev/fd/1", - "logging:format": "text", + "logging:format": "json", "cache-dir": "test-cache-dir", "file-cache:max-size-mb": "-1", }, @@ -206,7 +206,7 @@ func TestPrepareMountArgs(t *testing.T) { expectedArgs: defaultFlagMap, expectedConfigMapArgs: map[string]string{ "logging:file-path": "/dev/fd/1", - "logging:format": "text", + "logging:format": "json", "cache-dir": "test-cache-dir", "file-cache:max-size-mb": "100", }, @@ -243,7 +243,7 @@ func TestPrepareConfigFile(t *testing.T) { ConfigFile: "./test-config-file.yaml", ConfigFileFlagMap: map[string]string{ "logging:file-path": "/dev/fd/1", - "logging:format": "text", + "logging:format": "json", "logging:severity": "error", "write:create-empty-file": "true", "file-cache:max-size-mb": "10000", @@ -256,7 +256,7 @@ func TestPrepareConfigFile(t *testing.T) { expectedConfig: map[string]interface{}{ "logging": map[string]interface{}{ "file-path": "/dev/fd/1", - "format": "text", + "format": "json", "severity": "error", }, "write": map[string]interface{}{ @@ -279,7 +279,7 @@ func TestPrepareConfigFile(t *testing.T) { ConfigFile: "./test-config-file.yaml", ConfigFileFlagMap: map[string]string{ "logging:file-path": "/dev/fd/1", - "logging:format": "text", + "logging:format": "json", "logging": "invalid", }, },