Commit Graph

38 Commits

Author SHA1 Message Date
Roberto Hidalgo
6e72397a86 Allow setting of Consul ServiceMeta tags from config file (#11084)
* Allow setting of Consul ServiceMeta tags from config file

probably a bad idea, let's see how it works
scaffold tests

* kick circleci

* Add links to consul docs

Co-authored-by: Violet Hynes <a.xenasis@gmail.com>

* add changelog note

* use relative developer docs links

* address feedback

* please linter

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-05-27 16:28:10 -04:00
Kevin Schoonover
c0ea7b1a35 reload service registration configuration on SIGHUP (#17598)
* add reloading service configuration

* add changelog entry

* add tests

* fix typo

* check if config.ServiceRegistration is nil before signaling

* add changes for deregistering service on nil config with failing tests

* fix tests by decreasing reconcile_timeout + setting consul agent tokens

* fix races

* add comments in test

---------

Co-authored-by: Marc Boudreau <marc.boudreau@hashicorp.com>
2024-05-09 17:13:14 -04:00
Violet Hynes
64a78cdb88 Fix incorrectly deferred unlock in Consul service registration (#26444) 2024-04-16 14:53:30 -04:00
Josh Black
fa13dbd381 add gosimport to make fmt and run it (#25383)
* add gosimport to make fmt and run it

* move installation to tools.sh

* correct weird spacing issue

* Update Makefile

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>

* fix a weird issue

---------

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>
2024-02-13 14:07:02 -08:00
Ikko Eltociear Ashimine
3e0ede6a3f Fix typo in consul_service_registration.go (#19602)
initalize -> initialize

Co-authored-by: Chris Capurso <1036769+ccapurso@users.noreply.github.com>
2023-11-03 14:24:53 -04:00
hashicorp-copywrite[bot]
0b12cdcfd1 [COMPLIANCE] License changes (#22290)
* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Updating the license from MPL to Business Source License.

Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl.

* add missing license headers

* Update copyright file headers to BUS-1.1

* Fix test that expected exact offset on hcl file

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Sarah Thompson <sthompson@hashicorp.com>
Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
2023-08-10 18:14:03 -07:00
Nick Cabatoff
64b50ad7a1 Support mixed case consul service tags on consul storage engine (#6483)
* When support for service tags was added, the only way we had to parse
and dedup a list of strings also forced them to be lowercase.  Now there's
another helper func that doesn't smash the case so use that instead.

* update Consul 'service_tag' documentation to include case sensitivity

* added upgrade guide for 1.15

* test for service tags

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>
Co-authored-by: Peter Wilson <peter.wilson@hashicorp.com>
2023-07-25 20:26:54 +00:00
Hamid Ghaf
e55c18ed12 adding copyright header (#19555)
* adding copyright header

* fix fmt and a test
2023-03-15 09:00:52 -07:00
Marc Boudreau
d6c71614a8 Introduce GitHub Actions CI Workflow (#19449)
* Migrate subset of CircleCI ci workflow to GitHub Actions

Runs test-go and test-go-remote-docker with a static splitting of test packages

* [skip actions] add comment to explain the purpose of test-generate-test-package-lists.sh and what to do if it fails

* change trigger to push

---------

Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-03-06 16:57:55 -05:00
Josh Black
03d2be4cb9 update gofumpt to 0.3.1 and reformat the repo (#17055)
* update gofumpt to 0.3.1 and reformat the repo

* output the version of the formatter we're using
2022-09-07 17:31:20 -07:00
Rémi Lapeyre
a694daaf64 secrets/consul: Add support to auto-bootstrap Consul ACL system (#10751)
* Automatically bootstraps the Consul ACL system if no management token is given on the access config
2022-04-20 17:16:15 -05:00
swayne275
ead5972952 Cleanup bool checks (#14102)
* clean up == true cases

* cleanup == false where it didn't seem to hurt readability
2022-02-18 07:35:53 -07:00
Robert
ba16684d03 secret/consul: Add support for consul namespaces and admin partitions (#13850)
* Add support for consul namespaces and admin partitions
2022-02-09 15:44:00 -06:00
Calvin Leung Huang
d45c67c68a serviceregistration: add external-source meta value (#12163)
* serviceregistration: add external-source meta value

* add changelog file
2021-08-03 09:31:01 -07:00
Tor E Hagemann
81fbac54a5 fix: print consul svc addr in debug log (#12115)
* fix: print consul svc addr in debug log

* fix: add small change log 12115.txt
2021-07-21 13:12:49 -07:00
Jeff Mitchell
861454e0ed Migrate to sdk/internalshared libs in go-secure-stdlib (#12090)
* Swap sdk/helper libs to go-secure-stdlib

* Migrate to go-secure-stdlib reloadutil

* Migrate to go-secure-stdlib kv-builder

* Migrate to go-secure-stdlib gatedwriter
2021-07-15 20:17:31 -04:00
hghaf099
0e49fc9d88 Diagnose warns if HTTPS is not used for ha-storage-tls-consul [VAULT-2773] (#11967)
* Diagnose warns if HTTPS is not used for ha-storage-tls-consul

* Skipping TLS verification if https is not used in ha storage tls consul

* Adding diagnose skip message for consul service registration
2021-07-07 14:35:25 -04:00
Hridoy Roy
cea68aaa68 Add expiration warning to certificate checking for diagnose [VAULT-1018] (#11850)
* add expiration warning to certificate checking for diagnose

* Update serviceregistration/consul/consul_service_registration.go

Co-authored-by: swayne275 <swayne275@gmail.com>

* review comments

Co-authored-by: swayne275 <swayne275@gmail.com>
2021-06-15 09:53:29 -07:00
Lars Lehtonen
b69998de5f errwrap.Wrapf() mop-up (#11779) 2021-06-07 12:18:03 -04:00
Scott Miller
d60057b820 Create helpers which integrate with OpenTelemetry for diagnose collection (#11454)
* Create helpers which integrate with OpenTelemetry for diagnose collection

* Go mod vendor

* Comments

* Update vault/diagnose/helpers.go

Co-authored-by: swayne275 <swayne275@gmail.com>

* Add unit test/example

* tweak output

* More comments

* add spot check concept

* Get unit tests working on Result structs

* Fix unit test

* Get unit tests working, and make diagnose sessions local rather than global

* Comments

* Last comments

* No need for init

* :|

* Fix helpers_test

Co-authored-by: swayne275 <swayne275@gmail.com>
2021-04-29 13:32:41 -05:00
Hridoy Roy
a20b005e3e Consul TLS Checks for Diagnose [draft] (#11467)
* consul tls checks

* fix some tests

* complete physical and service registration tls checks
2021-04-28 08:55:18 -07:00
Lars Lehtonen
f5e9d22165 serviceregistration: deprecate errwrap.Wrapf() (#11443) 2021-04-26 08:33:50 -04:00
Brian Kassouf
a24653cc5c Run a more strict formatter over the code (#11312)
* Update tooling

* Run gofumpt

* go mod vendor
2021-04-08 09:43:39 -07:00
swayne275
8e1ca212fb Shutdown Test Cores when Tests Complete (#10912)
* Shutdown Test Cores when Tests Complete

* go mod vendor
2021-02-12 13:04:48 -07:00
Nick Cabatoff
723906970f Use an atomic to avoid a race in runEventDemuxer. (#10901) 2021-02-11 11:50:41 -05:00
ncabatoff
2b3aef242b Run CI tests in docker instead of a machine. (#8948) 2020-09-15 10:01:26 -04:00
ncabatoff
a7183b1edb Update retryablehttp to fix a data race (#9551) 2020-08-31 11:10:52 -04:00
ncabatoff
3c1c9f86a1 Ensure "initialized" service registration tag is also present whenever Vault is unsealed, on both Consul and K8s (#8990)
* Add the initialized tag to Consul registration for parity with k8s (and for easy automated testing).  Ensure that whenever we flag Vault as unsealed, we also flag it as initialized.

* Update API docs.

Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com>
2020-06-29 16:02:49 -04:00
Calvin Leung Huang
5894f65138 Refactor service registration (#8976)
* serivceregistration: refactor service registration logic to run later

* move state check to the internal func

* sr/kubernetes: update setInitialStateInternal godoc

* sr/kubernetes: remove return in setInitialState

* core/test: fix mockServiceRegistration

* address review feedback
2020-05-15 11:06:58 -07:00
ncabatoff
5aba3b8aba Define Consul version to test against in one place, and let it be overriden by environment. Exception: some tests that verify interoperability with older Consul versions still specify a version explicitly. (#8901) 2020-04-30 13:06:24 -04:00
Becca Petrin
18a323cd27 Sanitize Vault version strings for Kubernetes (#8411)
* sanitize vault version strings for kube

* replace disallowed chars with dashes

* use strings.Map

* use switch for whitelisted chars
2020-02-24 14:19:58 -08:00
Becca Petrin
7dcb9d88a3 fix testserver in vault enterprise environment (#8358) 2020-02-14 18:17:58 -08:00
Becca Petrin
0937a58ad7 Add Kubernetes service registration (#8249) 2020-02-13 09:56:29 -08:00
Becca Petrin
22af019c5b preserve state immediately (#8336) 2020-02-11 13:04:40 -08:00
ncabatoff
20c514cc60 Removing timing-dependent aspects of test. (#8261) 2020-01-30 11:02:48 -05:00
Becca Petrin
d7d4084c86 Observer pattern for service registration interface (#8123)
* use observer pattern for service discovery

* update perf standby method

* fix test

* revert usersTags to being called serviceTags

* use previous consul code

* vault isnt a performance standby before starting

* log err

* changes from feedback

* add Run method to interface

* changes from feedback

* fix core test

* update example
2020-01-24 09:42:03 -08:00
Michel Vocks
3a4989c53b Add additional check for consul storage backend TLS options (#8084) 2020-01-02 10:53:19 -08:00
Mike Jarmy
df01a4307d Introduce optional service_registration stanza (#7887)
* move ServiceDiscovery into methods

* add ServiceDiscoveryFactory

* add serviceDiscovery field to vault.Core

* refactor ConsulServiceDiscovery into separate struct

* cleanup

* revert accidental change to go.mod

* cleanup

* get rid of un-needed struct tags in vault.CoreConfig

* add service_discovery parser

* add ServiceDiscovery to config

* cleanup

* cleanup

* add test for ConfigServiceDiscovery to Core

* unit testing for config service_discovery stanza

* cleanup

* get rid of un-needed redirect_addr stuff in service_discovery stanza

* improve test suite

* cleanup

* clean up test a bit

* create docs for service_discovery

* check if service_discovery is configured, but storage does not support HA

* tinker with test

* tinker with test

* tweak docs

* move ServiceDiscovery into its own package

* tweak a variable name

* fix comment

* rename service_discovery to service_registration

* tweak service_registration config

* Revert "tweak service_registration config"

This reverts commit 5509920a8ab4c5a216468f262fc07c98121dce35.

* simplify naming

* refactor into ./serviceregistration/consul
2019-12-06 09:46:39 -05:00