open-consul/agent/structs
Dhia Ayachi 8552efa955
auto-reload configuration when config files change (#12329)
* add config watcher to the config package

* add logging to watcher

* add test and refactor to add WatcherEvent.

* add all API calls and fix a bug with recreated files

* add tests for watcher

* remove the unnecessary use of context

* Add debug log and a test for file rename

* use inode to detect if the file is recreated/replaced and only listen to create events.

* tidy ups (#1535)

* tidy ups

* Add tests for inode reconcile

* fix linux vs windows syscall

* fix linux vs windows syscall

* fix windows compile error

* increase timeout

* use ctime ID

* remove remove/creation test as it's a use case that fail in linux

* fix linux/windows to use Ino/CreationTime

* fix the watcher to only overwrite current file id

* fix linter error

* fix remove/create test

* set reconcile loop to 200 Milliseconds

* fix watcher to not trigger event on remove, add more tests

* on a remove event try to add the file back to the watcher and trigger the handler if success

* fix race condition

* fix flaky test

* fix race conditions

* set level to info

* fix when file is removed and get an event for it after

* fix to trigger handler when we get a remove but re-add fail

* fix error message

* add tests for directory watch and fixes

* detect if a file is a symlink and return an error on Add

* rename Watcher to FileWatcher and remove symlink deref

* add fsnotify@v1.5.1

* fix go mod

* do not reset timer on errors, rename OS specific files

* rename New func

* events trigger on write and rename

* add missing test

* fix flaking tests

* fix flaky test

* check reconcile when removed

* delete invalid file

* fix test to create files with different mod time.

* back date file instead of sleeping

* add watching file in agent command.

* fix watcher call to use new API

* add configuration and stop watcher when server stop

* add certs as watched files

* move FileWatcher to the agent start instead of the command code

* stop watcher before replacing it

* save watched files in agent

* add add and remove interfaces to the file watcher

* fix remove to not return an error

* use `Add` and `Remove` to update certs files

* fix tests

* close events channel on the file watcher even when the context is done

* extract `NotAutoReloadableRuntimeConfig` is a separate struct

* fix linter errors

* add Ca configs and outgoing verify to the not auto reloadable config

* add some logs and fix to use background context

* add tests to auto-config reload

* remove stale test

* add tests to changes to config files

* add check to see if old cert files still trigger updates

* rename `NotAutoReloadableRuntimeConfig` to `StaticRuntimeConfig`

* fix to re add both key and cert file. Add test to cover this case.

* review suggestion

Co-authored-by: R.B. Boyer <4903+rboyer@users.noreply.github.com>

* add check to static runtime config changes

* fix test

* add changelog file

* fix review comments

* Apply suggestions from code review

Co-authored-by: R.B. Boyer <4903+rboyer@users.noreply.github.com>

* update flag description

Co-authored-by: FFMMM <FFMMM@users.noreply.github.com>

* fix compilation error

* add static runtime config support

* fix test

* fix review comments

* fix log test

* Update .changelog/12329.txt

Co-authored-by: Dan Upton <daniel@floppy.co>

* transfer tests to runtime_test.go

* fix filewatcher Replace to not deadlock.

* avoid having lingering locks

Co-authored-by: R.B. Boyer <4903+rboyer@users.noreply.github.com>

* split ReloadConfig func

* fix warning message

Co-authored-by: R.B. Boyer <4903+rboyer@users.noreply.github.com>

* convert `FileWatcher` into an interface

* fix compilation errors

* fix tests

* extract func for adding and removing files

Co-authored-by: Ashwin Venkatesh <ashwin@hashicorp.com>
Co-authored-by: R.B. Boyer <4903+rboyer@users.noreply.github.com>
Co-authored-by: FFMMM <FFMMM@users.noreply.github.com>
Co-authored-by: Daniel Upton <daniel@floppy.co>
2022-03-31 15:11:49 -04:00
..
acl.go auto-reload configuration when config files change (#12329) 2022-03-31 15:11:49 -04:00
acl_cache.go acl: remove ACL.GetPolicy endpoint and resolve legacy acls 2021-09-29 14:33:19 -04:00
acl_cache_test.go
acl_oss.go Cross port of ent #1383 (#11726) 2021-12-03 10:20:25 -08:00
acl_test.go acl: remove Policy.ID and Policy.Revision 2021-11-05 15:43:52 -04:00
auto_encrypt.go
autopilot.go
autopilot_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
catalog.go oss: Add overview UI internal endpoint 2022-03-22 17:05:09 -07:00
catalog_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
check_definition.go preload json values in structs to determine defaults 2021-10-10 17:52:26 -04:00
check_definition_test.go
check_type.go preload json values in structs to determine defaults 2021-10-10 17:52:26 -04:00
config_entry.go Add source of authority annotations to the PermissionDeniedError output. (#12567) 2022-03-18 10:32:25 -07:00
config_entry_discoverychain.go Refactor config checks oss (#12550) 2022-03-11 13:45:51 -08:00
config_entry_discoverychain_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
config_entry_discoverychain_test.go Remove support for failover to partition 2021-12-06 12:32:24 -07:00
config_entry_exports.go Refactor config checks oss (#12550) 2022-03-11 13:45:51 -08:00
config_entry_gateways.go xds: adding control of the mesh-wide min/max TLS versions and cipher suites from the mesh config entry (#12601) 2022-03-30 13:43:59 -05:00
config_entry_gateways_test.go Fix some more Enterprise Normalization issues affecting tests 2021-09-23 10:12:37 +01:00
config_entry_intentions.go auto-reload configuration when config files change (#12329) 2022-03-31 15:11:49 -04:00
config_entry_intentions_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
config_entry_intentions_test.go Sync enterprise changes to oss (#10994) 2021-09-08 11:59:30 -04:00
config_entry_mesh.go xds: adding control of the mesh-wide min/max TLS versions and cipher suites from the mesh config entry (#12601) 2022-03-30 13:43:59 -05:00
config_entry_mesh_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
config_entry_oss.go Prevent partition-exports entry from OSS usage 2021-11-29 11:24:16 -07:00
config_entry_oss_test.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
config_entry_test.go xds: adding control of the mesh-wide min/max TLS versions and cipher suites from the mesh config entry (#12601) 2022-03-30 13:43:59 -05:00
connect.go
connect_ca.go auto-reload configuration when config files change (#12329) 2022-03-31 15:11:49 -04:00
connect_ca_test.go add root_cert_ttl option for consul connect, vault ca providers (#11428) 2021-11-02 11:02:10 -07:00
connect_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
connect_proxy_config.go proxycfg: introduce explicit UpstreamID in lieu of bare string (#12125) 2022-01-20 10:12:04 -06:00
connect_proxy_config_oss.go proxycfg: introduce explicit UpstreamID in lieu of bare string (#12125) 2022-01-20 10:12:04 -06:00
connect_proxy_config_test.go bulk rewrite using this script 2022-01-20 10:46:23 -06:00
discovery_chain.go server: ensure that service-defaults meta is incorporated into the discovery chain response (#12511) 2022-03-30 10:04:18 -05:00
discovery_chain_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
errors.go
federation_state.go
identity.go
intention.go acl: fix intention:*:write checks (#11061) 2021-09-16 11:08:45 -05:00
intention_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
intention_test.go bulk rewrite using this script 2022-01-20 10:46:23 -06:00
operator.go
prepared_query.go
prepared_query_test.go
protobuf_compat.go remove the rest of gogo 2022-03-28 17:34:41 -04:00
sanitize_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
service_definition.go Add failures_before_warning to checks (#10969) 2021-09-14 12:47:52 -04:00
service_definition_test.go bulk rewrite using this script 2022-01-20 10:46:23 -06:00
snapshot.go
structs.go Bump go-control-plane 2022-03-30 13:11:27 -04:00
structs_filtering_test.go Sync enterprise changes to oss (#10994) 2021-09-08 11:59:30 -04:00
structs_oss.go Clean up ent meta id usage in overview summary 2022-03-23 12:47:12 -07:00
structs_oss_test.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
structs_test.go catalog: compare node names case insensitively in more places (#12444) 2022-02-24 16:54:47 -06:00
system_metadata.go Add virtual IP generation for term gateway backed services 2022-01-12 12:08:49 -08:00
testing.go Vendor in rpc mono repo for net/rpc fork, go-msgpack, msgpackrpc. (#12311) 2022-02-14 09:45:45 -08:00
testing_catalog.go xds: prefer fed state gateway definitions if they're fresher (#11522) 2021-11-09 16:45:36 +00:00
testing_connect_proxy_config.go
testing_intention.go Cleanup unnecessary normalizing method (#11169) 2021-09-28 15:31:12 -04:00
testing_service_definition.go
txn.go