-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com> Co-authored-by: Mischa Thompson <mischabear@gmail.com> Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>
- Loading branch information
1 parent
86e6378
commit faa3cb6
Showing
11 changed files
with
752 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
--- | ||
aliases: | ||
- /docs/grafana-cloud/agent/flow/reference/config-blocks/remotecfg/ | ||
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/reference/config-blocks/remotecfg/ | ||
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/reference/config-blocks/remotecfg/ | ||
- /docs/grafana-cloud/send-data/agent/flow/reference/config-blocks/remotecfg/ | ||
canonical: remotecfgs://grafana.com/docs/agent/latest/flow/reference/config-blocks/remotecfg/ | ||
description: Learn about the remotecfg configuration block | ||
menuTitle: remotecfg | ||
title: remotecfg block | ||
--- | ||
|
||
# remotecfg block | ||
|
||
`remotecfg` is an optional configuration block that enables {{< param "PRODUCT_NAME" >}} | ||
to fetch and load the configuration from a remote endpoint. | ||
`remotecfg` is specified without a label and can only be provided once per | ||
configuration file. | ||
|
||
The [API definition][] for managing and fetching configuration that the | ||
`remotecfg` block uses is available under the Apache 2.0 license. | ||
|
||
[API definition]: https://github.com/grafana/agent-remote-config | ||
|
||
## Example | ||
|
||
```river | ||
remotecfg { | ||
url = "SERVICE_URL" | ||
basic_auth { | ||
username = "USERNAME" | ||
password_file = "PASSWORD_FILE" | ||
} | ||
id = constants.hostname | ||
metadata = {"cluster" = "dev", "namespace" = "otlp-dev"} | ||
poll_frequency = "5m" | ||
} | ||
``` | ||
|
||
## Arguments | ||
|
||
The following arguments are supported: | ||
|
||
Name | Type | Description | Default | Required | ||
-----------------|----------------------|---------------------------------------------------|-------------|--------- | ||
`url` | `string` | The address of the API to poll for configuration. | `""` | no | ||
`id` | `string` | A self-reported ID. | `see below` | no | ||
`metadata` | `map(string)` | A set of self-reported metadata. | `{}` | no | ||
`poll_frequency` | `duration` | How often to poll the API for new configuration. | `"1m"` | no | ||
|
||
If the `url` is not set, then the service block is a no-op. | ||
|
||
If not set, the self-reported `id` that the Agent uses is a randomly generated, | ||
anonymous unique ID (UUID) that is stored as an `agent_seed.json` file in the | ||
Agent's storage path so that it can persist across restarts. | ||
|
||
The `id` and `metadata` fields are used in the periodic request sent to the | ||
remote endpoint so that the API can decide what configuration to serve. | ||
|
||
## Blocks | ||
|
||
The following blocks are supported inside the definition of `remotecfg`: | ||
|
||
Hierarchy | Block | Description | Required | ||
--------- | ----- | ----------- | -------- | ||
basic_auth | [basic_auth][] | Configure basic_auth for authenticating to the endpoint. | no | ||
authorization | [authorization][] | Configure generic authorization to the endpoint. | no | ||
oauth2 | [oauth2][] | Configure OAuth2 for authenticating to the endpoint. | no | ||
oauth2 > tls_config | [tls_config][] | Configure TLS settings for connecting to the endpoint. | no | ||
tls_config | [tls_config][] | Configure TLS settings for connecting to the endpoint. | no | ||
|
||
The `>` symbol indicates deeper levels of nesting. For example, | ||
`oauth2 > tls_config` refers to a `tls_config` block defined inside | ||
an `oauth2` block. | ||
|
||
[basic_auth]: #basic_auth-block | ||
[authorization]: #authorization-block | ||
[oauth2]: #oauth2-block | ||
[tls_config]: #tls_config-block | ||
|
||
### basic_auth block | ||
|
||
{{< docs/shared lookup="flow/reference/components/basic-auth-block.md" source="agent" version="<AGENT_VERSION>" >}} | ||
|
||
### authorization block | ||
|
||
{{< docs/shared lookup="flow/reference/components/authorization-block.md" source="agent" version="<AGENT_VERSION>" >}} | ||
|
||
### oauth2 block | ||
|
||
{{< docs/shared lookup="flow/reference/components/oauth2-block.md" source="agent" version="<AGENT_VERSION>" >}} | ||
|
||
### tls_config block | ||
|
||
{{< docs/shared lookup="flow/reference/components/tls-config-block.md" source="agent" version="<AGENT_VERSION>" >}} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package remotecfg | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
|
||
"connectrpc.com/connect" | ||
agentv1 "github.com/grafana/agent-remote-config/api/gen/proto/go/agent/v1" | ||
) | ||
|
||
type noopClient struct{} | ||
|
||
// GetConfig returns the agent's configuration. | ||
func (c noopClient) GetConfig(context.Context, *connect.Request[agentv1.GetConfigRequest]) (*connect.Response[agentv1.GetConfigResponse], error) { | ||
return nil, errors.New("noop client") | ||
} | ||
|
||
// GetAgent returns information about the agent. | ||
func (c noopClient) GetAgent(context.Context, *connect.Request[agentv1.GetAgentRequest]) (*connect.Response[agentv1.Agent], error) { | ||
return nil, errors.New("noop client") | ||
} | ||
|
||
// ListAgents returns information about all agents. | ||
func (c noopClient) ListAgents(context.Context, *connect.Request[agentv1.ListAgentsRequest]) (*connect.Response[agentv1.Agents], error) { | ||
return nil, errors.New("noop client") | ||
} | ||
|
||
// CreateAgent registers a new agent. | ||
func (c noopClient) CreateAgent(context.Context, *connect.Request[agentv1.CreateAgentRequest]) (*connect.Response[agentv1.Agent], error) { | ||
return nil, errors.New("noop client") | ||
} | ||
|
||
// UpdateAgent updates an existing agent. | ||
func (c noopClient) UpdateAgent(context.Context, *connect.Request[agentv1.UpdateAgentRequest]) (*connect.Response[agentv1.Agent], error) { | ||
return nil, errors.New("noop client") | ||
} | ||
|
||
// DeleteAgent deletes an existing agent. | ||
func (c noopClient) DeleteAgent(context.Context, *connect.Request[agentv1.DeleteAgentRequest]) (*connect.Response[agentv1.DeleteAgentResponse], error) { | ||
return nil, errors.New("noop client") | ||
} |
Oops, something went wrong.