Commit 73ab5df
committed
fix(config): serialize Duration as a flat string under YAML
config.Duration only implemented MarshalJSON, so gopkg.in/yaml.v2/v3 (which
does not honor MarshalJSON) serialized the embedded time.Duration as a nested
`duration:` map. Any config that serializes a Duration to YAML and is read
back through the viper/mapstructure config loader (TagName json +
StringToTimeDurationHookFunc, which expects a string like "30s") would fail
to decode.
This first surfaced with the connector keepalive config: the operator writes
the connector configmap with yaml.v2, emitting `time:\n duration: 30s`,
which the connector plugin could not read back. Add MarshalYAML/UnmarshalYAML
so Duration round-trips as a flat "30s" string under YAML.
Signed-off-by: Kevin Su <pingsutw@apache.org>1 parent d2f9024 commit 73ab5df
1 file changed
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
49 | 74 | | |
50 | 75 | | |
51 | 76 | | |
| |||
0 commit comments