Merge pull request #29565 from yuexiao-wang/fix-typo-tls
Change tls to TLS
This commit is contained in:
commit
8f9a48ab5a
11 changed files with 13 additions and 13 deletions
|
@ -21,7 +21,7 @@ const (
|
||||||
DefaultKeyFile = "key.pem"
|
DefaultKeyFile = "key.pem"
|
||||||
// DefaultCertFile is the default filename for the cert pem file
|
// DefaultCertFile is the default filename for the cert pem file
|
||||||
DefaultCertFile = "cert.pem"
|
DefaultCertFile = "cert.pem"
|
||||||
// FlagTLSVerify is the flag name for the tls verification option
|
// FlagTLSVerify is the flag name for the TLS verification option
|
||||||
FlagTLSVerify = "tlsverify"
|
FlagTLSVerify = "tlsverify"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ func (commonOpts *CommonOptions) InstallFlags(flags *pflag.FlagSet) {
|
||||||
// complete
|
// complete
|
||||||
func (commonOpts *CommonOptions) SetDefaultOptions(flags *pflag.FlagSet) {
|
func (commonOpts *CommonOptions) SetDefaultOptions(flags *pflag.FlagSet) {
|
||||||
// Regardless of whether the user sets it to true or false, if they
|
// Regardless of whether the user sets it to true or false, if they
|
||||||
// specify --tlsverify at all then we need to turn on tls
|
// specify --tlsverify at all then we need to turn on TLS
|
||||||
// TLSVerify can be true even if not set due to DOCKER_TLS_VERIFY env var, so we need
|
// TLSVerify can be true even if not set due to DOCKER_TLS_VERIFY env var, so we need
|
||||||
// to check that here as well
|
// to check that here as well
|
||||||
if flags.Changed(FlagTLSVerify) || commonOpts.TLSVerify {
|
if flags.Changed(FlagTLSVerify) || commonOpts.TLSVerify {
|
||||||
|
|
|
@ -86,7 +86,7 @@ type Client struct {
|
||||||
// NewEnvClient initializes a new API client based on environment variables.
|
// NewEnvClient initializes a new API client based on environment variables.
|
||||||
// Use DOCKER_HOST to set the url to the docker server.
|
// Use DOCKER_HOST to set the url to the docker server.
|
||||||
// Use DOCKER_API_VERSION to set the version of the API to reach, leave empty for latest.
|
// Use DOCKER_API_VERSION to set the version of the API to reach, leave empty for latest.
|
||||||
// Use DOCKER_CERT_PATH to load the tls certificates from.
|
// Use DOCKER_CERT_PATH to load the TLS certificates from.
|
||||||
// Use DOCKER_TLS_VERIFY to enable or disable TLS verification, off by default.
|
// Use DOCKER_TLS_VERIFY to enable or disable TLS verification, off by default.
|
||||||
func NewEnvClient() (*Client, error) {
|
func NewEnvClient() (*Client, error) {
|
||||||
var client *http.Client
|
var client *http.Client
|
||||||
|
|
|
@ -102,11 +102,11 @@ func TestNewEnvClient(t *testing.T) {
|
||||||
// pedantic checking that this is handled correctly
|
// pedantic checking that this is handled correctly
|
||||||
tr := apiclient.client.Transport.(*http.Transport)
|
tr := apiclient.client.Transport.(*http.Transport)
|
||||||
if tr.TLSClientConfig == nil {
|
if tr.TLSClientConfig == nil {
|
||||||
t.Error("no tls config found when DOCKER_TLS_VERIFY enabled")
|
t.Error("no TLS config found when DOCKER_TLS_VERIFY enabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
if tr.TLSClientConfig.InsecureSkipVerify {
|
if tr.TLSClientConfig.InsecureSkipVerify {
|
||||||
t.Error("tls verification should be enabled")
|
t.Error("TLS verification should be enabled")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SwarmInit initializes the Swarm.
|
// SwarmInit initializes the swarm.
|
||||||
func (cli *Client) SwarmInit(ctx context.Context, req swarm.InitRequest) (string, error) {
|
func (cli *Client) SwarmInit(ctx context.Context, req swarm.InitRequest) (string, error) {
|
||||||
serverResp, err := cli.post(ctx, "/swarm/init", nil, req, nil)
|
serverResp, err := cli.post(ctx, "/swarm/init", nil, req, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SwarmInspect inspects the Swarm.
|
// SwarmInspect inspects the swarm.
|
||||||
func (cli *Client) SwarmInspect(ctx context.Context) (swarm.Swarm, error) {
|
func (cli *Client) SwarmInspect(ctx context.Context) (swarm.Swarm, error) {
|
||||||
serverResp, err := cli.get(ctx, "/swarm", nil, nil)
|
serverResp, err := cli.get(ctx, "/swarm", nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SwarmJoin joins the Swarm.
|
// SwarmJoin joins the swarm.
|
||||||
func (cli *Client) SwarmJoin(ctx context.Context, req swarm.JoinRequest) error {
|
func (cli *Client) SwarmJoin(ctx context.Context, req swarm.JoinRequest) error {
|
||||||
resp, err := cli.post(ctx, "/swarm/join", nil, req, nil)
|
resp, err := cli.post(ctx, "/swarm/join", nil, req, nil)
|
||||||
ensureReaderClosed(resp)
|
ensureReaderClosed(resp)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SwarmLeave leaves the Swarm.
|
// SwarmLeave leaves the swarm.
|
||||||
func (cli *Client) SwarmLeave(ctx context.Context, force bool) error {
|
func (cli *Client) SwarmLeave(ctx context.Context, force bool) error {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
if force {
|
if force {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SwarmUpdate updates the Swarm.
|
// SwarmUpdate updates the swarm.
|
||||||
func (cli *Client) SwarmUpdate(ctx context.Context, version swarm.Version, swarm swarm.Spec, flags swarm.UpdateFlags) error {
|
func (cli *Client) SwarmUpdate(ctx context.Context, version swarm.Version, swarm swarm.Spec, flags swarm.UpdateFlags) error {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
query.Set("version", strconv.FormatUint(version.Index, 10))
|
query.Set("version", strconv.FormatUint(version.Index, 10))
|
||||||
|
|
|
@ -13,7 +13,7 @@ func (tf transportFunc) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
return tf(req)
|
return tf(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
// resolveTLSConfig attempts to resolve the tls configuration from the
|
// resolveTLSConfig attempts to resolve the TLS configuration from the
|
||||||
// RoundTripper.
|
// RoundTripper.
|
||||||
func resolveTLSConfig(transport http.RoundTripper) *tls.Config {
|
func resolveTLSConfig(transport http.RoundTripper) *tls.Config {
|
||||||
switch tr := transport.(type) {
|
switch tr := transport.(type) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ Options:
|
||||||
-q, --quiet Only display IDs
|
-q, --quiet Only display IDs
|
||||||
```
|
```
|
||||||
|
|
||||||
Run this command on a manager node to list the secrets in the Swarm.
|
Run this command on a manager node to list the secrets in the swarm.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ func ValidateHost(val string) (string, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Note: unlike most flag validators, we don't return the mutated value here
|
// Note: unlike most flag validators, we don't return the mutated value here
|
||||||
// we need to know what the user entered later (using ParseHost) to adjust for tls
|
// we need to know what the user entered later (using ParseHost) to adjust for TLS
|
||||||
return val, nil
|
return val, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue