Consul
A service networking tool written in Go. It provides service discovery, health checking, a key-value store, ACLs and a service mesh. Maintained by HashiCorp.
Business rules, traced to source lines.
These 12 rules are a sample of the 32,007 CoreStory V3 extracted from Consul. Each one links to the exact lines on GitHub at commit 42686d5. The statement is CoreStory V3’s wording; the code excerpt is the source it cites.
For a one-time ACL bootstrap operation, if a bootstrap index entry already exists, bootstrapping is rejected with ACLBootstrapNotAllowedErr when resetIndex is 0, and rejected with ACLBootstrapInvalidResetIndexErr when resetIndex is not equal to the existing index entry's Value.
- 0 — reset index value that triggers bootstrap not allowed
Deleting an ACL auth method also deletes all binding rules for that method and all tokens linked to that method; aclAuthMethodDeleteTxn calls aclBindingRuleDeleteAllForAuthMethodTxn and aclTokenDeleteAllForAuthMethodTxn before deleting the method.
- global — TokenLocality value compared against "global" when deleting tokens by auth method
When creating a token with an ExpirationTime, the duration until expiration (expiresIn = ExpirationTime - CreateTime) must not exceed MaxExpirationTTL; otherwise creation fails with "ExpirationTime cannot be more than <MaxExpirationTTL> in the future".
Also cited: L41
A parsed session TTL is accepted when it is zero; otherwise it must be at least the server-configured minimum session TTL and at most the maximum session TTL. If a nonzero TTL is outside that inclusive range, Session.Apply returns "Invalid Session TTL '<ttl>', must be between [<min>=<max>]".
- 0 nanoseconds — TTL value exempt from the range check
A resolver's ConnectTimeout is treated as 5 seconds when it is less than 1. If overrideConnectTimeout is greater than 0 and differs from the computed timeout, the timeout is replaced by the override and the ConnectTimeout customization marker is set.
- 1 nanoseconds — lower bound below which the default connect timeout is applied
- 5 seconds — default connect timeout when the resolver timeout is less than one nanosecond
- 0 nanoseconds — override threshold; override is applied only when greater than zero
When EDNS is not in use, CNAME/A/AAAA additional records are limited to at most 5 during FQDN resolution; with EDNS the limit does not apply.
- 5 — maximum recursion records without EDNS
Also cited: L43
flattenChecks starts with api.HealthPassing; while iterating checks, if a check ID equals api.NodeMaint or begins with api.ServiceMaintPrefix, the aggregated status is set to api.HealthMaint and the loop breaks, since maintenance always wins.
Also cited: L680–L686
serviceACLCheckWithConsulExemption enforces ServiceWriteAllowed for the service unless allowConsulExemption is true AND Service.Service equals structs.ConsulServiceName; in that case the early ServiceWriteAllowed check is skipped.
- true — allowConsulExemption value passed by serviceACLCheck
- false — allowConsulExemption value passed by serviceACLCheckNoConsulExemption
Also cited: L278–L284
When getrlimit() succeeds and maxConnsPerClient is greater than 0, the system soft file-descriptor limit must be at least maxConnsPerClient + 20; otherwise an error is returned stating the system's max file descriptors, the configured limits.http_max_conns_per_client, and the required descriptor count. The check is skipped when getrlimit() fails (its error is returned instead) or when maxConnsPerClient is not greater than 0.
- 0 — threshold above which maxConnsPerClient triggers the file-descriptor requirement check
- 20 — additional file descriptors required beyond maxConnsPerClient
Also cited: L12–L13
For any operation other than create, if the existing prepared query has an ACL prefix, the request token must be granted PreparedQueryWriteAllowed on that prefix; otherwise the operation is denied with the ACL error and a warning is logged.
Also cited: L103–L119
For GET /v1/connect/intentions/match, when the request allows stale reads, MaxStaleDuration is greater than 0, and MaxStaleDuration is less than the reply LastContact, the handler disables AllowStale, sets MaxStaleDuration to 0, and retries the RPC exactly once.
- 0 — threshold above which stale duration must be to trigger retry, and value assigned on retry
Checks returned to a token are filtered such that a check with a non-empty ServiceName is retained only if the authorizer returns acl.Allow on ServiceRead for that service name, and a check with an empty ServiceName is retained only if the authorizer returns acl.Allow on NodeRead for the agent's node name; otherwise the check is deleted from the result set.
- acl.Allow — required authorization result to retain a check
What the application does
22 capabilities identified, grouping 231 of the 5,549 distinct features extracted. Most extracted features are not grouped under a capability, so this list is a partial view of the application. These are descriptions, not the cited rules above.
CLI and Command Execution
The command-line interface: command creation, dispatch, flags, help/synopsis, and output formatting.
- CLI Command Execution: Runs a command-line operation from the user with the provided HTTP/UI configuration.
- CLI Command Help: Displays synopsis and help text for commands and their flags through a help command capability.
- CLI Command Invocation: Initialize and run a command-line command with user-supplied arguments and flags.
- CLI Flag Registration: Registering and retrieving command-line flags with typed pointer values for string, int, bool, duration, string slice, and string map options.
- CLI Help Display: Displays usage help, synopsis, and flag/argument descriptions for the command-line tool.
- CLI Help and Synopsis: Displays usage help and synopsis information for the command.
- CLI User Interface: A user-facing command line interface for interacting with commands and subcommands.
- Command Construction: Builds a new command instance from a name, kind, and flags.
- Command Creation: Enables creating a new command instance for later execution.
- Command Execution: Runs commands and supports invoking them with arguments via a runner.
- Command Help & Usage Display: Displays command help, usage, and synopsis information to the user.
- Command Help Display: Displays usage help and synopsis information for a command to the user.
- Command Synopsis: Users can view a concise synopsis describing a command and its usage.
- Command Synopsis Display: Users can view a synopsis of how commands are used.
- Command-Line Command Execution: Creates and runs a command while exposing its metadata, flags, format, and HTTP-related options.
- Command-Line Help: Displays usage information and a synopsis for a command via a help entry point.
- Command-Line Help Display: Prints usage documentation for the command-line tool when requested.
- Help Display: Users can view usage help and synopsis information for the command-line tool.
- Output Format Selection: Users can choose between compact JSON and pretty-printed output formats for rendered results.
Service Registration and Discovery
Catalog registration/deregistration of nodes and services and discovery of healthy service endpoints across datacenters, partitions, and peers.
- Backend Service Discovery: Resolves backend service endpoints via Consul for routing traffic to internal backend instances.
- Catalog Registration and Deregistration: Capability to register and deregister catalog entries.
- Catalog Service Listing: Allows a user or system to retrieve and display a list of services from the catalog, with each entry carrying a service name.
- Catalog Service Registration & Deregistration: Services register themselves into the catalog and can be deregistered, making them discoverable by others.
- Endpoint Discovery: Derives the set of service endpoints (from Consul discovery chains, services, or snapshots) that back a service's routing targets.
- Health Service Node Query: Querying healthy service nodes with support for filtering, blocking queries, distance sorting, check-type selection, and node metadata filtering.
- Node Registration: Register nodes and services into the catalog, including connect-native/proxy registration and forwarding to a leader or remote datacenter.
- Node and Service Registration: Nodes and services can be registered, deregistered, and their health checks managed through the catalog.
- Service Catalog Registration: Register nodes and services into the catalog, including unmanaged proxies and tag override settings.
- Service Deregistration: Allows deregistering a previously registered service instance from the agent.
- Service Deregistration Control: Controls when a service is automatically deregistered after its check becomes critical, via a deregister-critical-service-after setting.
- Service Deregistration and Error Reporting: Services can be removed from agent state with error messages surfaced on removal.
- Service Discovery: Allows reading, writing, and enumerating services and their instances, including prefix queries.
- Service Discovery and Registration: Resolves and manages service nodes and service entries for transaction participants.
- Service Node Discovery: Look up the healthy nodes backing a service, including tag, address, distance, and connect proxy/native variants.
- Service Registration: Allows registering a service instance with the local agent.
- Service Registration and Deregistration: Nodes and services can be registered into or deregistered from the catalog via raft-applied operations.
- Service and Node Registration: Clients can register node services and node definitions, including connect/proxy sidecar, gateway, and expose configuration variants.
- Service and VIP Registration: Enables registration of local and remote services, including VIP-enabled services and upstream intention entries, into the catalog.
Access Control and Authorization
Role-based access control, ACL policies, tokens, roles, binding rules, and authorization enforcement across services, agents, and APIs.
- ACL Auth Method Management: Creation, reading, listing, updating, and deletion of ACL authentication methods.
- ACL Authorization: Read and write access control list policies governing resource permissions.
- ACL Binding Rule Management: Creation, reading, listing, updating, and deletion of ACL binding rules.
- ACL Enforcement: Enforces access control decisions against resources for a given access type, exercised through table-driven test cases covering method, resource, and segment scenarios.
- ACL Enforcement on Agent Operations: Applies ACL policies to authorize or deny agent operations such as registration, checks, queries, and configuration changes.
- ACL Enforcement on Catalog Operations: Authorize catalog read and write operations against ACL policies and tokens.
- ACL Policy Management: Defines, parses, and validates access-control policies that govern read, write, and deny permissions across mesh resource categories.
- ACL Role Management: Creation, reading, listing, updating, and deletion of ACL roles with lookup by ID or name.
- ACL Token Management: Creation, retrieval, listing, deletion, cloning, and updating of ACL tokens.
- Access Control: Enforces request authorization via role-based access control filters within the proxy filter chain.
- Access Control Authorization: Evaluates and enforces ACL-based authorization decisions for read and write operations across resources via an authorizer chain.
- Access Control Enforcement: Enforces role-based authorization policy on network traffic.
- Authorization: Provides authorization decisions by permitting or denying access, including an unrestricted allow policy, a blanket deny policy, and a management capability.
- Authorization Policy Enforcement: Evaluates requests against read/write authorization rules, with allow-all, deny-all, and default-allow policies, and converts policies into authorizers.
- Permission Authorization: Evaluates whether a caller may perform an action by processing an authorization request through the permission adapter.
- RBAC Authorization: Role-based access control enforcement on incoming network connections via the RBAC network filter.
- Role-Based Access Control: Enforces role-based access control policies on incoming requests.
Traffic Management and Routing
HTTP/TCP routing, load balancing, traffic splitting, failover, circuit breaking, outlier detection, retries, and timeouts.
- Circuit Breaking: Configuration of circuit breaker limits that protect services from cascading failures.
- Cluster Configuration: Defines an upstream cluster's load-balancing, discovery, circuit-breaking, and health-checking behavior that a control plane delivers to proxies.
- Connection Timeout Configuration: Allows configuration of connection timeout behavior for targets.
- HTTP Request Routing: Accepts inbound HTTP traffic and routes requests to backend services via configured routes.
- HTTP Route Configuration: Declare and manage HTTP routing rules that match requests by method, path, header, and query and bind them to backend services.
- Load Balancing: Configure load balancing behaviour with panic thresholds and common LB settings.
- Outlier Detection: Ejects unhealthy hosts based on success rate thresholds and panic thresholds to maintain cluster health.
- Outlier Detection / Health Checking: Users enable unhealthy host ejection with success-rate thresholds and healthy panic thresholds.
- Path-Based Request Matching: Routes requests based on exact, prefix, regex, and case-insensitive path rules.
- Request and Response Header Manipulation: Transforms incoming request headers and outgoing response headers during routing.
- Request/Response Header Manipulation: Allows modification of request and response headers as traffic flows through the proxy.
- Retry Policy Configuration: Users configure retry behavior including retry count, backoff parameters, and base/max intervals.
- Service Failover: Configures failover targets and policies so requests to an unhealthy subset or datacenter are redirected to healthy targets.
- TCP Proxying: Forwards raw TCP connections to upstream services.
- TCP Route Configuration: Declare and manage TCP routing entries that forward raw TCP traffic to backend services.
- Timeout Configuration: Configure request and idle timeouts for routed traffic.
- Traffic Splitting: Splits a service's traffic across weighted subsets to support canary and gradual rollout scenarios.
Authentication and Session Management
User and service login/logout, OIDC/OAuth, JWT and token-based authentication, and session lifecycle.
- ACL Login: Authenticate against the ACL system by supplying datacenter, auth method, bearer token, namespace, partition, and meta, receiving a login token alongside accessor and secret identifiers.
- ACL Login and Logout: Authenticate to and de-authenticate from the ACL system via the gRPC interface.
- Authentication: Authenticates incoming requests using a configured auth method.
- Authentication & Session: Users can log in and log out, with logged-in/logged-out states and error handling surfaced through the UI.
- Enterprise SSO Authentication: Authenticates enterprise users via SSO claims and applies the enterprise-specific configuration associated with the authenticated identity.
- JWT Authentication: Validates incoming requests by verifying JWTs against local or remote JWKS sources with configurable TLS and retry behavior.
- Login and Logout: Authenticate a session and terminate it.
- OIDC Authentication: Authenticates users through an OpenID Connect flow, including handling of authentication failures.
- OIDC Logout: Handles OpenID Connect logout by redirecting to the provider's logout URL and permitted post-logout redirect URIs.
- OpenID Connect Authentication: Authenticates users via an OpenID Connect provider and validates post-authentication redirects.
- OpenID Connect Login: Initiates an OIDC authorization flow by generating the auth code URL with state and nonce, and exchanges the returned auth code for verified identity claims.
- Session Lifecycle Management: Create, retrieve, list, and destroy user sessions in the state store.
- Session Management: Read and write operations for sessions.
- Token Authentication: Supplies and manages authentication tokens, either inline or loaded from a token file.
- User Login: Authenticates a user and produces a login identity along with an authentication token for the verified identity.
- User Logout: Ends an active user session and resets associated session state.
Service Mesh and Connect
Connect-based service mesh connectivity, sidecar proxies, intentions, transparent proxy, and mesh-wide configuration.
- Connect: A user-facing connection capability that establishes a connection to a named service on a given port, identified by id.
- Connect Intentions: Access control between services via intentions and permission rules.
- Connect Service Discovery: Queries can be scoped to Connect-enabled service discovery, resolving proxy targets for service mesh lookup.
- Connect Service Proxy: Configure a Connect-enabled service proxy that routes traffic to a backend service destination.
- Connection Establishment: Establishes connectivity for an agent using its identity and location context.
- Intention Management: Read and write operations for service intentions, including default allow behavior.
- Mesh Configuration: Allows reading and writing mesh-wide configuration.
- Service Connect Proxy: Associate a Connect service mesh proxy with a service registration.
- Service Intention Management: Operators can create, update, and delete service intentions governing connection authorization.
- Service Intentions: Users define service-to-service authorization intentions with HTTP and JWT permissions.
- Service Mesh (Connect): Agents support service mesh connectivity through Connect configuration, proxies, upstreams, and transparent proxy settings.
- Service Mesh Configuration: Provides Envoy/xDS cluster, endpoint, load-balancing, and transport-socket configuration for service mesh proxies.
- Service Mesh Connectivity: Connect-enabled service mesh configuration including intentions and mTLS settings.
- Sidecar Proxy Registration: Register a sidecar proxy alongside a service, optionally as a managed web proxy.
- Transparent Proxy: Enables and configures transparent proxy behavior for services in the mesh, including routing outgoing and incoming traffic through the proxy.
Certificate Authority and TLS
CA initialization, root rotation, cross-signing, certificate issuance/signing, and TLS/mTLS configuration for secure transport.
- Automatic TLS Certificate Management: Automatically encrypt and issue certificates, including auto-TLS CA/cert updates and selecting between automatic and manually supplied certificates.
- CA Root Certificate Management: Retrieves and updates the set of trusted CA root certificates.
- CA Root Management: Create, read, and persist certificate authority roots and root lists.
- Certificate Authority Management: Server initializes, renews, and signs leaf/intermediate certificates, and roots-monitor watches for CA changes.
- Certificate Authority Operations: Issue certificates and expose CA roots so components can establish mutually authenticated TLS connections.
- Certificate Authority Root Management: Manage CA root sets and active-root selection, including empty IDs, multiple active roots, no active root, and snapshot/restore.
- Certificate Cross-Signing: Cross-sign CA certificates and sign intermediates to establish trusted CA trust relationships.
- Certificate Signing: Sign certificates using an active CA signing certificate.
- Connect CA Configuration: Configures Connect certificate authority settings such as certificate lifetimes, allowed SANs, and authentication methods.
- Connect CA Root Rotation: Triggers Connect CA root certificate rotation, including secondary datacenter updates and Vault-backed rotation.
- Leaf Certificate Issuance: Issue and validate leaf certificates, including namespace and identity variants.
- Mutual TLS Configuration: Configure TLS certificates, private keys, trusted CAs, SNI, and subject alt name matching for secure connections.
- TLS Certificate Management: Manages leaf certificates and TLS configuration for secure connections.
Configuration Entry Management
CRUD, validation, replication, and watching of Consul config entries (service-defaults, proxy-defaults, mesh, routers, resolvers, etc.).
- Config Entry Listing: Displays and refreshes a list of configuration entries filtered by enterprise metadata.
- Config Entry Management: Create, read, update, and delete Consul config entries through the API, including CAS-based updates.
- Config Entry Replication: Replicates configuration entries between datacenters with rate limiting.
- Config Entry Subscription: Clients can subscribe to and receive streaming updates (upserts and deletions) for named configuration entries identified by kind, name, namespace, partition, and enterprise metadata.
- Config Entry Validation: Validate proposed config entries against the service graph for correctness, references, and protocol consistency.
- Configuration Entry CRUD: Users and systems can create, read, update, and delete centralized configuration entries through the config entry API.
- Configuration Entry Listing and Filtering: Clients can enumerate configuration entries, optionally filtered by kind, with blocking support for changes.
- Configuration Entry Management: Users can create, read, update, and delete configuration entries exposed through an API.
- Exported Services Configuration: Management of configuration entries that declare which services are exported.
- Proxy Defaults Configuration: Configure global proxy behavior such as access logs, transparent proxying, expose paths, and mesh gateway mode.
- Sameness Group Configuration: Resolves and retrieves the effective configuration of a named sameness group, including any partition or namespace overrides.
- Service Defaults Configuration: Define service-level default behavior including proxy mode, protocol, mutual TLS, and upstream defaults.
- Watch Configuration Entries: Clients can subscribe to changes in Consul configuration entries such as service defaults, intentions, and mesh config, receiving updates as they occur.
Streaming, Events, and xDS Delivery
Event subscription/streaming, resource watching, delta/full xDS configuration delivery, and nonce/version tracking to clients.
- Delta xDS Resource Delivery (v3): Streaming of incremental xDS resource updates to Envoy clients over delta aggregated discovery service, covering acknowledgements, nacks, stream draining, and cluster/listener change propagation.
- Dynamic Configuration Versioning: Tracks and delivers versioned configuration updates with nonces and resource type URLs for dynamic xDS-based reconfiguration.
- Event Publish/Subscribe: A messaging capability allowing producers to publish events and consumers to subscribe and register handlers for them.
- Event Stream: Supports reading and writing events published to the agent's event stream.
- Event Subscription: Clients can subscribe to a topic to receive a stream of published events, optionally resuming from a given snapshot index.
- Event Subscription / Streaming: Clients can subscribe to topics and receive streaming events, including framing events that delimit snapshots and payload batches.
- Resource Watch Streaming: Clients can open a streaming watch on resources and exchange messages over the bidirectional gRPC stream.
- Resource Watching: A user can watch cluster resources for changes, either via a CLI watch handler or an HTTP endpoint.
- Stream Consul Events: Clients can subscribe to streams of events and receive batches with snapshot boundaries and indexing information.
- xDS Config Distribution: Delivers versioned, typed configuration resources to clients via an xDS control-plane protocol.
- xDS Configuration Delivery: Delivery of versioned configuration resources to clients via nonce- and version-tracked xDS updates.
- xDS Configuration Distribution: Delivers versioned, nonce-tracked xDS resources to proxies and supports acknowledged configuration updates.
- xDS Resource Delivery: Receive and apply versioned xDS configuration resources including ADS streams and typed configs.
Feature Gates, Versioning, and Enablement
Feature gate registration/state resolution, version detection and comparison, licensing, and enterprise enablement.
- Enterprise Edition Detection: Detects whether the deployment is the enterprise edition to select edition-specific images.
- Enterprise Licensing: Initialization and validation of enterprise licensing that gates enterprise-only capabilities.
- Feature Gate Configuration: Provides get and set operations to read and modify feature gate values, allowing a user or system to toggle capabilities.
- Feature Gate Management: Allows users to view and update feature gate policies and their rollout statuses.
- Feature Gate Status Reporting: The gate exposes status per feature with a defined status index and setting source provenance (bootstrap vs operator).
- Feature Gate Status Resolution: Resolves and exposes the current status of a named feature gate so a user or system can observe whether a capability is enabled or disabled.
- Feature Gate Toggling: Operators can enable or disable feature gates across the cluster.
- Feature Gate Update: Capability to set or modify a feature gate's state with compare-and-swap consistency and idempotent no-op handling, returning a committed response.
- Feature Gates: Enables toggling experimental or staged capabilities via named feature gates.
- License Management: Supports enterprise licensing and related enterprise configuration fields.
- Version Comparison: Determines version ordering and semantic-version validity to drive image and sidecar selection.
- Version and Type Introspection: Exposes Envoy version and registered type URL metadata to clients and operators.
Health Checking and Monitoring
Definition, registration, and reporting of health checks for nodes, services, and proxies, plus health status monitoring.
- Agent Health Check Management: Create, update, and monitor TTL-based health checks and persist their state.
- Check Status Transition Management: Evaluate consecutive check outcomes against thresholds to transition status, reset counters, and handle flapping.
- Health Check Execution: Executes health checks including script and TCP checks with arguments, intervals, timeouts, and status reporting.
- Health Check Management: Registers, deregisters, and updates health checks with passing/warning/failing states, including script, UDP, and scripted check execution controls.
- Health Check Registration: Allows registering health checks associated with a service or node.
- Health Status Reporting: Report the health state of discovered service instances to consumers.
- Monitor Service Health: Clients can subscribe to health status updates of services and their instances, including connect-enabled services.
- Node Health Checks: Query the health status of individual nodes, supporting ACL filtering and node metadata filters.
- Proxy Health Monitoring: Verifies that service mesh proxies for each service are healthy, with admin endpoints reachable and listeners serving the correct TLS certificates.
- Service Health Check: Capability to check and report the health status of client and server components via a health request.
- Service Health Check Registration: Defines and registers health checks for services using pluggable protocols (HTTP, TCP, UDP, gRPC, H2 ping) with intervals, timeouts, and TLS options.
- Service Health Monitoring: Exposes the health status and version of discovered service instances so clients can observe cluster and endpoint availability.
Key-Value Store
Read, write, list, delete, CAS, transactions, locks, and sessions over the distributed key-value store.
- Compare-And-Swap Operations: Clients can perform atomic check-and-set and check-and-delete conditional mutations on CAS-guarded values.
- Distributed Lock: Acquire, hold, and release a named lock with configurable wait, retry, and TTL semantics.
- KVS Apply (Write): Apply mutations to the key-value store with ACL enforcement and lock-delay semantics.
- KVS Read (Get): Read a value from the key-value store with ACL-based access control.
- Key-Value Storage: Store, retrieve, and delete key-value pairs in a namespaced/partitioned KV store.
- Key-Value Storage Operations: Clients can read, write, and delete entries in the key-value store through the KVS endpoint and its get/put/delete/get-keys operations.
- Key-Value Store: Users can read, write, delete, lock, and atomically modify entries in the Consul KV store.
- Key-Value Store Operations: Read and write operations against keys in the key-value store, returning their results within a transaction response.
- Key/Value Store Access: Read and write access to the key-value store including prefix operations.
- Multi-Operation Transactions: Clients can submit batched transactions applying multiple catalog operations atomically.
- Session Management: Read and write operations for sessions.
- Transaction Application: Apply a transaction to the store, vetting it against validation checks before committing.
Observability and Telemetry
Metrics, stats sinks, access logging, distributed tracing, and audit logging for monitoring the system and mesh.
- Access Logging: Emits and serves HTTP access logs in configurable formats to a chosen output destination.
- Agent Metrics Scraping: The agent exposes Prometheus metrics that can be scraped and asserted on, covering sub-systems such as RPC, TLS certificate expiry, leadership, leaf certs, WAL, Consul autopilot, and log verification.
- Audit Logging: Records security-relevant audit events for compliance and monitoring.
- Distributed Request Tracing: Collects and exports distributed tracing spans to an observability collector.
- Distributed Tracing: Configure request tracing with random sampling and header-based client trace propagation.
- Metrics Provider Configuration: Configure the metrics provider and its files/options for the running instance.
- Metrics and Telemetry Reporting: Reports operational metrics via multiple providers and destinations including StatsD, Dogstatsd, Circonus, and Prometheus.
- Observability and Telemetry: Agents emit metrics, logs, and telemetry to syslog and configured sinks, with adjustable log levels and formats.
- Prometheus Metrics Export: Collects and exposes Envoy statistics in Prometheus scrape format.
- Statistics Configuration: Configure stats tags, sinks, and match rules that control which statistics are emitted and how they are labeled.
- Stats Configuration: Configures metrics/statistics collection behavior for the proxy.
- Telemetry Metrics Emission: Emit and configure telemetry metrics across multiple backends with filtering, prefixes, and host/tenancy controls.
Snapshots and Backup/Restore
Capturing, saving, verifying, and restoring full or partial state snapshots of the system.
- ACL State Snapshot and Restore: Snapshot and restore ACL policies, roles, tokens, binding rules, and auth methods as a whole.
- Autopilot State Snapshot & Restore: Captures and restores autopilot state snapshots, allowing state to be saved and recovered later.
- Backup Snapshot and Restore: Operators can snapshot and restore the store's state.
- Consul State Snapshot Persistence: Persists the full Consul agent state (services, nodes, ACLs, config entries, peerings, sessions, and more) into a snapshot.
- Consul State Snapshot Restore: Restores the full Consul agent state (services, nodes, ACLs, config entries, peerings, sessions, and more) from a snapshot.
- Snapshot Operations: Save and restore cluster snapshots.
- Snapshot Restore: Restores system state from a previously saved snapshot via the snapshot restore operation.
- Snapshot Save: Captures and persists the current system state as a snapshot for later retrieval.
- Snapshot Verification: Verify the integrity of a snapshot.
- Snapshot and Restore: Creates and manages cluster state snapshots with configurable retention.
- State Snapshot & Restore: Capture the current finite-state-machine state into a snapshot and restore it later (including read/apply of snapshots).
- State Snapshot and Restore: Captures and restores the key-value store state, including tombstone state.
Cluster Membership and Federation
LAN/WAN gossip membership, joining and leaving clusters, Raft consensus and leadership, and WAN federation across datacenters.
- Agent Cluster Membership: Operations to join, leave, force-leave, and inspect cluster members of the Consul agent.
- Cluster Join: Nodes join an existing cluster by attempting to join one or more known addresses with a retry loop.
- Cluster Membership Management: Joins agents to LAN/WAN clusters, leaves the cluster, and queries cluster members.
- Cluster Membership and Federation: Servers join WAN/LAN gossip pools, track LAN/WAN members, and manage node leave/removal across the cluster.
- Consul Server Join and Leave: Servers can join an existing Consul cluster or be removed from it, with membership reconciliation.
- LAN Cluster Membership Management: Agents join, track, and leave a LAN gossip cluster, exposing the current member set and per-segment membership.
- LAN Membership Management: Agents can join and leave a local area network and query the current set of LAN members, including per-partition membership.
- Leader Election: Determines and exposes which server in the cluster is the current leader and tracks the last contact time with it.
- Raft Consensus: Replicated state machine applying commands through Raft consensus with leader-change handling.
- Raft Leadership and Consistency: The store exposes leader election status and enforces strong consistency requirements for reads.
- WAN Federation: Enables peering and federation of clusters across wide-area networks, including secondary datacenter setup and connectivity services.
Cluster Peering and Cross-Cluster Connectivity
Establishing peerings between clusters, exchanging tokens/trust bundles, and routing services across peered clusters.
- Cluster Peering: Establishes connectivity between two clusters so upstream services can reach peers across clusters.
- Cluster Peering Establishment: Capability to establish and register peerings with remote clusters, including dialing target peers and writing peering records.
- Cluster Peering Management: Operators can establish, terminate, and manage peering relationships, secrets, and trust bundles.
- Cross-Cluster Connectivity: Enables upstream services in one cluster to connect to services in another cluster over HTTP.
- Cross-Datacenter Peer Address Resolution: Resolves peer server addresses, optionally through mesh gateways, to reach services in peered datacenters.
- Exported Services: Configuration controlling which services are exported beyond their owning partition or peer.
- Peered Service Discovery: Enables clients to list exported services and discover upstreams across peered clusters with ACL enforcement.
- Peering Establishment: Establish and maintain stream-based peerings between clusters, including fast connection retries and backoff.
- Peering Management: Read and write operations for cluster peerings.
- Peering Token Generation: Generate tokens used to establish a peering connection with another party.
- Peering Trust Bundle Management: Users write and manage the trust bundle used to validate certificates for a peering.
DNS Interface and Service Resolution
Serving DNS queries for service and node discovery, recursors, EDNS, and DNS-based resolution for mesh endpoints.
- Agent DNS Query Serving: Answer DNS queries for service and node lookups from the agent.
- Consul DNS Service Discovery: Exposes federation and service endpoints as resolvable DNS names under Consul's internal domain for a given datacenter and trust domain.
- DNS Interface: Agents serve DNS queries for service discovery with configurable recursors, timeouts, and node naming.
- DNS Node Lookup: Resolve DNS records (address, CNAME, TXT, ANY) for a node/name, with TTL and case-insensitive/period-terminated name handling.
- DNS Query Serving: Serves DNS queries over UDP/TCP with truncation and response trimming.
- DNS Recursion: Recursively resolves queries not answerable locally via a configured recursor.
- DNS Resolution: Resolves DNS queries for address, alias, and service records, including A/AAAA/CNAME/TXT lookups with alternate-domain and recursion handling.
- DNS Service Discovery: Resolves cluster endpoints through DNS with configurable lookup family and refresh interval.
- DNS Service Lookup: Resolve Consul services and prepared queries via DNS, including A, SRV, CNAME, and TXT records with filtering, tagging, and health-based selection.
- DNS TTL Configuration: Allows tuning DNS response TTL and refresh intervals for service discovery.
- DNS-Based Service Discovery: Exposes named service records that resolve external clients and internal services to mesh endpoints.
Gateways (API, Ingress, Terminating, Mesh)
API, ingress, terminating, and mesh gateways with listeners, routes, TLS, and external authorization for north-south and cross-network traffic.
- API Gateway Configuration: Enables users to define and observe API gateway routing and listener configuration (HTTP and TCP) together with its bound gateway state.
- API Gateway Management: Configuration and routes for API gateways, ingress and terminating gateways, and inference gateways in the mesh.
- External Authorization: Determines whether a request can be authorized via an external authz service at the API gateway.
- External Authorization (ExtAuthz): The ExtAuthz capability lets a request's authorization be delegated to an external authorization service, gated by whether the target API gateway/proxy type supports it.
- Gateway Management: Users manage mesh, ingress, terminating, and API gateways including destination services and address bindings.
- Gateway Route Configuration: Define HTTP and TCP routes on a gateway, optionally consolidating HTTP routes into shared rules.
- Gateway TLS Configuration: Users can configure TLS settings, including SDS-based certificate delivery, for gateways.
- Ingress Gateway Configuration: Lets users configure ingress gateway behavior for north-south traffic into the mesh.
- Mesh Gateway Configuration: Configures mesh gateway behavior from configuration values.
- Mesh Gateway Connectivity: Provides the gateway path between clusters that must be reachable for cross-cluster traffic to flow.
- Terminating Gateway Configuration: Configure terminating gateways that provide access to external and destination services.
Agent Lifecycle and Configuration
Starting/stopping agents, runtime configuration loading and reload, auto-config, and join/leave behavior.
- Agent Configuration: Agents are configured through a rich set of address, identity, port, and operational settings that define how they run and join the network.
- Agent Configuration Reload: Reload the agent's configuration at runtime and revert to static configuration on failure.
- Agent Lifecycle Management: Agents can be shut down, reloaded with new configuration, and have failed nodes removed from the cluster.
- Agent Reload: Allows triggering the agent to reload its configuration.
- Agent Run Lifecycle Management: Start, execute, and gracefully stop a long-running agent process with configurable client, logger, and HCLog setup.
- Agent Self Report: Reports the local agent's own identity, addresses, ports, TLS settings, and proxy configuration.
- Agent Start/Stop Lifecycle: The agent can be started and stopped, including multiple start/stop cycles.
- Auto Configuration: Retrieves agent configuration automatically from a server using an intro token.
- Configuration Loading: Loads the service configuration from an external source so startup can pick up its initial settings.
- Configuration Loading and Reloading: Initializes and merges configuration from files and supports reloadable configuration values at runtime.
Build, Packaging, and Release
Building binaries and container images, generating code, signing artifacts, and driving release/promotion workflows.
- Binary Build: Builds the project binary using the configured Go toolchain and architecture.
- Build Automation: Provides a suite of make targets for compiling binaries, images, and generated artifacts across Go, proto, and UI codebases.
- CI Build Artifact Generation: A continuous integration feature that builds project artifacts across compute sizes and produces artifact containers.
- Code Generation: Generates proto stubs, mocks, and regenerated UI/codegen artifacts used by the codebase.
- Container Image Build: Builds the product's container images across multiple base images and platforms.
- Protobuf Code Generation: Generate protobuf source/rate-limit artifacts and post-process the generated code from a script entrypoint.
- Release Build: Builds release artifacts from the source directory.
- Release Promotion: Promotes builds through staging and production environments, including Docker and packaging variants.
- Release Signing: Cryptographically signs release artifacts using a GPG key.
- Release Tagging: Creates version control tags marking the release version.
Testing and CI Infrastructure
Test authoring, execution, assertions, mocking, coverage, and CI workflow automation for the codebase.
- Application Development and Testing Workflow: A collection of npm scripts that let developers build, run, lint, format, and test the application across local development, CI, staging, and end-to-end scenarios.
- CI Job Execution: Runs the project's test and setup jobs within a CI environment.
- Code Coverage Reporting: Computes and reports code coverage information for analyzed projects.
- Coverage Reporting: Collects and reports test coverage for the codebase.
- Expectation-Based Mocking: A test-mock capability that lets users declare expected calls, run them with arguments, and assert the expected returns.
- Golden Test Case Generation: A collection of functions that build golden test case fixtures for many Consul networking features so behavior can be verified against expected outputs.
- Test Assertions: A set of assertion helpers that let a test author check containment, equality, and element matching against expected values.
- Test Case Execution: Run table-driven sets of test cases to exercise command features.
- Test Execution: Runs unit, race, internal, module, and compatibility integration test suites, including deployer and metrics integration tests.
- Test Lifecycle Setup and Teardown: Coordinates global, suite, and test-level setup and teardown including working-directory initialization and cleanup.
Prepared Queries
Creating, storing, explaining, and executing reusable parameterized prepared queries with failover across datacenters.
- Prepared Queries: Defines named, parameterized DNS/service lookup templates that clients can execute by name.
- Prepared Query Execution: Servers can create, read, list, apply, explain, and execute prepared queries, including forwarding to a leader when required.
- Prepared Query Explain: Enables users to inspect the plan/explanation of a prepared query without running it.
- Prepared Query Failover: The system can create a prepared query and transparently fail it over to peer or target data centers with zero, one, or two failovers while remaining available.
- Prepared Query Management: Read and write operations for prepared queries.
- Prepared Query Registry: Prepared queries are stored and indexed in the catalog so they can be listed, retrieved by ID or name, and executed.
- Query Failover Across Datacenters: Prepared query execution can fail over to alternate or sameness-group datacenters when local nodes are unavailable.
What was analyzed
- Go · 2,474 files · 609,780 lines
- JavaScript · 1,156 files · 66,616 lines
- SCSS · 2,549 files · 53,205 lines
- YAML · 77 files · 20,972 lines
- Handlebars · 302 files · 17,858 lines
- Text · 1,363 files · 17,252 lines
- JSON · 38 files · 15,422 lines
- Markdown · 173 files · 15,322 lines
- Bourne Shell · 214 files · 9,768 lines
- SVG · 5 files · 8,457 lines
- Cucumber · 102 files · 5,562 lines
- Other (10 languages) · 197 files · 9,182 lines
Whole repository: 11,536 files. cloc 2.06 counts 849,396 lines of code in 8,650 of them (1,075,313 lines with comments and blanks).
Where this came from
Extracted by CoreStory V3 (build 4470 with two small engine fixes) using DeepSeek-V4.1-Flash from the public repository at commit 42686d5 on 2026-11-15. Capability descriptions are from the same run.
- Repository hashicorp/consul
- Commit 42686d513c56de628fcdcbeb8673ff3ae9a607c5
- Line counts cloc 2.06
- Rule citations Each rule shown was checked: its quote was compared with the repository source at the cited lines at this commit.
Code excerpts are from the upstream repository and remain under its BSL 1.1 (source-available) license. CoreStory is not affiliated with or endorsed by HashiCorp.
Want this for your own codebase?
Talk to us about mapping the business rules in your repositories.