Skip to content
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

Add config option to select a different azure cloud env in the azure-eventhub input and azure module #17659

Merged
merged 7 commits into from
Apr 21, 2020

Conversation

narph
Copy link
Contributor

@narph narph commented Apr 10, 2020

What does this PR do?

Adds override_resource_manager_endpoint config option to select a different azure cloud env in the azure-eventhub input and azure module.
Users should enter the resource manager endpoint in this case.
Ex:
https://management.chinacloudapi.cn/: azure.ChinaCloud,
https://management.microsoftazure.de/: azure.GermanCloud,
https://management.azure.com/: azure.PublicCloud,
https://management.usgovcloudapi.net/: azure.USGovernmentCloud,

Why is it important?

To support other azure cloud env besides the public one

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

@narph narph requested a review from jsoriano April 10, 2020 10:21
@narph narph self-assigned this Apr 10, 2020
@narph narph added [zube]: In Review Team:Integrations Label for the Integrations team labels Apr 10, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@blakerouse
Copy link
Contributor

Whats the reasoning for the prefix of override_? Couldn't it just be resource_manager_endpoint?

@kaiyan-sheng
Copy link
Contributor

I have the same question as Blake. Also do we need to add this for Metricbeat?

Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this so quickly! Following with the comments by Blake and Kaiyan I have some suggestions about the settings and its docs.

Comment on lines 65 to 67
==== `override_resource_manager_endpoint`

Optional, by default we are using the azure public environment, to override, users can provide a specific resource manager endpoint in order to use a different azure environment.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with the comments by Blake and Kaiyan, don't consider this an override, just a normal setting. Add also something about possible values. And possibly something about hybrid clouds support.

Suggested change
==== `override_resource_manager_endpoint`
Optional, by default we are using the azure public environment, to override, users can provide a specific resource manager endpoint in order to use a different azure environment.
==== `resource_manager_endpoint`
Optional, resource manager endpoint to use, defaults to the public environment, possible values are... . If a URL is provided, the environment is obtained from the URL, this is useful in Hybrid Cloud deployments.

Maybe we could add an explicit option for environment URLs, instead of accepting names and urls in the same option. And maybe use something like environment instead of resource_manager_endpoint, in case we use the same settings for features that need access to other endpoints.

Suggested change
==== `override_resource_manager_endpoint`
Optional, by default we are using the azure public environment, to override, users can provide a specific resource manager endpoint in order to use a different azure environment.
==== `environment.name`
Optional, environment to use, defaults to the public environment, possible values are... .
==== `environment.url`
Optional, loads the environment from a URL, this is useful in the Hybrid Cloud model. If this setting is used, `environment.name` is ignored.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsoriano , the reason I went for the override- is because I do not want users to necessary specify this setting, this should be only used for other private env. To look for the azure resource manager endpoint might take some effort for the users and I want to avoid that in most of the cases where the are using the public cloud.
One workaround I would go for is to rename this option to resource_manager_endpoint but not add it in the config files so users will not be tempted to enter it if unnecessary.
Not sure what you mean by " instead of accepting names and urls in the same option" , we only accept azure resource manager endpoints, the azure-eventhub sdk can retrieve the specific environment based on that.
Also adding environment.name and environment.url might cause more confusion as users will have a hard time figuring those out, also there is no environment.url , we can talk about management_portal_URL or resource_manager_endpoint or service_endpoint but with the resource_manager_endpoint the SDK can help us identify the right env.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsoriano , the reason I went for the override- is because I do not want users to necessary specify this setting, this should be only used for other private env.

Other optional settings behave the same way, and don't have an override prefix, would it be different to other optional settings?

To look for the azure resource manager endpoint might take some effort for the users and I want to avoid that in most of the cases where the are using the public cloud. One workaround I would go for is to rename this option to resource_manager_endpoint but not add it in the config files so users will not be tempted to enter it if unnecessary.

Yes, I find perfectly fine to have this option in the reference docs, but not in the config files.

Not sure what you mean by " instead of accepting names and urls in the same option" , we only accept azure resource manager endpoints, the azure-eventhub sdk can retrieve the specific environment based on that.

Oh, ok, my mistake then, I saw that we accept URLs, and I thought we also accepted some kind of identifier there. One more reason to add some example values in the docs 🙂
I have still a question about that, the URLs accepted by EnvironmentFromURL, are of the same kind as the ones of the resource manager endpoints?

Also adding environment.name and environment.url might cause more confusion as users will have a hard time figuring those out, also there is no environment.url , we can talk about management_portal_URL or resource_manager_endpoint or service_endpoint but with the resource_manager_endpoint the SDK can help us identify the right env.

I was suggesting that to make configuration and its documentation easier. A user wanting to use the US Gov cloud would use environment.name: usgov, or something similar, accepted values could be in the documentation, so they don't need to look for specific endpoints in other places. A user that is using a hybrid cloud would use environment.url: http://.... with an URL that can be accepted by EnvironmentFromURL.
Something like this would be specially helpful if we need to use at some point other endpoints, e.g: the Service Manager Endpoint, so we don't have to add a setting like service_manager_endpoint.

But I don't know much about these endpoints and URLs, so as you prefer 🙂

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I answer myself after reading EnvironmentFromURL source. It seems that the URL accepted by this method is actually the resource manager endpoints and from that it obtains the other endpoints, so this solves my concerns about having different kind of values for hybrid clouds.

So I think that the only pending things to consider would be:

  • Rename of the setting to resource_manager_endpoint.
  • Document possible values for this setting, and how it works for hybrid clouds.

x-pack/filebeat/input/azureeventhub/eph.go Show resolved Hide resolved
x-pack/filebeat/input/azureeventhub/eph.go Show resolved Hide resolved
@jsoriano
Copy link
Member

Someone from the community has tried this change and it worked for them 🙂 https://discuss.elastic.co/t/azure-module-error/227210/13?u=jsoriano

@narph narph requested a review from jsoriano April 20, 2020 11:50
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}
if env, ok := environments[overrideResManager]; ok {
return env, nil
}
Copy link
Member

@jsoriano jsoriano Apr 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit. Should we try without the / path? So it works both for https://management.azure.com/ and https://management.azure.com.

@jsoriano jsoriano added needs_backport PR is waiting to be backported to other branches. v7.8.0 labels Apr 21, 2020
@narph narph merged commit 4e1d4b9 into elastic:master Apr 21, 2020
@narph narph deleted the add-other-env branch April 21, 2020 09:56
narph added a commit to narph/beats that referenced this pull request Apr 21, 2020
…eventhub input and azure module (elastic#17659)

* add option to select a different azure env

* changelog

* rename

* add test

* mage fmt update

(cherry picked from commit 4e1d4b9)
narph added a commit that referenced this pull request Apr 22, 2020
…ure cloud env in the azure-eventhub input and azure module (#17859)

* Add config option to select a different azure cloud env in the azure-eventhub input and azure module (#17659)

* add option to select a different azure env

* changelog

* rename

* add test

* mage fmt update

(cherry picked from commit 4e1d4b9)

* update changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs_backport PR is waiting to be backported to other branches. Team:Integrations Label for the Integrations team v7.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for different Azure Cloud environments in event hub input
6 participants