-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 proxy settings for GCS repository plugin #2096
Add proxy settings for GCS repository plugin #2096
Conversation
Can one of the admins verify this patch? |
❌ Gradle Check failure 4e97e3de3d712669f00693dfdc2be47aa94a62c2 |
4e97e3d
to
0d57658
Compare
❌ Gradle Check failure 0d5765806e205fd76fea108e833b96cb7466018a |
0d57658
to
e279def
Compare
❌ Gradle Check failure e279defbb455a3da6e51e1b6dd0ded22b73e4239 |
e279def
to
a0d064f
Compare
❌ Gradle Check failure a0d064fdf844c426e5883dab6996efc5bec3dee1 |
a0d064f
to
1c316a8
Compare
✅ Gradle Check success 1c316a8178af843213e9eb3c1c0b7c05c1a79ed5 |
1c316a8
to
60c1a19
Compare
✅ Gradle Check success 60c1a19865ef0b812b568fb7132ab2477397ff14 |
60c1a19
to
f72a181
Compare
✅ Gradle Check success f72a1812ba59f88b33ee570ba3975f675feb90bf |
f72a181
to
e1b3b88
Compare
✅ Gradle Check success e1b3b886fc42e742607aea83388bd18be15a8b84 |
e1b3b88
to
83573d5
Compare
❌ Gradle Check failure 83573d5c509b34aa5289003213694870bd1918c7 |
start gradle check |
❌ Gradle Check failure 83573d5c509b34aa5289003213694870bd1918c7 |
start gradle check |
❌ Gradle Check failure 83573d5c509b34aa5289003213694870bd1918c7 |
As far as I understand the tests failure is not related to this PR:
|
start gradle check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there logging missing similar to the Azure plugin for whether proxy is set vs. not?
❌ Gradle Check failure 83573d5c509b34aa5289003213694870bd1918c7 |
let me check. |
Double checked all classes in |
start gradle check |
❌ Gradle Check failure 83573d5c509b34aa5289003213694870bd1918c7 |
static final Setting.AffixSetting<Integer> PROXY_PORT_SETTING = Setting.affixKeySetting( | ||
PREFIX, | ||
"proxy.port", | ||
key -> Setting.intSetting(key, 0, 0, 1 << 16, Setting.Property.NodeScope), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super minor - the maxValue
condition should really be (1 << 16) - 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, will fix.
// Validate proxy settings | ||
if (proxyType == Proxy.Type.DIRECT | ||
&& (proxyPort != 0 || Strings.hasText(proxyHost) || Strings.hasText(proxyUserName) || Strings.hasText(proxyPassword))) { | ||
throw new SettingsException( | ||
"Google Cloud Storage proxy port or host or username or password have been set but proxy type is not defined." | ||
); | ||
} | ||
if (proxyType != Proxy.Type.DIRECT && (proxyPort == 0 || Strings.isEmpty(proxyHost))) { | ||
throw new SettingsException("Google Cloud Storage proxy type has been set but proxy host or port is not defined."); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - given that this is identical to the logic introduced in #2098 , it might be worth it to move this to a common StorageSettings
superclass and have the two classes inherit from this. We could also move getConfigValue
into this parent class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and this is a problem. All these plugins do not have a common repo or something and as a result, all of them contains the same classes e.g. AccessSocket
is almost the same and with the same functionality for all plugins. I was planning to open a discussion here about improvements for Cloud Plugins. And how we (I mean our company) can help with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's have that discussion in an issue so we can close out this PR. I've opened #2155 around it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure. will leave comments.
import java.net.Proxy; | ||
import java.util.Objects; | ||
|
||
public class ProxySettings { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - Most of this is identical to the Azure ProxySettings class. Could you move the majority of this to a superclass and declare Azure and GCS specific subclasses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above :-(
83573d5
to
b40dd7c
Compare
I'm a bit worried about test failures. Could it be that my changes somehow affected it? At a first glance, I did not change anything critical and the plugin is not involved in the failing test. But still not clear for me. |
#2147 will fix the backward compatibility test failures. The other failures I see frequently are related to timeouts trying to download CentOS linux. I haven't seen any failures related to the GCS repository plugin. |
❌ Gradle Check failure b40dd7c9ef5646d52af7fc62b94e811e6e2191c0 |
Ok I see. Yes I see same failures for CentOS as well on my machine something with docker. |
@willyborankin Could you rebase to pull in the fix in #2147 so we can confirm that |
Added proxy settings for GCS repository. Security settings: - gcs.client.*.proxy.username - Proxy user name - gcs.client.*.proxy.password - Proxy user password Common settings: - gcs.client.*.proxy.type - java Proxy.Type names: HTTP, SOCKS. default is DIRECT - gcs.client.*.proxy.host - Proxy host name - gcs.client.*.proxy.port - Proxy port Signed-off-by: Andrey Pleskach <[email protected]>
b40dd7c
to
533f57a
Compare
done |
the ticket for docs: opensearch-project/documentation-website#418 |
Description
Now to configure GCS plugin to use any proxy you need to set standard process variables:
proxyHost
socksProxyHost
proxyPort
proxyUser
proxyPassword
with proxy types prefix.
Such settings have 2 main problems:
To avoid of a such problem all proxy settings were added to OS settings and security settings
Storing username/password in security settings is more secure compare to process settings and in case of any problem with username and password such security settings could be reloaded without restart of each node in the cluster.
Re-loadable security settings:
gcs.client.*.proxy.username
- Proxy user namegcs.client.*.proxy.password
- Proxy user passwordStatic settings:
gcs.client.*.proxy.type
- javaProxy.Type
names:HTTP
,SOCKS
. default isDIRECT
gcs.client.*.proxy.host
- Proxy host namegcs.client.*.proxy.port
- Proxy portNote: Such properties can be added for S3 and Azure as well, so I'm planning to add theme separate PRs.
Issues Resolved
[List any issues this PR will resolve]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.