-
Notifications
You must be signed in to change notification settings - Fork 132
Description
When error happens on running deck gateway sync, the output of summary always shows that there are no changes on entities, but there may be other entity actually gets changed.
The performdiff returns on error here and tells the caller that 0 operation performed:
Line 698 in 19a389c
| if errs != nil { |
And also the updates of JSONoutput showing the performed operations are placed after the premature return:
Line 703 in 19a389c
| if enableJSONOutput { |
However, the performed changes before the error happens are not rollbacked, so the returned message can be very misleading.
For example, if you have the existing configuration in the postgresDB
_format_version: "3.0"
services:
- connect_timeout: 60000
enabled: true
host: mockbin.org
name: svc1
routes:
- https_redirect_status_code: 301
name: r1
path_handling: v0
paths:
- /r1
preserve_host: false
protocols:
- http
- https
- connect_timeout: 60000
enabled: true
host: mockbin.org
name: svc2
port: 80
protocol: http
retries: 5
routes:
- https_redirect_status_code: 301
name: r2
path_handling: v0
paths:
- /r2
preserve_host: false
protocols:
- http
- httpsThen you sync with the invalid configuration
_format_version: "3.0"
services:
- connect_timeout: 60000
host: mockbin.org
name: svc1
port: 80
protocol: http
read_timeout: 60000
retries: 5
routes:
- name: r1 # invalid route because path is not specified
- connect_timeout: 60000
host: mockbin.org
name: svc2
port: 80
protocol: http
read_timeout: 60000
retries: 5
routes:
- name: r2
https_redirect_status_code: 301
paths:
- /r2-2The output show that
Summary:
Created: 0
Updated: 0
Deleted: 0
Error: 1 errors occurred:
while processing event: Update route r1 failed: HTTP status 400 (message: "schema violation (must set one of 'methods', 'hosts', 'headers', 'paths', 'snis' when 'protocols' is 'https')")
The user may think that the route r2 remains unchanged. However, when we run deck gateway dump to show the current Kong configuration in postgresDB, it shows that the route r2 is actually changed:
_format_version: "3.0"
services:
- connect_timeout: 60000
enabled: true
host: mockbin.org
name: svc1
port: 80
protocol: http
read_timeout: 60000
retries: 5
routes:
- https_redirect_status_code: 301
name: r1
path_handling: v0
paths:
- /r1
preserve_host: false
protocols:
- http
- https
regex_priority: 0
request_buffering: true
response_buffering: true
strip_path: true
write_timeout: 60000
- connect_timeout: 60000
enabled: true
host: mockbin.org
name: svc2
port: 80
protocol: http
read_timeout: 60000
retries: 5
routes:
- https_redirect_status_code: 301
name: r2
path_handling: v0
paths:
- /r2-2 # The route r2 is actually changed.
preserve_host: false
protocols:
- http
- https
regex_priority: 0
request_buffering: true
response_buffering: true
strip_path: true
write_timeout: 60000