-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fall back to lenient decoding when strict decoding config fails #6156
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The test is failed in |
The job tested wrong image, fixing it in #6157 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
test/e2e/basic_test.go
Outdated
@@ -58,6 +59,7 @@ func TestBasic(t *testing.T) { | |||
t.Run("testGratuitousARP", func(t *testing.T) { testGratuitousARP(t, data, data.testNamespace) }) | |||
t.Run("testClusterIdentity", func(t *testing.T) { testClusterIdentity(t, data) }) | |||
t.Run("testLogRotate", func(t *testing.T) { testLogRotate(t, data) }) | |||
t.Run("testForwardCompatibility", func(t *testing.T) { testForwardCompatibility(t, data) }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I would just suggest renaming the test to testConfigForwardCompatibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed, thanks
When upgrading Antrea, the config is usually updated first and there may be some new fields added to it. If a yet update agent crashes during the process, it will fail to restart due to the unknown new fields because we do strict decoding only. The patch adds lenient decoding when strict decoding fails to tolerate unknown fields and duplicate fields. Other errors like malformed data and unmatched type are still fatal. Signed-off-by: Quan Tian <quan.tian@broadcom.com>
/test-all |
When upgrading Antrea, the config is usually updated first and there may be some new fields added to it. If a yet update agent crashes during the process, it will fail to restart due to the unknown new fields because we do strict decoding only.
The patch adds lenient decoding when strict decoding fails to tolerate unknown fields and duplicate fields. Other errors like malformed data and unmatched type are still fatal.
For reference, kube-proxy and kubelet have been doing this since 1.17:
https://github.com/kubernetes/kubernetes/blob/227c2e7c2b2c05a9c8b2885460e28e4da25cf558/cmd/kube-proxy/app/server.go#L491
https://github.com/kubernetes/kubernetes/blob/227c2e7c2b2c05a9c8b2885460e28e4da25cf558/pkg/kubelet/kubeletconfig/util/codec/codec.go#L76