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:
And also the updates of JSONoutput showing the performed operations are placed after the premature return:
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
- https
Then 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-2
The 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
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
performdiffreturns on error here and tells the caller that 0 operation performed:deck/cmd/common.go
Line 698 in 19a389c
And also the updates of JSONoutput showing the performed operations are placed after the premature return:
deck/cmd/common.go
Line 703 in 19a389c
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
Then you sync with the invalid configuration
The output show that
The user may think that the route
r2remains unchanged. However, when we rundeck gateway dumpto show the current Kong configuration in postgresDB, it shows that the router2is actually changed: