Skip to content

Commit

Permalink
merging new hierarchy for agent configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
trujillo-adam committed Mar 14, 2022
1 parent 771df29 commit 76d55ac
Show file tree
Hide file tree
Showing 93 changed files with 1,862 additions and 790 deletions.
2 changes: 1 addition & 1 deletion .release/linux/package/etc/consul.d/consul.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Fullconfiguration options can be found at https://www.consul.io/docs/agent/options.html
# Fullconfiguration options can be found at https://www.consul.io/docs/agent/config.html

# datacenter
# This flag controls the datacenter in which the agent is running. If not provided,
Expand Down
80 changes: 40 additions & 40 deletions CHANGELOG.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions agent/config/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ type RuntimeConfig struct {

// PrimaryGateways is a list of addresses and/or go-discover expressions to
// discovery the mesh gateways in the primary datacenter. See
// https://www.consul.io/docs/agent/options.html#cloud-auto-joining for
// https://www.consul.io/docs/agent/config/cli-flags.html#cloud-auto-joining for
// details.
//
// hcl: primary_gateways = []string
Expand Down Expand Up @@ -991,7 +991,7 @@ type RuntimeConfig struct {

// RetryJoinLAN is a list of addresses and/or go-discover expressions to
// join with retry enabled. See
// https://www.consul.io/docs/agent/options.html#cloud-auto-joining for
// https://www.consul.io/docs/agent/config/cli-flags.html#cloud-auto-joining for
// details.
//
// hcl: retry_join = []string
Expand All @@ -1016,7 +1016,7 @@ type RuntimeConfig struct {

// RetryJoinWAN is a list of addresses and/or go-discover expressions to
// join -wan with retry enabled. See
// https://www.consul.io/docs/agent/options.html#cloud-auto-joining for
// https://www.consul.io/docs/agent/config/cli-flags.html#cloud-auto-joining for
// details.
//
// hcl: retry_join_wan = []string
Expand Down
2 changes: 1 addition & 1 deletion agent/consul/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,7 @@ const peersInfoContent = `
As of Consul 0.7.0, the peers.json file is only used for recovery
after an outage. The format of this file depends on what the server has
configured for its Raft protocol version. Please see the agent configuration
page at https://www.consul.io/docs/agent/options.html#_raft_protocol for more
page at https://www.consul.io/docs/agent/config/cli-flags.html#_raft_protocol for more
details about this parameter.
For Raft protocol version 2 and earlier, this should be formatted as a JSON
Expand Down
10 changes: 10 additions & 0 deletions agent/kvs_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,20 @@ func (s *HTTPHandlers) KVSPut(resp http.ResponseWriter, req *http.Request, args

// Check the content-length
if req.ContentLength > int64(s.agent.config.KVMaxValueSize) {
<<<<<<< HEAD
return nil, EntityTooLargeError{
Reason: fmt.Sprintf("Request body(%d bytes) too large, max size: %d bytes. See %s.",
req.ContentLength, s.agent.config.KVMaxValueSize, "https://www.consul.io/docs/agent/options.html#kv_max_value_size"),
}
=======
resp.WriteHeader(http.StatusRequestEntityTooLarge)
fmt.Fprintf(resp,
"Request body(%d bytes) too large, max size: %d bytes. See %s.",
req.ContentLength, s.agent.config.KVMaxValueSize,
"https://www.consul.io/docs/agent/config/config-files.html#kv_max_value_size",
)
return nil, nil
>>>>>>> cd907b75cebdefe62a30986e0cdc7bd528c52159
}

// Copy the value
Expand Down
19 changes: 19 additions & 0 deletions agent/txn_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,20 @@ func (s *HTTPHandlers) convertOps(resp http.ResponseWriter, req *http.Request) (

// Check Content-Length first before decoding to return early
if req.ContentLength > maxTxnLen {
<<<<<<< HEAD
return nil, 0, EntityTooLargeError{
Reason: fmt.Sprintf("Request body(%d bytes) too large, max size: %d bytes. See %s.",
req.ContentLength, maxTxnLen, "https://www.consul.io/docs/agent/options.html#txn_max_req_len"),
}
=======
resp.WriteHeader(http.StatusRequestEntityTooLarge)
fmt.Fprintf(resp,
"Request body(%d bytes) too large, max size: %d bytes. See %s.",
req.ContentLength, maxTxnLen,
"https://www.consul.io/docs/agent/config/config-files.html#txn_max_req_len",
)
return nil, 0, false
>>>>>>> cd907b75cebdefe62a30986e0cdc7bd528c52159
}

var ops api.TxnOps
Expand All @@ -99,10 +109,19 @@ func (s *HTTPHandlers) convertOps(resp http.ResponseWriter, req *http.Request) (
if err.Error() == "http: request body too large" {
// The request size is also verified during decoding to double check
// if the Content-Length header was not set by the client.
<<<<<<< HEAD
return nil, 0, EntityTooLargeError{
Reason: fmt.Sprintf("Request body too large, max size: %d bytes. See %s.",
maxTxnLen, "https://www.consul.io/docs/agent/options.html#txn_max_req_len"),
}
=======
resp.WriteHeader(http.StatusRequestEntityTooLarge)
fmt.Fprintf(resp,
"Request body too large, max size: %d bytes. See %s.",
maxTxnLen,
"https://www.consul.io/docs/agent/config/config-files.html#txn_max_req_len",
)
>>>>>>> cd907b75cebdefe62a30986e0cdc7bd528c52159
} else {
// Note the body is in API format, and not the RPC format. If we can't
// decode it, we will return a 400 since we don't have enough context to
Expand Down
2 changes: 1 addition & 1 deletion docs/cluster-federation/network-areas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Every Consul Enterprise server maintains a reconciliation routine where every 30

Joining a network area pool involves:
1. Setting memberlist and Serf configuration.
* Prior to Consul `v1.8.11` and `v1.9.5`, network areas were configured with memberlist's [DefaultWANConfig](https://github.com/hashicorp/memberlist/blob/838073fef1a4e1f6cb702a57a8075304098b1c31/config.go#L315). This was then updated to instead use the server's [gossip_wan](https://www.consul.io/docs/agent/options#gossip_wan) configuration, which falls back to the DefaultWANConfig if it was not specified.
* Prior to Consul `v1.8.11` and `v1.9.5`, network areas were configured with memberlist's [DefaultWANConfig](https://github.com/hashicorp/memberlist/blob/838073fef1a4e1f6cb702a57a8075304098b1c31/config.go#L315). This was then updated to instead use the server's [gossip_wan](https://www.consul.io/docs/agent/config/config-files#gossip_wan) configuration, which falls back to the DefaultWANConfig if it was not specified.
* As of Consul `v1.8.11`/`v1.9.5` it is not possible to tune gossip communication on a per-area basis.

2. Update the server's gossip network, which keeps track of network areas that the server is a part of. This gossip network is also used to dispatch incoming **gossip** connections to handlers for the appropriate area.
Expand Down
6 changes: 3 additions & 3 deletions docs/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ specified using command line flags, and some can be loaded with [Auto-Config].
See also the [checklist for adding a new field] to the configuration.

[hcl]: https://github.com/hashicorp/hcl/tree/hcl1
[Agent Configuration]: https://www.consul.io/docs/agent/options
[Agent Configuration]: https://www.consul.io/docs/agent/config
[checklist for adding a new field]: ./checklist-adding-config-fields.md
[Auto-Config]: #auto-config
[Config Entries]: https://www.consul.io/docs/agent/options#config_entries
[Config Entries]: https://www.consul.io/docs/agent/config/config-files#config_entries
[Services]: https://www.consul.io/docs/discovery/services
[Checks]: https://www.consul.io/docs/discovery/checks

Expand Down Expand Up @@ -53,6 +53,6 @@ implemented in a couple packages.
* the server RPC endpoint is in [agent/consul/auto_config_endpoint.go]
* the client that receives and applies the config is implemented in [agent/auto-config]

[auto_config]: https://www.consul.io/docs/agent/options#auto_config
[auto_config]: https://www.consul.io/docs/agent/config/config-files#auto_config
[agent/consul/auto_config_endpoint.go]: https://github.com/hashicorp/consul/blob/main/agent/consul/auto_config_endpoint.go
[agent/auto-config]: https://github.com/hashicorp/consul/tree/main/agent/auto-config
4 changes: 2 additions & 2 deletions docs/config/checklist-adding-config-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ There are four specific cases covered with increasing complexity:
state for client agent's RPC client.
- [ ] Add a test to `agent/agent_test.go` similar to others with prefix
`TestAgent_reloadConfig*`.
- [ ] Add documentation to `website/content/docs/agent/options.mdx`.
- [ ] Add documentation to `website/content/docs/agent/config/config-files.mdx`.

Done! You can now use your new field in a client agent by accessing
`s.agent.Config.<FieldName>`.
Expand All @@ -75,7 +75,7 @@ If the config field also needs a CLI flag, then follow these steps.
`TestLoad_IntegrationWithFlags` in `agent/config/runtime_test.go` to ensure setting the
flag works.
- [ ] Add flag (as well as config file) documentation to
`website/source/docs/agent/options.html.md`.
`website/source/docs/agent/config/config-files.mdx` and `website/source/docs/agent/config/cli-flags.mdx`.

## Adding a Simple Config Field for Servers
Consul servers have a separate Config struct for reasons. Note that Consul
Expand Down
2 changes: 1 addition & 1 deletion docs/rpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The "RPC Server" accepts requests to the [server port] and routes the requests b
configuration of the Server and the the first byte in the request. The diagram below shows
all the possible routing flows.

[server port]: https://www.consul.io/docs/agent/options#server_rpc_port
[server port]: https://www.consul.io/docs/agent/config/config-files#server_rpc_port

![RPC Routing](./routing.svg)

Expand Down
10 changes: 5 additions & 5 deletions website/content/api-docs/acl/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ the [ACL tutorial](https://learn.hashicorp.com/tutorials/consul/access-control-s
## Bootstrap ACLs

This endpoint does a special one-time bootstrap of the ACL system, making the first
management token if the [`acl.tokens.initial_management`](/docs/agent/options#acl_tokens_initial_management)
management token if the [`acl.tokens.initial_management`](/docs/agent/config/config-files#acl_tokens_initial_management)
configuration entry is not specified in the Consul server configuration and if the
cluster has not been bootstrapped previously. This is available in Consul 0.9.1 and later,
and requires all Consul servers to be upgraded in order to operate.
Expand Down Expand Up @@ -143,7 +143,7 @@ $ curl \

- `SourceDatacenter` - The authoritative ACL datacenter that ACLs are being
replicated from and will match the
[`primary_datacenter`](/docs/agent/options#primary_datacenter) configuration.
[`primary_datacenter`](/docs/agent/config/config-files#primary_datacenter) configuration.

- `ReplicationType` - The type of replication that is currently in use.

Expand Down Expand Up @@ -295,7 +295,7 @@ The table below shows this endpoint's support for

-> **Note** - To use the login process to create tokens in any connected
secondary datacenter, [ACL
replication](/docs/agent/options#acl_enable_token_replication) must be
replication](/docs/agent/config/config-files#acl_enable_token_replication) must be
enabled. Login requires the ability to create local tokens which is restricted
to the primary datacenter and any secondary datacenters with ACL token
replication enabled.
Expand Down Expand Up @@ -425,7 +425,7 @@ The table below shows this endpoint's support for

-> **Note** - To use the login process to create tokens in any connected
secondary datacenter, [ACL
replication](/docs/agent/options#acl_enable_token_replication) must be
replication](/docs/agent/config/config-files#acl_enable_token_replication) must be
enabled. Login requires the ability to create local tokens which is restricted
to the primary datacenter and any secondary datacenters with ACL token
replication enabled.
Expand Down Expand Up @@ -505,7 +505,7 @@ The table below shows this endpoint's support for

-> **Note** - To use the login process to create tokens in any connected
secondary datacenter, [ACL
replication](/docs/agent/options#acl_enable_token_replication) must be
replication](/docs/agent/config/config-files#acl_enable_token_replication) must be
enabled. Login requires the ability to create local tokens which is restricted
to the primary datacenter and any secondary datacenters with ACL token
replication enabled.
Expand Down
20 changes: 10 additions & 10 deletions website/content/api-docs/agent/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ This endpoint instructs the agent to reload its configuration. Any errors
encountered during this process are returned.

Not all configuration options are reloadable. See the
[Reloadable Configuration](/docs/agent/options#reloadable-configuration)
[Reloadable Configuration](/docs/agent/config#reloadable-configuration)
section on the agent options page for details on which options are supported.

| Method | Path | Produces |
Expand Down Expand Up @@ -438,7 +438,7 @@ page.

In order to enable [Prometheus](https://prometheus.io/) support, you need to use the
configuration directive
[`prometheus_retention_time`](/docs/agent/options#telemetry-prometheus_retention_time).
[`prometheus_retention_time`](/docs/agent/config/config-files#telemetry-prometheus_retention_time).

Since Consul 1.7.2 this endpoint will also automatically switch output format if
the request contains an `Accept` header with a compatible MIME type such as
Expand Down Expand Up @@ -743,7 +743,7 @@ $ curl \
This endpoint updates the ACL tokens currently in use by the agent. It can be
used to introduce ACL tokens to the agent for the first time, or to update
tokens that were initially loaded from the agent's configuration. Tokens will be persisted
only if the [`acl.enable_token_persistence`](/docs/agent/options#acl_enable_token_persistence)
only if the [`acl.enable_token_persistence`](/docs/agent/config/config-files#acl_enable_token_persistence)
configuration is `true`. When not being persisted, they will need to be reset if the agent
is restarted.

Expand All @@ -755,9 +755,9 @@ is restarted.
| `PUT` | `/agent/token/replication` | `application/json` |

The paths above correspond to the token names as found in the agent configuration:
[`default`](/docs/agent/options#acl_tokens_default), [`agent`](/docs/agent/options#acl_tokens_agent),
[`agent_recovery`](/docs/agent/options#acl_tokens_agent_recovery), and
[`replication`](/docs/agent/options#acl_tokens_replication).
[`default`](/docs/agent/config/config-files#acl_tokens_default), [`agent`](/docs/agent/config/config-files#acl_tokens_agent),
[`agent_recovery`](/docs/agent/config/config-files#acl_tokens_agent_recovery), and
[`replication`](/docs/agent/config/config-files#acl_tokens_replication).

-> **Deprecation Note:** The following paths were deprecated in version 1.11

Expand All @@ -766,7 +766,7 @@ The paths above correspond to the token names as found in the agent configuratio
| `PUT` | `/agent/token/agent_master` | `application/json` |

The paths above correspond to the token names as found in the agent configuration:
[`agent_master`](/docs/agent/options#acl_tokens_agent_master).
[`agent_master`](/docs/agent/config/config-files#acl_tokens_agent_master).

-> **Deprecation Note:** The following paths were deprecated in version 1.4.3

Expand All @@ -778,9 +778,9 @@ The paths above correspond to the token names as found in the agent configuratio
| `PUT` | `/agent/token/acl_replication_token` | `application/json` |

The paths above correspond to the token names as found in the agent configuration:
[`acl_token`](/docs/agent/options#acl_token_legacy), [`acl_agent_token`](/docs/agent/options#acl_agent_token_legacy),
[`acl_agent_master_token`](/docs/agent/options#acl_agent_master_token_legacy), and
[`acl_replication_token`](/docs/agent/options#acl_replication_token_legacy).
[`acl_token`](/docs/agent/config/config-files#acl_token_legacy), [`acl_agent_token`](/docs/agent/config/config-files#acl_agent_token_legacy),
[`acl_agent_master_token`](/docs/agent/config/config-files#acl_agent_master_token_legacy), and
[`acl_replication_token`](/docs/agent/config/config-files#acl_replication_token_legacy).

The table below shows this endpoint's support for
[blocking queries](/api/features/blocking),
Expand Down
2 changes: 1 addition & 1 deletion website/content/api-docs/config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description: |-

The `/config` endpoints create, update, delete and query central configuration
entries registered with Consul. See the
[agent configuration](/docs/agent/options#enable_central_service_config)
[agent configuration](/docs/agent/config/config-files#enable_central_service_config)
for more information on how to enable this functionality for centrally
configuring services and [configuration entries docs](/docs/agent/config-entries) for a description
of the configuration entries content.
Expand Down
2 changes: 1 addition & 1 deletion website/content/api-docs/connect/intentions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ The corresponding CLI command is [`consul intention create -replace`](/commands/
evaluation. As with L4 intentions, traffic that fails to match any of the
provided permissions in this intention will be subject to the default
intention behavior is defined by the default [ACL
policy](/docs/agent/options#acl_default_policy).
policy](/docs/agent/config/config-files#acl_default_policy).

This should be omitted for an L4 intention as it is mutually exclusive with
the `Action` field.
Expand Down
2 changes: 1 addition & 1 deletion website/content/api-docs/health.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ The table below shows this endpoint's support for
ascending order based on the estimated round trip time from that node. Passing
`?near=_agent` will use the agent's node for the sort. This is specified as
part of the URL as a query parameter. **Note** that using `near` will ignore
[`use_streaming_backend`](/docs/agent/options#use_streaming_backend) and always
[`use_streaming_backend`](/docs/agent/config/config-files#use_streaming_backend) and always
use blocking queries, because the data required to sort the results is not available
to the streaming backend.

Expand Down
4 changes: 2 additions & 2 deletions website/content/api-docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ $ curl \

Consul 0.7 added the ability to translate addresses in HTTP response based on
the configuration setting for
[`translate_wan_addrs`](/docs/agent/options#translate_wan_addrs). In order
[`translate_wan_addrs`](/docs/agent/config/config-files#translate_wan_addrs). In order
to allow clients to know if address translation is in effect, the
`X-Consul-Translate-Addresses` header will be added if translation is enabled,
and will have a value of `true`. If translation is not enabled then this header
Expand All @@ -90,7 +90,7 @@ will not be present.
All API responses for Consul versions after 1.9 will include an HTTP response
header `X-Consul-Default-ACL-Policy` set to either "allow" or "deny" which
mirrors the current value of the agent's
[`acl.default_policy`](/docs/agent/options#acl_default_policy) option.
[`acl.default_policy`](/docs/agent/config/config-files#acl_default_policy) option.

This is also the default [intention](/docs/connect/intentions) enforcement
action if no intention matches.
Expand Down
2 changes: 1 addition & 1 deletion website/content/api-docs/operator/autopilot.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ $ curl \
```

For more information about the Autopilot configuration options, see the
[agent configuration section](/docs/agent/options#autopilot).
[agent configuration section](/docs/agent/config/config-files#autopilot).

## Update Configuration

Expand Down
2 changes: 1 addition & 1 deletion website/content/commands/acl/set-agent-token.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Corresponding HTTP API Endpoint: [\[PUT\] /v1/agent/token/:type](/api-docs/agent
This command updates the ACL tokens currently in use by the agent. It can be used to introduce
ACL tokens to the agent for the first time, or to update tokens that were initially loaded from
the agent's configuration. Tokens are not persisted unless
[`acl.enable_token_persistence`](/docs/agent/options#acl_enable_token_persistence)
[`acl.enable_token_persistence`](/docs/agent/config/config-files#acl_enable_token_persistence)
is `true`, so tokens will need to be updated again if that option is `false` and
the agent is restarted.

Expand Down
2 changes: 1 addition & 1 deletion website/content/commands/config/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Command: `consul config`
The `config` command is used to interact with Consul's central configuration
system. It exposes commands for creating, updating, reading, and deleting
different kinds of config entries. See the
[agent configuration](/docs/agent/options#enable_central_service_config)
[agent configuration](/docs/agent/config/config-files#enable_central_service_config)
for more information on how to enable this functionality for centrally
configuring services and [configuration entries docs](/docs/agent/config-entries) for a description
of the configuration entries content.
Expand Down
2 changes: 1 addition & 1 deletion website/content/commands/connect/envoy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ proxy configuration needed.
be used instead. The scheme can also be set to HTTPS by setting the
environment variable CONSUL_HTTP_SSL=true. This may be a unix domain socket
using `unix:///path/to/socket` if the [agent is configured to
listen](/docs/agent/options#addresses) that way.
listen](/docs/agent/config/config-files#addresses) that way.

-> **Note:** gRPC uses the same TLS
settings as the HTTPS API. If HTTPS is enabled then gRPC will require HTTPS
Expand Down
Loading

0 comments on commit 76d55ac

Please sign in to comment.