Skip to content

Commit aba352d

Browse files
mergify[bot]mstinskykaiyan-sheng
authored
[7.17](backport #35184) Remove huaweicloud - revert #27607 (#37828)
* Remove huaweicloud - revert #27607 (#35184) * Remove huaweicloud - revert #27607 The huaweicloud is just openstack therefore revert #27607 to fix detection of all public and private openstack installations. * make huawei an alias for openstack * change doc * Update CHANGELOG.next.asciidoc --------- Co-authored-by: kaiyan-sheng <[email protected]> (cherry picked from commit 07c559b) # Conflicts: # libbeat/processors/add_cloud_metadata/docs/add_cloud_metadata.asciidoc # libbeat/processors/add_cloud_metadata/provider_huawei_cloud.go # libbeat/processors/add_cloud_metadata/provider_huawei_cloud_test.go # libbeat/processors/add_cloud_metadata/providers.go * Update CHANGELOG.next.asciidoc * Update add_cloud_metadata.asciidoc * Update providers.go * fix doc * fix lint --------- Co-authored-by: Maximilian Stinsky <[email protected]> Co-authored-by: kaiyan-sheng <[email protected]>
1 parent e189299 commit aba352d

File tree

5 files changed

+13
-197
lines changed

5 files changed

+13
-197
lines changed

CHANGELOG.next.asciidoc

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
1010

1111
*Affecting all Beats*
1212

13+
- add_cloud_metadata processor: `huawei` provider is now treated as `openstack`. Huawei cloud runs on OpenStack
14+
platform, and when viewed from a metadata API standpoint, it is impossible to differentiate it from OpenStack. If you
15+
know that your deployments run on Huawei Cloud exclusively, and you wish to have `cloud.provider` value as `huawei`,
16+
you can achieve this by overwriting the value using an `add_fields` processor. {pull}35184[35184]
1317

1418
*Auditbeat*
1519

libbeat/processors/add_cloud_metadata/docs/add_cloud_metadata.asciidoc

+6-16
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ The following cloud providers are supported:
2020
- Azure Virtual Machine
2121
- Openstack Nova
2222

23+
NOTE: `huawei` is an alias for `openstack`. Huawei cloud runs on OpenStack platform, and when
24+
viewed from a metadata API standpoint, it is impossible to differentiate it from OpenStack. If you know that your
25+
deployments run on Huawei Cloud exclusively, and you wish to have `cloud.provider` value as `huawei`, you can achieve
26+
this by overwriting the value using an `add_fields` processor.
27+
2328
The Alibaba Cloud and Tencent cloud providers are disabled by default, because
2429
they require to access a remote host. The `providers` setting allows users to
2530
select a list of default providers to query.
@@ -52,10 +57,9 @@ List of names the `providers` setting supports:
5257
- "digitalocean" for Digital Ocean (enabled by default).
5358
- "aws", or "ec2" for Amazon Web Services (enabled by default).
5459
- "gcp" for Google Copmute Enging (enabled by default).
55-
- "openstack", or "nova" for Openstack Nova (enabled by default).
60+
- "openstack", "nova", or "huawei" for Openstack Nova (enabled by default).
5661
- "openstack-ssl", or "nova-ssl" for Openstack Nova when SSL metadata APIs are enabled (enabled by default).
5762
- "tencent", or "qcloud" for Tencent Cloud (disabled by default).
58-
- "huawei" for Huawei Cloud (enabled by default).
5963

6064
The third optional configuration setting is `overwrite`. When `overwrite` is
6165
`true`, `add_cloud_metadata` overwrites existing `cloud.*` fields (`false` by
@@ -126,20 +130,6 @@ _Tencent Cloud_
126130
}
127131
-------------------------------------------------------------------------------
128132

129-
_Huawei Cloud_
130-
131-
[source,json]
132-
-------------------------------------------------------------------------------
133-
{
134-
"cloud": {
135-
"availability_zone": "cn-east-2b",
136-
"instance.id": "37da9890-8289-4c58-ba34-a8271c4a8216",
137-
"provider": "huawei",
138-
"region": "cn-east-2"
139-
}
140-
}
141-
-------------------------------------------------------------------------------
142-
143133
_Alibaba Cloud_
144134

145135
This metadata is only available when VPC is selected as the network type of the

libbeat/processors/add_cloud_metadata/provider_huawei_cloud.go

-80
This file was deleted.

libbeat/processors/add_cloud_metadata/provider_huawei_cloud_test.go

-97
This file was deleted.

libbeat/processors/add_cloud_metadata/providers.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ package add_cloud_metadata
1919

2020
import (
2121
"context"
22+
"fmt"
2223
"net"
2324
"net/http"
2425
"time"
2526

26-
"github.com/pkg/errors"
27-
2827
"github.com/elastic/beats/v7/libbeat/common"
2928
)
3029

@@ -64,7 +63,7 @@ var cloudMetaProviders = map[string]provider{
6463
"nova-ssl": openstackNovaSSLMetadataFetcher,
6564
"qcloud": qcloudMetadataFetcher,
6665
"tencent": qcloudMetadataFetcher,
67-
"huawei": huaweiMetadataFetcher,
66+
"huawei": openstackNovaMetadataFetcher,
6867
}
6968

7069
func selectProviders(configList providerList, providers map[string]provider) map[string]provider {
@@ -113,7 +112,7 @@ func setupFetchers(providers map[string]provider, c *common.Config) ([]metadataF
113112

114113
fetcher, err := ff.Create(name, c)
115114
if err != nil {
116-
return nil, errors.Wrapf(err, "failed to initialize the %v fetcher", name)
115+
return nil, fmt.Errorf("failed to initialize the %v fetcher: %w", name, err)
117116
}
118117

119118
mf = append(mf, fetcher)

0 commit comments

Comments
 (0)