Merge pull request #3074 from thaJeztah/all_proxy

Add support for ALL_PROXY
This commit is contained in:
Sebastiaan van Stijn 2021-07-21 12:50:27 +02:00 committed by GitHub
commit 25eee83d6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 1 deletions

View File

@ -277,6 +277,8 @@ func TestCreateContainerWithProxyConfig(t *testing.T) {
"no_proxy=noProxy", "no_proxy=noProxy",
"FTP_PROXY=ftpProxy", "FTP_PROXY=ftpProxy",
"ftp_proxy=ftpProxy", "ftp_proxy=ftpProxy",
"ALL_PROXY=allProxy",
"all_proxy=allProxy",
} }
sort.Strings(expected) sort.Strings(expected)
@ -299,6 +301,7 @@ func TestCreateContainerWithProxyConfig(t *testing.T) {
HTTPSProxy: "httpsProxy", HTTPSProxy: "httpsProxy",
NoProxy: "noProxy", NoProxy: "noProxy",
FTPProxy: "ftpProxy", FTPProxy: "ftpProxy",
AllProxy: "allProxy",
}, },
}, },
}) })

View File

@ -60,6 +60,7 @@ type ProxyConfig struct {
HTTPSProxy string `json:"httpsProxy,omitempty"` HTTPSProxy string `json:"httpsProxy,omitempty"`
NoProxy string `json:"noProxy,omitempty"` NoProxy string `json:"noProxy,omitempty"`
FTPProxy string `json:"ftpProxy,omitempty"` FTPProxy string `json:"ftpProxy,omitempty"`
AllProxy string `json:"allProxy,omitempty"`
} }
// KubernetesConfig contains Kubernetes orchestrator settings // KubernetesConfig contains Kubernetes orchestrator settings
@ -244,6 +245,7 @@ func (configFile *ConfigFile) ParseProxyConfig(host string, runOpts map[string]*
"HTTPS_PROXY": &config.HTTPSProxy, "HTTPS_PROXY": &config.HTTPSProxy,
"NO_PROXY": &config.NoProxy, "NO_PROXY": &config.NoProxy,
"FTP_PROXY": &config.FTPProxy, "FTP_PROXY": &config.FTPProxy,
"ALL_PROXY": &config.AllProxy,
} }
m := runOpts m := runOpts
if m == nil { if m == nil {

View File

@ -32,12 +32,14 @@ func TestProxyConfig(t *testing.T) {
httpsProxy = "https://user:password@proxy.mycorp.example.com:3129" httpsProxy = "https://user:password@proxy.mycorp.example.com:3129"
ftpProxy = "http://ftpproxy.mycorp.example.com:21" ftpProxy = "http://ftpproxy.mycorp.example.com:21"
noProxy = "*.intra.mycorp.example.com" noProxy = "*.intra.mycorp.example.com"
allProxy = "socks://example.com:1234"
defaultProxyConfig = ProxyConfig{ defaultProxyConfig = ProxyConfig{
HTTPProxy: httpProxy, HTTPProxy: httpProxy,
HTTPSProxy: httpsProxy, HTTPSProxy: httpsProxy,
FTPProxy: ftpProxy, FTPProxy: ftpProxy,
NoProxy: noProxy, NoProxy: noProxy,
AllProxy: allProxy,
} }
) )
@ -57,6 +59,8 @@ func TestProxyConfig(t *testing.T) {
"ftp_proxy": &ftpProxy, "ftp_proxy": &ftpProxy,
"NO_PROXY": &noProxy, "NO_PROXY": &noProxy,
"no_proxy": &noProxy, "no_proxy": &noProxy,
"ALL_PROXY": &allProxy,
"all_proxy": &allProxy,
} }
assert.Check(t, is.DeepEqual(expected, proxyConfig)) assert.Check(t, is.DeepEqual(expected, proxyConfig))
} }

View File

@ -1973,6 +1973,8 @@ corresponding `ARG` instruction in the Dockerfile.
- `ftp_proxy` - `ftp_proxy`
- `NO_PROXY` - `NO_PROXY`
- `no_proxy` - `no_proxy`
- `ALL_PROXY`
- `all_proxy`
To use these, pass them on the command line using the `--build-arg` flag, for To use these, pass them on the command line using the `--build-arg` flag, for
example: example:

View File

@ -214,6 +214,7 @@ be set for each environment:
| `httpsProxy` | Default value of `HTTPS_PROXY` and `https_proxy` for containers, and as `--build-arg` on `docker build` | | `httpsProxy` | Default value of `HTTPS_PROXY` and `https_proxy` for containers, and as `--build-arg` on `docker build` |
| `ftpProxy` | Default value of `FTP_PROXY` and `ftp_proxy` for containers, and as `--build-arg` on `docker build` | | `ftpProxy` | Default value of `FTP_PROXY` and `ftp_proxy` for containers, and as `--build-arg` on `docker build` |
| `noProxy` | Default value of `NO_PROXY` and `no_proxy` for containers, and as `--build-arg` on `docker build` | | `noProxy` | Default value of `NO_PROXY` and `no_proxy` for containers, and as `--build-arg` on `docker build` |
| `allProxy` | Default value of `ALL_PROXY` and `all_proxy` for containers, and as `--build-arg` on `docker build` |
These settings are used to configure proxy settings for containers only, and not These settings are used to configure proxy settings for containers only, and not
used as proxy settings for the `docker` CLI or the `dockerd` daemon. Refer to the used as proxy settings for the `docker` CLI or the `dockerd` daemon. Refer to the
@ -295,7 +296,8 @@ various fields:
"httpProxy": "http://user:pass@example.com:3128", "httpProxy": "http://user:pass@example.com:3128",
"httpsProxy": "https://my-proxy.example.com:3129", "httpsProxy": "https://my-proxy.example.com:3129",
"noProxy": "intra.mycorp.example.com", "noProxy": "intra.mycorp.example.com",
"ftpProxy": "http://user:pass@example.com:3128" "ftpProxy": "http://user:pass@example.com:3128",
"allProxy": "socks://example.com:1234"
}, },
"https://manager1.mycorp.example.com:2377": { "https://manager1.mycorp.example.com:2377": {
"httpProxy": "http://user:pass@example.com:3128", "httpProxy": "http://user:pass@example.com:3128",

View File

@ -437,6 +437,8 @@ A Dockerfile is similar to a Makefile.
* `ftp_proxy` * `ftp_proxy`
* `NO_PROXY` * `NO_PROXY`
* `no_proxy` * `no_proxy`
* `ALL_PROXY`
* `all_proxy`
To use these, pass them on the command line using `--build-arg` flag, for To use these, pass them on the command line using `--build-arg` flag, for
example: example: