Skip to content

Commit

Permalink
[7.17](backport #35184) Remove huaweicloud - revert #27607 (#37828)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Feb 1, 2024
1 parent e189299 commit aba352d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 197 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d

*Affecting all Beats*

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

*Auditbeat*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ The following cloud providers are supported:
- Azure Virtual Machine
- Openstack Nova

NOTE: `huawei` is an alias for `openstack`. Huawei cloud runs on OpenStack platform, and when
viewed from a metadata API standpoint, it is impossible to differentiate it from OpenStack. If you know that your
deployments run on Huawei Cloud exclusively, and you wish to have `cloud.provider` value as `huawei`, you can achieve
this by overwriting the value using an `add_fields` processor.

The Alibaba Cloud and Tencent cloud providers are disabled by default, because
they require to access a remote host. The `providers` setting allows users to
select a list of default providers to query.
Expand Down Expand Up @@ -52,10 +57,9 @@ List of names the `providers` setting supports:
- "digitalocean" for Digital Ocean (enabled by default).
- "aws", or "ec2" for Amazon Web Services (enabled by default).
- "gcp" for Google Copmute Enging (enabled by default).
- "openstack", or "nova" for Openstack Nova (enabled by default).
- "openstack", "nova", or "huawei" for Openstack Nova (enabled by default).
- "openstack-ssl", or "nova-ssl" for Openstack Nova when SSL metadata APIs are enabled (enabled by default).
- "tencent", or "qcloud" for Tencent Cloud (disabled by default).
- "huawei" for Huawei Cloud (enabled by default).

The third optional configuration setting is `overwrite`. When `overwrite` is
`true`, `add_cloud_metadata` overwrites existing `cloud.*` fields (`false` by
Expand Down Expand Up @@ -126,20 +130,6 @@ _Tencent Cloud_
}
-------------------------------------------------------------------------------

_Huawei Cloud_

[source,json]
-------------------------------------------------------------------------------
{
"cloud": {
"availability_zone": "cn-east-2b",
"instance.id": "37da9890-8289-4c58-ba34-a8271c4a8216",
"provider": "huawei",
"region": "cn-east-2"
}
}
-------------------------------------------------------------------------------

_Alibaba Cloud_

This metadata is only available when VPC is selected as the network type of the
Expand Down
80 changes: 0 additions & 80 deletions libbeat/processors/add_cloud_metadata/provider_huawei_cloud.go

This file was deleted.

This file was deleted.

7 changes: 3 additions & 4 deletions libbeat/processors/add_cloud_metadata/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ package add_cloud_metadata

import (
"context"
"fmt"
"net"
"net/http"
"time"

"github.com/pkg/errors"

"github.com/elastic/beats/v7/libbeat/common"
)

Expand Down Expand Up @@ -64,7 +63,7 @@ var cloudMetaProviders = map[string]provider{
"nova-ssl": openstackNovaSSLMetadataFetcher,
"qcloud": qcloudMetadataFetcher,
"tencent": qcloudMetadataFetcher,
"huawei": huaweiMetadataFetcher,
"huawei": openstackNovaMetadataFetcher,
}

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

fetcher, err := ff.Create(name, c)
if err != nil {
return nil, errors.Wrapf(err, "failed to initialize the %v fetcher", name)
return nil, fmt.Errorf("failed to initialize the %v fetcher: %w", name, err)
}

mf = append(mf, fetcher)
Expand Down

0 comments on commit aba352d

Please sign in to comment.