Skip to content

Commit

Permalink
change gcsfuse log format to json
Browse files Browse the repository at this point in the history
  • Loading branch information
songjiaxun committed Mar 11, 2024
1 parent 2b05ba3 commit 435030d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/sidecar_mounter/sidecar_mounter_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
16 changes: 8 additions & 8 deletions pkg/sidecar_mounter/sidecar_mounter_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var (

defaultConfigFileFlagMap = map[string]string{
"logging:file-path": "/dev/fd/1",
"logging:format": "text",
"logging:format": "json",
"cache-dir": "",
}

Expand Down Expand Up @@ -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": "",
Expand Down Expand Up @@ -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",
},
Expand All @@ -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",
},
Expand All @@ -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",
},
Expand Down Expand Up @@ -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",
Expand All @@ -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{}{
Expand All @@ -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",
},
},
Expand Down

0 comments on commit 435030d

Please sign in to comment.