Skip to content

[f5cloudexporter] Updated for upcoming client auth extension changes #3509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

## 🛑 Breaking changes 🛑

- `f5cloud` exporter (#3509):
- Renamed the config 'auth' field to 'f5cloud_auth'. This will prevent a config field name collision when [Support for Custom Exporter Authenticators as Extensions](https://github.com/open-telemetry/opentelemetry-collector/pull/3128) is ready to be integrated.

## v0.27.0

# 🎉 OpenTelemetry Collector Contrib v0.27.0 (Beta) 🎉
Expand Down
6 changes: 3 additions & 3 deletions exporter/f5cloudexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ The following settings are required:
- `endpoint` (no default): The URL to send data to. See your F5 Cloud account for details.
- `source` (no default): A unique identifier that is used to distinguish where this data is coming from (e.g. dev_cluster). This is in
addition to the pipeline attributes and resources.
- `auth.credential_file` (no default): Path to the credential file used to authenticate this client. See your F5
- `f5cloud_auth.credential_file` (no default): Path to the credential file used to authenticate this client. See your F5
Cloud account for details.

The following settings can be optionally configured:

- `auth.audience` (no default): Identifies the recipient that the authentication JWT is intended for. See your F5 Cloud
- `f5cloud_auth.audience` (no default): Identifies the recipient that the authentication JWT is intended for. See your F5 Cloud
account for details.

- `timeout` (default = 30s): HTTP request time limit. For details see https://golang.org/pkg/net/http/#Client
Expand All @@ -31,7 +31,7 @@ Example:
f5cloud:
endpoint: https://<ENDPOINT_FOUND_IN_F5_CLOUD_PORTAL>
source: prod
auth:
f5cloud_auth:
credential_file: "/etc/creds/key.json"
```

Expand Down
6 changes: 3 additions & 3 deletions exporter/f5cloudexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Config struct {
Source string `mapstructure:"source"`

// AuthConfig represents the F5 Cloud authentication configuration options.
AuthConfig AuthConfig `mapstructure:"auth"`
AuthConfig AuthConfig `mapstructure:"f5cloud_auth"`
}

func (c *Config) sanitize() error {
Expand All @@ -49,11 +49,11 @@ func (c *Config) sanitize() error {
}

if len(c.AuthConfig.CredentialFile) == 0 {
return fmt.Errorf("missing required \"auth.credential_file\" setting")
return fmt.Errorf("missing required \"f5cloud_auth.credential_file\" setting")
}

if _, err := os.Stat(c.AuthConfig.CredentialFile); os.IsNotExist(err) {
return fmt.Errorf("the provided \"auth.credential_file\" does not exist")
return fmt.Errorf("the provided \"f5cloud_auth.credential_file\" does not exist")
}

if len(c.AuthConfig.Audience) == 0 {
Expand Down
4 changes: 2 additions & 2 deletions exporter/f5cloudexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func TestConfig_sanitize(t *testing.T) {
Source: validSource,
CredentialFile: "",
},
errorMessage: "missing required \"auth.credential_file\" setting",
errorMessage: "missing required \"f5cloud_auth.credential_file\" setting",
shouldError: true,
},
{
Expand All @@ -129,7 +129,7 @@ func TestConfig_sanitize(t *testing.T) {
Source: validSource,
CredentialFile: "non-existent cred file",
},
errorMessage: "the provided \"auth.credential_file\" does not exist",
errorMessage: "the provided \"f5cloud_auth.credential_file\" does not exist",
shouldError: true,
},
{
Expand Down
4 changes: 2 additions & 2 deletions exporter/f5cloudexporter/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ exporters:
f5cloud:
endpoint: "https://f5cloud"
source: "dev"
auth:
f5cloud_auth:
credential_file: "/etc/creds/key.json"
f5cloud/allsettings:
endpoint: "https://f5cloud"
source: "dev"
auth:
f5cloud_auth:
credential_file: "/etc/creds/key.json"
audience: "exampleaudience"
timeout: 10s
Expand Down